Permalink
Find file
442c1b2 Jul 8, 2016
123 lines (60 sloc) 6.21 KB

How to set up a 1999.io server on Ubuntu

1999.io is a new blogging environment that's fast and easy, and has lots of features no other blogging software has. This doc shows you how to set up a 1999.io server on Ubuntu.

Overview

  1. These instructions are for Ubuntu. Other versions of Linux or Windows or Mac OS will require you to figure out how to install Node.js yourself.

  2. 1999's server is special configuration of nodeStorage, which can be used to run other software.

  3. It's written in JavaScript and runs under Node.js.

  4. We use Twitter for identity, so creating a connection to Twitter is part of the setup process.

  5. If you want to try out the software before installing you can create a test site on my.1999.io. The usual caveats apply. I can't run these test sites forever, but I have no immediate plans to take it down. The safest bet if you plan to use 1999.io to blog for real is to run your own server.

  6. There's an Amazon EC2 machine image. If you're setting up a server on EC2, using the image does a bunch of the work for you.

Dave Winer, May 2016

Install Node.js

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.

Install git

sudo apt-get install git

I like to install git, because it makes it easy to install nodeStorage from GitHub.

It's also required for the server to be able to install updates, which it does with git.

Download nodeStorage

nodeStorage is the name of the 1999 server software. It can be used for other apps. This doc shows you how to set it up for running 1999.

git clone https://github.com/scripting/nodestorage.git

Install it

Change into the nodestorage directory you created in the previous step.

cd nodestorage

npm install

Create config.json

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.

  1. myPort -- enter the number of the port you want to use. Make sure that this port is open in your firewall, if you have one on this server.

  2. websocketPort -- we use a technology called WebSockets to push updates back to the editing app, and to pages that people are reading. So you must specify a port for the WS server to run on, and as with the main HTTP port, above, it must be open in your firewall.

  3. 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. Be sure to include the port you're using in the domain, as shown in the example.

  4. where -- leave it as-is. It will store the public and private files in sub-folders of the nodestorage folder.

  5. 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.

Set up your Twitter app

  1. 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.

  2. Give your app a name. If it's for your book club, you could call it The Hometown 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. ;-)

  3. The website URL will be the value for myDomain specified in your config.json file, as an HTTP url. From the example, it would be http://1999.bullmancuso.io:1999/

  4. The callback URL for nodeStorage instances is the url of the app, as specified in the previous step, followed by "callbackFromTwitter" (don't include the quotes).

  5. Here's a screen shot of a filled-out Twitter app page.

  6. 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.

  7. Open config.json in your editor, and replace the placeholder values for twitterConsumerKey and twitterConsumerSecret with these values and save the file.

Launch nodeStorage

node storage.js

Test your setup

  1. Go to the home page of your server. In the example above it would be http://1999.bullmancuso.io:1999/.

  2. You should see a page a menu on the right edge of the menu bar entitled Sign on here.

  3. From that menu choose Sign on Twitter...

  4. You should get the Twitter authorization page. Authorize your app.

  5. It should send you back to your home page, where you should see an edit box at the top and a few menus. Type some text in the box and click the Post button.

  6. If it worked, you should see a new post below that. If you click on the wedge you'll see a menu of options for the post. If you click on the Eye icon next to the menu you should see a rendering of the page.

  7. Pat yourself on the back. You are now a DevOps dudess or duderino. On your way to being a Full Stack Developer. ;-)

Where to go from here

There are lots of ways to get apps to launch in the background, I like forever because it keeps the app running even if it crashes.

sudo npm install forever -g