Discourse is an open-source discussion platform. It can be used as a mailing list, a discussion forum, or a long-form chat room. In this tutorial, we’ll install Discourse in an isolated environment using Docker, a containerization application.
Before we get started, there are a few things we need to set up first:
Note: Discourse requires a swap file if you are using 1 GB of RAM. Although swap is generally recommended for systems utilizing traditional spinning hard drives, using swap with SSDs can cause issues with hardware degradation over time. Due to this consideration, we do not recommend enabling swap on DigitalOcean or any other provider that utilizes SSD storage. Doing so can impact the reliability of the underlying hardware for you and your neighbors. Hence, we recommend a minimum of 2 GB of RAM to run Discourse on a DigitalOcean Droplet. Refer to How To Add Swap Space on Ubuntu 16.04 for details on using swap.
With all the prerequisites out of the way, you can go straight to installing Discourse.
You will need to be root through the rest of the setup and bootstrap process, so first, switch to a root shell.
- sudo -s
Next, create the /var/discourse
directory, where all the Discourse-related files will reside.
- mkdir /var/discourse
Finally, clone the official Discourse Docker Image into /var/discourse
.
- git clone https://github.com/discourse/discourse_docker.git /var/discourse
With the files we need in place, we can move on to configuration and bootstrapping.
Move to the /var/discourse
directory, where the Discourse files are.
- cd /var/discourse
From here, you can launch the included setup script.
- ./discourse-setup
You will be asked the following questions:
Hostname for your Discourse?
Enter the hostname you’d like to use for Discourse, e.g. discourse.example.com
, replacing example.com
with your domain name. You do need to use a domain name because an IP address won’t work when sending email.
Email address for admin account?
Choose the email address that you want to use for the Discourse admin account. It can be totally unrelated to your Discourse domain and can be any email address you find convenient.
Note that this email address will be made the Discourse admin by default when the first user registers with that email. You’ll also need this email address later when you set up Discourse from its web control panel.
SMTP server address?
SMTP user name?
SMTP port?
SMTP password?
Enter your SMTP server details for these questions. If you’re using SparkPost, the SMTP server address will be smtp.sparkpostmail.com
, the user name will be SMTP_Injection, the port will be 587
, and the password will be the API key.
Finally, you will be asked to confirm all the settings you just entered. After you confirm your settings, the script will generate a configuration file called app.yml
and then the bootstrap process will start.
Note: If you need to change or fix these settings after bootstrapping, edit your /containers/app.yml
file and run ./launcher rebuild app
. Otherwise, your changes will not take effect.
Bootstrapping takes between 2-8 minutes, after which your instance will be running! Let’s move on to creating an administrator account.
Visit your Discourse domain in your favorite web browser to view the Discourse web page.
If you receive a 502 Bad Gateway error, try waiting a minute or two and then refreshing; Discourse may not have finished starting yet.
When the page loads, click the blue Register button. You’ll see a form entitled Register Admin Account with the following fields:
Then click the blue Register button on the form to submit it. You’ll see a dialog that says Confirm your Email. Check your inbox for the confirmation email. If you didn’t receive it, try clicking the Resend Activation Email button. If you’re still unable to register a new admin account, please see the Discourse email troubleshooting checklist.
After registering your admin account, the setup wizard will launch and guide you through Discourse’s basic configuration. You can walk through it now or click Maybe Later to skip.
After completing or skipping the setup wizard, you’ll see some topics and the Admin Quick Start Guide (labeled READ ME FIRST), which contains tips for further customizing your Discourse installation.
You’re all set! If you need to upgrade Discourse in the future, you can do it from the command line by pulling the latest version of the code from the Git repo and rebuliding the app, like this:
- cd /var/discourse
- git pull
- ./launcher rebuild app
You can also update it in your browser by visiting http://discourse.example.com/admin/upgrade
, clicking Upgrade to the Latest Version, and following the instructions.
You can now start managing your Discourse forum and let users sign up. Learn more about Discourse’s features on the Discourse About page.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
I’m trying to update SMTP setting but
./launcher rebuild app
returnswhat shall I do? my Storage Driver is
devicemapper
(I followed your tutorial throughout and didn’t add or tweak anything on my own)another question, how can I make sure my ssl certs will be updated when the time comes? they were installed automatically.
Thanks!
I tried the same instructions twice and stuck at the admin verification email. Earlier I tried twice with the one-click install as well. In both the cases I am stuck at the admin verification email. Discourse is not able to send the verification email appears to be the issue. There is definitely something missing here which most of the howto install Discourse on DigitalOcean guides are missing. There are 2 possibilities as mentioned below:
Can someone mention precise installation steps.
Installing Discourse on Ubuntu 16.04 involves a series of steps that include setting up prerequisites, installing Docker, and then configuring Discourse. Here’s a step-by-step guide to help you with the installation process:
Prerequisites:
Update Ubuntu:
Log in to your server via SSH and update the package list by running:
sqlCopy code
sudo apt-get update sudo apt-get upgrade
Install Docker:
Discourse runs in a Docker container. Install Docker using the official Docker script:
arduinoCopy code
curl -sSL https://get.docker.com/ | sh
Install Git:
Install Git, which is required to download the Discourse repository:
arduinoCopy code
sudo apt-get install git
Clone Discourse Repository:
Clone the Discourse repository to your server’s
/var/discourse
directory:bashCopy code
sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse
Configure Discourse:
Go to the Discourse directory:
bashCopy code
cd /var/discourse
This comment has been deleted
Installing Discourse on Ubuntu 16.04 requires a few steps. Discourse is a modern forum software, and it’s recommended to install it on a server that meets the system requirements for optimal performance. Here’s a step-by-step guide to installing Discourse on Ubuntu 16.04:
Before you begin, ensure that you have root or sudo privileges on your Ubuntu server.
Step 1: Update System Packages Open a terminal and update your system packages to the latest version:
Thanks a lot for this tutorial. I have a question: if I shut the droplet down, what should I’ll do to start Discourse ? Thanks a lot 🙂
Is it possible to only use the admit email for admin purposes and have access to all the user emails to create a newsletter, send out blog posts? I want my discourse to be on a subdomain and the main page to be the regular domain where a blog and a job board exists.
After the install how does one go about maintaining the app? I gathered that you just use the app itself. However I’m used to checking all my code into Git and maintaining it that way. I’m not sure how I’m supposed to think about this project. Can anyone help me figure that out?
One more note. This tutorial requires access to SparkPost account. For me it took 2 days including hosting mail for my domain on Zoho to receive verification e-mail from SparkPost. And domain is still in manual verification process so I can’t proceed with tutorial.
Just a quick note for somebody who expect to do this in 2 hours as I did :)
It seems like 2Gb droplet is not enough for this tutorial