Discourse is a well-known open-source forum platform written in Ruby, known for being clean and simple.
One forum I love browsing is Koushui Loushi, which is built on Discuz, and its UI is stuck in the Stone Age. Its many user-hostile features also annoyed me. So on a whim, I decided to build my own forum. Starting from scratch, I bought a domain, bought a server, set up the software, and tested it. In about an afternoon, I built a forum about Future Sci-Tech City. Enough talk; here's the result.
https://zjfuture.us. The official website of the Future Sci-Tech City Overseas High-Level Talent Innovation Park is zjfuture.gov.cn. I picked a similar domain, meaning: us, the citizens living in Future Sci-Tech City.

What I Used
- Domain: bought from name.com for $3
- Server: Linode, $10/month. I chose Linode for its stability and reputation, and because it recently upgraded to 2 GB of RAM for its 13th anniversary. For Rails apps, more memory is definitely better
- Email provider: Mailgun, free
- Logo: made in Sketch
Installation
The official installation guide is very detailed and clear: Set up Discourse in the cloud in under 30 minutes. If you follow the steps, it should work. Here's a quick summary
Install Git and Docker
Discourse is easy to install, with no need to wrestle with Ruby or server setup, because it's packaged in Docker. How thoughtful is that? Installing both takes just one command
wget -qO- https://get.docker.com/ | sh
Install Discourse
Create the /var/discourse directory and run these commands in order
|
|
Configure the Mail Server
Go to /var/discourse and run the ./discourse-setup script to configure email. Before doing this, sign up for a Mailgun account, then add the MX, TXT, and other records with your domain's DNS provider. Mailgun's docs are very detailed, so just follow along. After running the script
|
|
Here's what the settings mean
- hostname: the forum's domain
- Admin email address: your own email
- SMTP server address:
smtp.mailgun.com - Username: xxx@hostname
- Port: the default, 587, is fine. For SSL/TLS, use 465
- Password: your password
Mailgun settings are shown below
Don't worry if you make a mistake while running the script. Open /var/discourse/containers/app.yam to edit it again. When you're done, run ./launch rebuild app to initialize the container. Then open the domain or IP to access it.
Configure app.yml
app.yml has several main sections: templates, expose, params, env, hooks, and run.
In templates, add one line to the defaults for better localization support
|
|
Configure ports in expose: 80 for HTTP, 443 for HTTPS. Both are open by default.
Configure the domain and email settings in env
|
|
Create an Admin Account
Most settings are configured by the admin in the dashboard, so set up the admin first. Connect to the server, run cd /var/discourse, then ./launch enter app to enter the Rails app in the Docker container, and runrake admin:create This same command creates a new admin, resets an admin password, or gives admin rights to an existing account.
Note: Create Admin Account from Console
Set Up HTTPS with Let’s Encrypt
I've never seen an app where HTTPS was this easy to set up. See this tutorial: Let’s Encrypt. When you're done, go to Settings > Security > use https to force HTTPS.
At this point, you have a clean, simple forum. What's left is configuration, customization, and community management.
