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
- 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.
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)
- 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.
Step 1: Install Ansible
You have two options:
- QUICKSTART: Install Ansible on your server and continue with the quickstart instructions.
- BETTER: Install Ansible locally and deploy to a remote server from your local computer. Make sure your remote server has Python 2.x installed.
Step 2: Configure playbook
Login via SSH to your server. Get started with
$ 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:
- SELF-HOST: Deliver your own mail.
- EXTERNAL: Sign up with a commercial service (eg, Mandrill).
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.
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