Discourse is an open-source discussion platform. You can use Discourse as a mailing list, a discussion forum, or a long-form chat room. In this tutorial, you will install Discourse in an isolated environment using Docker, a containerization application.
Before you get started, there are a few things you will need:
sudonon-root user, and a firewall. For guidance, you can reference our initial server setup tutorial for Ubuntu 18.04.
Before downloading and installing Discourse, create the
/var/discourse directory. This is where all your Discourse-related files will reside:
- sudo mkdir /var/discourse
Finally, clone the official Discourse Docker Image into
- sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse
With the Discourse Docker image in place, you can now install and configure your platform.
Move to the
- cd /var/discourse
Now launch the included setup script:
- sudo ./discourse-setup
The Discourse installation script will ask the following questions:
OutputHostname for your Discourse?
discourse.your_domain, or whatever hostname you’ve chosen for your platform.
OutputEmail address for admin account?
Choose the email address that you want to use for the Discourse admin account. It can be unrelated to your Discourse domain and can be any email address you find convenient.
Note that this email address will become the Discourse administrator default. Later, you will need to reuse this email address when you set up Discourse from its control panel.
OutputSMTP server address?
OutputSMTP user name?
Enter your SMTP server details for these questions. If you’re using Mailgun, the SMTP server address will be
smtp.mailgun.org, and the username and password are the SMTP credentials for your domain under Mailgun’s domains tab.
Finally, the Discourse installation script will ask you to confirm all these settings. Confirm your settings, and the script will generate a configuration file called
app.yml. The installation process will begin automatically.
Note: If you need to change or fix these settings after installation, edit your
/containers/app.yml file and run
./launcher rebuild app. Otherwise, your changes will not take effect.
The Discourse installation will take approximately 2-8 minutes, after which your instance will be running. Now you can open a web browser and create an administrator account.
discourse.your_domain in your favorite web browser, and you will see the Discourse ‘Congrats’ splash screen.
If you receive a 502 Bad Gateway error, try waiting a minute or two and then refreshing your browser; your Discourse installation might not have completed.
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 Discourse’s Admin Quick Start Guide. The quick start guide is labeled READ ME FIRST, and contains tips for further customizing your Discourse installation.
Your Discourse platform is now ready for use. If you need to upgrade Discourse in the future, you can do so from the command line by pulling the latest version of the code from the Git repo and rebuilding the app:
- cd /var/discourse
- sudo git pull
- sudo ./launcher rebuild app
You can also update Discourse in your browser. Visit
http://discourse.your_domain/admin/upgrade, click Upgrade to the Latest Version, and following the instructions.
You can now start managing your Discourse forum and let users sign up. You can learn more about Discourse’s features on the official Discourse About page.
If you’ve enjoyed this tutorial and our broader community, consider checking out our DigitalOcean products which can also help you achieve your development goals.