Deploying a wiki

There are lots of ways to deploy Federated Wiki. Here we are just talking about the easiest way to install the Node version to it's own, otherwise empty, Ubuntu 14.04 VPS from Digital Ocean.

Start by creating a 'droplet' after creating an account and logging in at Digital Ocean. website

Enter a host name (can be anything), and select a size.

If this is for personal use, or just you and a few friends, go ahead and choose the cheapest possible VPS (512mb ram). If you're planning on having a lot of wikis or a lot of traffic, spring for the 2gb ram 2 cpu option.

Choose the data center nearest you, and don't worry about any of 'additional options', we don't need them.

Select Ubuntu 14.04 x64 as your operating system. If you use SSH go ahead and add your key and select it. If not, don't worry about it, it's not necessary.

Click create droplet, wait about a minute, and you have a nice new server of your very own!

The install script can be found here: gist

Log into your server as the user 'root', either by sshing into the IP address with the key you provided, or by clicking on the access tab, followed by the console access button. The only disadvantage of the web console is you can't copy and paste into it. So you will have to type in the password they emailed to you.

ssh root@128.199.166.158

Enter the command below exactly as it appears:

curl -L https://goo.gl/HeJ5HP | bash

This will install the latest 0.10 version of node, and the corresponding npm, then use npm to install the nave node version manager globally, and the latest version of wiki. It will then add an upstart script for wiki to your system, and start it in farm mode listening to port 80.

You can use standard upstart commands like `start wiki`, `stop wiki`, and `restart wiki` to control your wiki instance. It will start automatically on boot after the networking layer is started, and stop as the machine is shutting off its network. It should also restart if the wiki experiences an error.

At this point you have a wiki farm running! You can get to it by going to the ip address of your new server from any web browser. This will spawn your first wiki instance. Be careful getting started though, because each wiki is addressed by the host name you use to visit it. So content you add using the ip address will only be visible if the visitor comes directly to the ip address.

You will want to point a domain name at your server, like example.com, or maybe just a sub domain like foo.example.com. The cool trick about farm mode is that any domain name you point at this server will get its own wiki when it gets visited. So if you use a wild card record, like *.example.com then each time you use a different thing.example.com you start a new site for that thing.

All data is stored using flat json files in /root/.wiki

The reason this needs its own machine is because it greedily takes port 80 (the main port for web services), and updates the machine's global node version/installs node. FedWiki can be run on most machines along side other applications, but doing so is out of scope for this install script.