I purchased a dead cheap VPS for 5$ a month which come with 2GB of memory, 80GB disk space and quite decent CPU. The downside is they uses a very old kernel (2.6.32-042stab108.8 to be specific) while the official Discourse installation guide use Docker which require a more recent one (3.x).

Docker sure makes it easy to install Discourse but it’s the only reason that newer kernel is required. After a quick research, I found this Ansible playbook. It looks well-maintained (last commit was Dec 2015).

It doesn’t work right out of the box for me but after some debugging, I was able to install Discourse just fine. There are few things to note though.

  • On default Ubuntu installation, Apache will use port 80, making nginx fails to start. You will have to stop/uninstall Apache2 in advance (sudo apt-get remove apache2)

  • On some VPS providers, IPv6 is not enabled so you will also need to tweak nginx configuration to bind to IPv4 only.

  • If locale is not set, the script will fail as well. This command localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 fixes it.

Installing plugins

discourse is the default username if you use the above playbook. Replace it if needed.

cd /var/www/discouse/plugins
# git clone the plugin you want to install
sudo /home/discourse/.rbenv/shims/bundle exec rake db:migrate /var/www/discourse RAILS_ENV=production
sudo /home/discourse/.rbenv/shims/bundle exec rake assets:precompile /var/www/discourse RAILS_ENV=production
sudo systemctl reload discourse-unicorn.service

Bonus: btw, Let’s Encrypt offers free SSL. Setting it up is really easy too.