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.
git clone https://github.com/discourse/discourse_docker.git
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=' - "127.0.0.1:2222:22"' FILEPATH="containers/app.yml" sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
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] SEARCH="DISCOURSE_HOSTNAME: 'discourse.example.com'" REPLACE="DISCOURSE_HOSTNAME: '$MY_IP_OR_HOSTNAME'" FILEPATH="containers/app.yml" sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
We need to configure ourselves to be admin with the following commands:
MY_EMAIL='[put your real email address here]' SEARCH="DISCOURSE_DEVELOPER_EMAILS: 'firstname.lastname@example.org'" REPLACE="DISCOURSE_DEVELOPER_EMAILS: '$MY_EMAIL'" FILEPATH="containers/app.yml" sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
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" FILEPATH="containers/app.yml" sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
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" MY_EMAIL="email@example.com" FILEPATH="containers/app.yml" SEARCH='DISCOURSE_SMTP_ADDRESS: smtp.example.com' REPLACE='DISCOURSE_SMTP_ADDRESS: smtp.gmail.com' sed -i "s;$SEARCH;$REPLACE;" $FILEPATH SEARCH='#DISCOURSE_SMTP_USER_NAME: firstname.lastname@example.org # (optional)' REPLACE="DISCOURSE_SMTP_USER_NAME: $MY_EMAIL # (optional)" sed -i "s;$SEARCH;$REPLACE;" $FILEPATH SEARCH='#DISCOURSE_SMTP_PASSWORD: pa$$word # (optional)' REPLACE="DISCOURSE_SMTP_PASSWORD: $PASSWORD # (optional)" sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
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
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/standalonearea on the new server with the files from the original using scp.
./launcher rebuild appto rebuild the app on the new server and wait for the rebuild to finish.
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.