Federated Wiki on Digital Ocean

At some point you may want to run your own Federated Wiki site, or perhaps set one up for friends or a class. We've had good luck installing on Digital Ocean, which currently offers very cheap hosting and a much simpler setup than services such as Amazon Web Services.

*Much of the content here is also applicable when installing Federated Wiki on other platforms.*

## Before You Start

Before you start there are some things to consider. You will very probably want a name to access your Federated Wiki, you will need to get yourself a domain, ask a friend or colleague for a domain name registrar that they use and like/trust.

Digital Ocean provides some tutorials to walk you though the various steps, we will be referring to them as we step through initial server setup, and installing the Federated Wiki server.

## Creating a Server

First, sign up for Digital Ocean. html

Once the sign up is complete you will have the option to create a new `droplet`.

The following will help you when following the tutorial . * A name for the droplet, e.g. `fedwiki`, * Choose a size, for a personal site or a small group site, we've found the $5/month option works perfectly fine. * A datacenter, choose one that is in the same area as you. * Choose an image, we will choose `Ubuntu 14.04.3 x32` which is the current 'Long Term Support' version of Ubuntu *supported until during 2019*. With less than 3GB of memory, it is recommended to use a 32-bit operating system. * It is recommended to use a SSH key to connect to the server, if you don't already have one click on `New SSH Key` to create one. tutorial

You should now have created a droplet, and be connected to it.

## Server Setup

We are going to follow the steps in the `New Ubuntu 14.04 Server Checklist`

* How To Connect To Your Droplet With SSH, *you should already be connected, but this covers the process in detail* tutorial * Initial Server Setup with Ubuntu 14.04 (ssh, sudo) tutorial * Additional Recommended Steps for New Ubuntu 14.04 servers (ufw, ntp, swap) tutorial * It is also highly recommended that you configure Clould Firewalls *in addition to ufw* tutorial

In the second tutorial replace `demo` with `wiki`. We will use this `wiki` account to run our Federated Wiki server later.

We will also setup the server to install patches automatically.

The recommended method for performing unattended upgrades is to use the `unattended-upgrades` package. Configuration is covered in in a tutorial and guide .

Some upgrades can require a server reboot, it is best to configure unattended upgrades to do this automatically.

In `/etc/apt/apt.conf.d/50unattended-upgrades` check that `Unattended-Upgrade::Automatic-Reboot` is `true`. **Also** ensure the `update-notifier-common` package is installed.

Also in `/etc/apt/apt.conf.d/50unattended-upgrades` you can uncomment the line

"${distro_id} ${distro_codename}-updates";

to apply updates as well as security patches. This will be needed if you choose to update Node.js automatically.

## Node.js Install

Node.js Long Term Support Release Schedule github

We will install Node.js using the package manager. guide .

Some of the Federated Wiki components include native code, so also install the optional build tools.

You will want to monitor for Node.js Security Updates, forum , or blog .

To install a security update, manually run the following commands:

sudo apt-get update sudo apt-get upgrade

This will also apply any other available updates at the same time.

Alternatively you could configure the unattended upgrade process to also apply Node.js updates.

There are a number of options for using a reverse proxy in front of the Federated Wiki server. Previously we have used Nginx, but currently prefer Caddy for its On-Demand TLS.

### Federated Wiki Install, and Configuration

We will now install the Federated Wiki software, configure it to restart automatically when the server is restarted.

We will be configuring a reverse proxy to forward request to the wiki server. We currently prefer Caddy, see Federated Wiki with Caddy, but there are also some older notes on Federated Wiki with Nginx.

Federated Wiki is installed, and updated, by typing:

sudo npm install -g wiki

Any independent plugins can be added to the wiki where it has been globally installed. For example:

cd /usr/lib/node_modules/wiki sudo npm install wiki-plugin-transport sudo npm install wiki-plugin-search

The tutorial uses the `pm2` process manager. Below are instructions for using `init` as a simpler alternative.

We can set up a Federated Wiki farm, that will automatically start when then the machine is restarted and we can start, and stop, using `sudo start wiki` and `sudo stop wiki`, by running the following commands, replacing `<user>` with the user you want to run wiki as:

initscript=" start on started networking stop on stopping networking respawn exec sudo -H -u <user> wiki --conf /home/<user>/config.json " echo "$initscript" | sudo tee /etc/init/wiki.conf > /dev/null

This will use `/home/<user>/config.json` as the configuration file for the wiki. An initial simple initial config file would contain:

{ "farm": true, "debug": false }

If we start the Federated Wiki, `sudo start wiki`, we can check that it is running by typing `curl` which should return the text `Found. Redirecting to welcome-vistors.html`.

At this point we need to configure the wiki server to use our preferred identity provider, the default providers are either the Passport.js plugin that supports GitHub, Google and/or Twitter github , or the Friends plugin github .

You will also want to have your reverse proxy (Caddy, or Nginx) configured, so you can test to ensure that the configuration has been successfully done.

Of course DNS would need to be setup to point the names we wish to use to our droplet, see tutorial and tutorial .

You should now be able to access our new Federated Wiki site.

Next access your new Federated Wiki sites, sign in and claim them.

You will want to periodically: * Backup your wiki pages, * Check for updates to Node.js and wiki