Introduction

Sovereign is a decentralized governance platform for organisations of all sizes being created by the visionaries over at Democracy Earth. Although still in the early stages of development there is huge potential for Sovereign to change how we manage democratic processes online. If you would like to know more about the project I'd highly recommend taking the time to read the Democracy Earth white paper which explains the political motivations as well as the underlying technology. The entire project is open source and the Sovereign source code is available on GitHub.

I wanted to get involved with development of the app and thought that the best way to start contributing - as is often the case - was with some documentation. In that spirit, the rest of this post will run through how to install the current version (1.0.4-alpha) of Sovereign on an Ubuntu server.

Installation Guide

Assumptions

This guide assumes some basic prior knowledge of server management such as launching an instances and connecting via SSH. It has been written using a newly-launched Digital Ocean droplet running Ubuntu 16.04 and assumes that all the appropriate DNS records have been set to point a domain at the server. If you have a firewall assigned to your server in Digital Ocean you should open ports 80, 443 and 3000.

If you don't have access to a server yet you can use my Digital Ocean referral link to get yourself enough welcome credit to spin up a standard droplet for a couple of months.

Other providers and server configurations may well work with this guide but haven't been tested so please do let me know how you get on if you use a different host or operating system.

Guide

Sign in to your server as root. First we'll create a user for doing the work and set up meteor with a test application to make sure we've hit our base dependencies.

apt-get update
apt-get upgrade
apt-get install curl git
adduser --gecos "" sovereign
usermod -aG sudo sovereign
su - sovereign
curl https://install.meteor.com | sh
meteor create ~/test-app
cd ~/test-app
meteor update
meteor

You should now be able to visit http://{domain}:3000 in your browser and see the test application. We can now install Sovereign.

git clone https://github.com/DemocracyEarth/sovereign.git ~/sovereign
cd ~/sovereign
git checkout 1.0.4-alpha
meteor update

Due to a bug in Sovereign v1.0.4-alpha we need to make a small change to the package.json file before we continue.

nano package.json

Replace these lines:

	"lint": "eslint .",
	"postinstall": "./node_modules/.bin/opencollective-postinstall || exit 0"

With this:

     "lint": "eslint ."

And then remove the following line:

    "opencollective-postinstall": "^1.0.11",

We can now carry on with our installation.

meteor npm install
meteor npm install --save @babel/runtime
meteor npm install --save bcrypt

We now have everything we need to run Sovereign but we need to do a little more work on the server to make our Sovereign instance usable. We'll set up nginx as a reverse proxy so we can access our application on the default port and we'll also install an SSL certificate courtesy of Let's Encrypt.

sudo apt-get install nginx software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo nano /etc/nginx/sites-available/default

Add the following to the very top of the file, replacing {domain} with your domain:

server {
	listen 80;
	server_name {domain};

	location / {
		proxy_pass http://localhost:3000;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_set_header Host $host;
	}
}

Now we generate and install our SSL certificate:

sudo certbot --nginx

Finally we can configure our Sovereign instance with a few configuration changes. We're treating this as a production application so we'll need to make a copy of the development settings.

cp -R config/development/ config/production
nano config/production/settings.json

Some of the values here are required to make the application work completely because there is currently tight coupling to some third-party services. You need to provide Mailgun credentials to send outgoing email (for password resets, etc.), AWS API keys to upload profile pictures and Facebook API keys to sign in with Facebook. Obtaining these credentials is a little out of scope for this guide but the rest of the application should work just fine if you want to skip adding them.

You might also want to update some of the values under Collective to better reflect your instance, (although you can do this through the application admin later.) Note that the logo must be a local file so if you set this value to images/your-logo.png you could grab an image from the internet using wget:

wget -c {url_of_image} -O ~/sovereign/public/images/your-logo.png

Finally we're ready to start Sovereign!

meteor npm run start

Your app should now be available at https://{domain}.

Conclusion

I hope this was a useful introduction to the Sovereign app and will inspire you to check it out yourself. Comments, corrections and criticisms are welcome; you can either comment below, catch me on the Democracy Earth slack channel or you can get in touch in the following places:

Email: hello@thefourthdev.work
GitHub: @TheFourthDev
Mastodon: @thefourthdev@mastodon.thefourthdev.work
Twitter: @thefourthdev
Web: https://thefourthdev.work

Go and set some democracy in action!