Easily install Discourse with Ansible and without Docker
Shell Makefile
Latest commit c019491 Dec 26, 2015 2 @jamielinux v1.0.9

README.rst

Deploy Discourse using Ansible

Easily deploy Discourse with Ansible (and without Docker). Several operating systems are supported, including CentOS, Debian, Fedora and Ubuntu. You don’t need any knowledge of Ansible (but it’s recommended).

ansible-discourse deploys a similar software stack to the official Discourse Docker image, including PostgreSQL, Redis, NGINX and Ruby (via rbenv).

Don’t report issues to meta.discourse.org. Instead, open a new issue here.

Bonus features:

  • Integrate with systemd for service management and isolation.
  • Zero-downtime Unicorn restarts even after upgrading Ruby via rbenv (so downtime is rare).
  • Install Unbound as a local DNS resolver with DNSSEC validation.
  • Install Postfix and OpenDKIM to send emails (so no third-party service is required).
  • Don’t install pngout as it’s not free software.

Is this for me?

The Discourse team only supports installation via Docker. ansible-discourse may suit you if:

  • you already manage your servers with Ansible
  • you want more flexibility over your production environment
  • you don’t want to run an OS (Docker container) inside an OS (virtual machine) inside an OS
  • you need more secure isolation (eg, hardware virtualization) than Docker can provide (as containers do not contain)

Important notes

  • I cannot provide any guarantees. If you need guaranteed uptime but aren’t an experienced system administrator, consider purchasing premium support from Discourse.org.
  • In some cases, external package repositories are used.

Quickstart

Step 1: Install Ansible

You have two options:

Step 2: Configure playbook

Login via SSH to your server. Get started with vars_example.yml.

$ git clone https://github.com/jamielinux/ansible-discourse
$ cd ansible-discourse
$ cp vars_example.yml group_vars/all/main.yml
$ vim group_vars/all/main.yml

Step 3: Mail server

Discourse needs to be able to send notification emails. You have two options:

Step 4: Deploy

The very first run will take 10-25 minutes depending on your hardware. A good chunk is spent compiling Ruby, so En Garde!

$ sudo ./deploy-local.sh

You should configure a firewall with ports 22, 80 and 443 open. You should also enable automatic system updates. Consult your operating system documentation for instructions.

Updating

By default, the latest stable Discourse release is installed. When a new version is released, simply re-run deploy-local.sh. Re-runs are much faster than the first run, as Ansible skips completed tasks (eg, Ruby doesn’t need to be compiled again).

$ cd ansible-discourse
$ git pull
$ sudo ./deploy-local.sh

Further configuration