Here's a checklist for installing nodeStorage on Ubuntu.
sudo apt-get update sudo apt-get install nodejs sudo apt-get install npm sudo apt-get install nodejs-legacy
We also install npm, a requirement to run Node apps.
nodejs-legacy makes it possible to run apps by saying node app.js instead of having to use nodejs, an oddity of Ubuntu.
sudo apt-get install git
I like to install git, because it makes it easy to install nodeStorage from GitHub.
git clone https://github.com/scripting/nodestorage.git
Change into the nodestorage directory you created in the previous step.
cd nodestorage npm install
Launch your favorite Unix editor. I like nano because I'm a newbie, and it has a nice menu at the bottom of the screen if you don't know the commands.
nano config.json
Here's a template for config.json, copy the text, and paste it into nano in your terminal window.
Now I'm going to go through all the elements step by step, explaining what you have to do to set their values.
enabled -- this one is easy, leave it at true.
myPort -- enter the number of the port you want to use for nodeStorage. Make sure that this port is open in your firewall, if you have one on this server.
myDomain -- enter a domain name that points to this server. If you don't have one, you can enter the IP address of the machine, it will work as well as the domain name (but it's not mnemonic, and it's hard-coded, so if you move your installation, you'll have to change your apps).
where -- leave it as-is. It will store the public and private files in sub-folders of the nodestorage folder.
basePublicUrl -- take the domain and port and use them to form a URL. Be careful not to put a trailing slash on the URL as shown in the example. It must be exactly the form specified above.
twitterConsumerKey and twitterConsumerSecret -- I'll explain how to set this up in the next section. For now, leave them as set in the example. The strings are nonsense, just placeholders.
Save the file by typing Control-O, then exit with Control-X.
node storage.js
Go to apps.twitter.com and click Create New App in the upper-right corner. A page with a form appears, asking for details of your app.
You're probably configuring an app like MyWord Editor, but you have to call it something different. If it's for your book club, you could call it The Illium Book Club Blogs. If the name is already being used by someone, choose a different name. For my example I used "My test editor 2789". It was available.
The website URL will depend on whether you're hosting the app or someone else is. Use the URL of the app that's going to talk to Twitter. Since I am just using MyWord Editor I just entered the URL for the app on myword.io.
The callback URL for nodeStorage instances is the url of the app, as specified by basePublicUrl in config.json, followed by "/callbackFromTwitter" (don't include the quotes).
As an example, here's a screen shot of the page I used to set up Little Pork Chop, an app that uses nodeStorage.
If it all worked, you should have a Twitter app set up. Click on the Test OAuth button in the upper-right corner of the page, and it will show you two values, consumer key and consumer secret.
In the terminal, press Control-C to quit nodeStorage.
Open config.json in your editor, and replace the placeholder values for twitterConsumerKey and twitterConsumerSecret with these values and save the file.
Go to MyWord Editor.
Choose Switch Server in the Editor menu.
Enter the URL you entered for basePublicUrl above.
Sign on with the command in the rightmost menu.
You should get the Twitter authorization page. Authorize your app.
Enter a title, description and body.
Choose View Story in the Publish menu. You should see the story.
Look at your terminal. You should see various items in the log, showing MyWord Editor talking to your server.
Pat yourself on the back. You are now a DevOps dudess or duderino. On your way to being a Full Stack Developer.