Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Install Discourse

Discourse is a new style of forum that the makers of the Stack Exchange network have been working on. Sites like Tek Syndicate and How-to-Geek are already using it, probably because it is fairly easy to deploy, and it appears to have a much more aesthetically pleasing look.


  • I recommend deploying discourse on a server/VPS with at least 2 GiB of RAM.

  • I use Debian or Ubuntu for discourse forums as that is the easiest way to work around the issues discourse has with the devicemapper driver.


Install docker.

Fetch Discourse

git clone

Configure The Discourse App

cd discourse_docker
cp samples/standalone.yml containers/app.yml

Run the following set of commands to prevent exposing SSH access to the rest of the world.

SEARCH='  - "2222:22"'
REPLACE='  - ""'

We also need to set the hostname so that emails to users will link to the correct address. This is most noticeable with the account activation emails which will not work if you do not do this!

MY_IP_OR_HOSTNAME=[put your server's IP or full domain name here]

We need to configure ourselves to be admin with the following commands:

MY_EMAIL='[put your real email address here]'

Optional - Use Stable Not Beta

By default, the configuration will be set to use any version that has passed tests rather than a stable release. Run the commands below to switch to using stable releases.

SEARCH="#version: stable"
REPLACE="version: stable"

Configure SMTP

If you're a Gmail user, you can create an app specific password and use that with the following set of commands to configure discourse for SMTP. If you're not a Gmail user, you can still run the commands below, but you need to lookup your SMTP details from your email provider, and you may need to change the port from 587.

PASSWORD="my gmail app specific password"




SEARCH='#DISCOURSE_SMTP_PASSWORD: pa$$word               # (optional)'

Build the application

Every time you reconfigure Discourse, you need to rebuild the application, which will take a long time when executed for the first time. Make sure to wait for it to complete before moving onto the next section.

./launcher rebuild app


Navigate to your server's hostname or IP in your browser.

Click "Sign up", and register the email you configured as an admin before. Then check your email and click on the link. You should now be setup! You can manage your site from YOUR_HOSTNAME_OR_IP/admin.

Migrating Server

All the "state" (such as the database data and uploaded content) is kept in /var/discourse/shared/standalone. Thus, to migrate to another server, perform the following steps:

  • Install discourse on the new server using the steps above.
  • Stop and remove the containers on both the old and new server.
  • Replace the /var/discourse/shared/standalone area on the new server with the files from the original using scp.
  • Run ./launcher rebuild app to rebuild the app on the new server and wait for the rebuild to finish.

Updating Discourse

Every now and then you will need to update the discourse application for security updates etc. Unfortunately, this is not a case of just pulling a later docker image and deploying a new container using that. Instead you need to update the code-base and rebuild using the following steps:

cd ~/discourse_docker
git pull
./launcher rebuild app


You now have a deployed discourse server. You may now wish to configure it to use SSL.


Last updated: 13th July 2023
First published: 16th August 2018