Self-Hosting Discourse: Build a Modern Community Forum
Forums aren't dead -- they've just been overshadowed by Discord servers and Reddit communities that control your content and lock it behind walled gardens. Discourse is the most capable open source forum platform available today. It powers communities for projects like Rust, Netlify, Graylog, and thousands of others.
Unlike a Discord server where conversations vanish into an endless scroll, Discourse creates organized, searchable, permanent discussion threads. Unlike Reddit, you own the data and set the rules. If you need a community platform for an open source project, a business, a hobby group, or any community, self-hosted Discourse gives you full control.
What Discourse Offers
Discourse was built from the ground up as a modern reimagining of forum software. Here's what sets it apart from legacy platforms like phpBB or vBulletin:
- Real-time updates -- New posts appear without page refreshes
- Trust levels -- Users automatically earn privileges based on participation, reducing moderation burden
- Threaded and flat discussion -- Topics flow naturally with quoting, replies, and suggested topics
- Rich editor -- Markdown support, drag-and-drop images, oneboxes (URL previews), and code syntax highlighting
- Full-text search -- Fast, accurate search across all content
- Email integration -- Users can reply to topics via email, and new topics can be created by emailing the forum
- Single Sign-On (SSO) -- Integrate with GitHub, Google, SAML, OIDC, or a custom identity provider
- Plugin ecosystem -- Voting, solved topics, chat, calendar, custom layouts, and more
- Moderation tools -- Flagging, post approvals, user suspensions, word filters, and spam prevention
- API -- Full REST API for automation and integration
Installation: The Official Docker Method
Discourse has a strong opinion about installation: use their official Docker-based setup. This isn't a typical Docker Compose workflow -- Discourse uses its own discourse_docker launcher that manages the container lifecycle. While unconventional, this approach is battle-tested and recommended by the Discourse team.
Server Requirements
Discourse is resource-hungry compared to most self-hosted software:
- CPU: 2 cores minimum (4 recommended for active communities)
- RAM: 2 GB minimum (4 GB recommended; 1 GB can work with swap)
- Storage: 20 GB minimum (grows with uploads and posts)
- Email: Working SMTP is required -- Discourse cannot function without it
A $12-24/month VPS (Hetzner, DigitalOcean, Vultr) handles most small-to-medium communities well.
Step-by-Step Setup
# Clone the official Discourse Docker manager
sudo -s
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
Run the setup script:
./discourse-setup
The script will ask for:
- Hostname:
forum.yourdomain.com - Admin email: Your email address (you'll get an activation link)
- SMTP settings: Server, port, username, password
SMTP is not optional. Discourse uses email for account activation, password resets, notifications, and the mailing list feature. If email doesn't work, your forum is effectively broken.
SMTP Options
You need a transactional email service. Options ranked by ease of setup:
| Service | Free Tier | Notes |
|---|---|---|
| Mailgun | 1,000 emails/month | Most recommended for Discourse |
| Brevo (Sendinblue) | 300 emails/day | Generous free tier |
| Amazon SES | 3,000/month (with EC2) | Cheapest at scale |
| Postmark | 100 emails/month | Excellent deliverability |
| Self-hosted (Postfix) | Unlimited | Hard to maintain deliverability |
Example SMTP configuration for Mailgun:
SMTP server: smtp.mailgun.org
SMTP port: 587
SMTP username: [email protected]
SMTP password: your_mailgun_password
Starting Discourse
After the setup script completes:
./launcher rebuild app
This builds the Docker image, runs database migrations, and starts the application. The first build takes 5-10 minutes. Visit https://forum.yourdomain.com and follow the setup wizard using the admin email you provided.
Docker Compose Alternative
If you prefer a standard Docker Compose setup (for integrating with other containers), it's possible but unsupported by the Discourse team. The official discourse_docker launcher is strongly recommended for production use because it handles Discourse's complex build process and migrations.
For development or testing, the Discourse team provides:
# For testing only -- not recommended for production
services:
discourse:
image: discourse/discourse:latest
ports:
- "80:80"
volumes:
- discourse_data:/shared
- discourse_log:/var/log
environment:
- DISCOURSE_HOSTNAME=forum.yourdomain.com
- DISCOURSE_SMTP_ADDRESS=smtp.mailgun.org
- DISCOURSE_SMTP_PORT=587
- [email protected]
- DISCOURSE_SMTP_PASSWORD=your_password
- [email protected]
restart: unless-stopped
discourse-db:
image: postgres:15
volumes:
- discourse_pg:/var/lib/postgresql/data
restart: unless-stopped
discourse-redis:
image: redis:7
restart: unless-stopped
volumes:
discourse_data:
discourse_log:
discourse_pg:
Essential Configuration
After the initial setup wizard, here are the settings to configure first (Admin > Settings):
Security
- Force HTTPS: Enable (should be default)
- Minimum password length: Set to 12+
- Enable two-factor authentication: Strongly recommended for admins
User Registration
- Login required: Whether visitors must log in to read content
- Must approve users: Manual approval for new registrations (useful for private communities)
- Invite only: Disable open registration, only allow invited users
- Reply by email: Allow users to reply to notification emails to post (great for increasing engagement)
- Mailing list mode: Users can opt-in to receive every post as an email
Trust Levels
One of Discourse's best features is its automated trust system. New users start at Trust Level 0 and earn higher levels through participation:
| Level | Name | Abilities Gained |
|---|---|---|
| TL0 | New User | Basic posting, limited links/images |
| TL1 | Basic User | Send PMs, flag posts, upload images |
| TL2 | Member | Invite users, create wiki posts, daily like limit increased |
| TL3 | Regular | Recategorize topics, rename topics, access private lounge |
| TL4 | Leader | Edit others' posts, pin topics, close topics (mini-moderator) |
This system means your most active, trusted members gradually get moderation powers without you manually promoting them. It significantly reduces the moderation workload for community managers.
Useful Plugins
Discourse has a healthy plugin ecosystem. Some essentials:
- discourse-solved -- Mark topics as solved (great for support forums)
- discourse-voting -- Feature voting for product feedback forums
- discourse-calendar -- Event calendar and scheduling
- discourse-chat -- Built-in real-time chat (Discord-like)
- discourse-reactions -- Emoji reactions on posts beyond the basic "like"
- discourse-data-explorer -- Run SQL queries against your forum data
Install plugins by adding them to your app.yml configuration:
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/discourse-solved.git
- git clone https://github.com/discourse/discourse-voting.git
Then rebuild:
cd /var/discourse
./launcher rebuild app
SSO Integration
Discourse supports several authentication methods:
- Social logins: GitHub, Google, Twitter, Facebook (built-in)
- OIDC/OAuth2: Connect to Keycloak, Authentik, Authelia, or any OIDC provider
- SAML: Enterprise SSO integration
- DiscourseConnect: Discourse's own SSO protocol for making your app the identity provider
For self-hosters running Authentik or Authelia, the OIDC integration is the cleanest path. In Admin > Settings > Login, configure the OIDC provider URL, client ID, and client secret.
Discourse vs Flarum
Flarum is the other major open source forum platform. Here's how they compare:
| Feature | Discourse | Flarum |
|---|---|---|
| Maturity | 10+ years, very stable | Younger, still maturing |
| Resource usage | Heavy (2 GB+ RAM) | Light (512 MB RAM) |
| Email integration | Excellent (reply by email) | Basic notifications only |
| Plugin ecosystem | Large, many official plugins | Growing, community-driven |
| Trust system | Built-in, automated | Via extensions |
| Real-time chat | Built-in plugin | Via extensions |
| Search | Powerful full-text | Good, improving |
| Mobile experience | Excellent responsive design | Good responsive design |
| Language | Ruby on Rails + Ember.js | PHP + Laravel + Mithril.js |
| Installation | Docker-based (opinionated) | Traditional PHP (flexible) |
| Community size | Very large | Moderate |
Choose Discourse if:
- You need a battle-tested platform for a large or growing community
- Email integration is important (mailing list mode, reply by email)
- You want automated moderation through trust levels
- You need rich plugin support
- You have the server resources (2+ GB RAM)
Choose Flarum if:
- You need a lightweight forum on limited hardware
- You prefer PHP hosting (shared hosting works)
- You want a simpler, faster setup process
- Your community is smaller and doesn't need heavy moderation tools
- You prefer a more minimalist aesthetic
Maintenance and Backups
Updating Discourse
cd /var/discourse
git pull
./launcher rebuild app
Updates typically take 5-10 minutes. Discourse has a built-in update notification in the admin dashboard.
Backups
Discourse has built-in backup functionality (Admin > Backups):
- Schedule automatic backups (daily recommended)
- Backups include the database, uploads, and configuration
- Download backups to off-site storage
For belt-and-suspenders protection, also back up the underlying Docker volumes:
cd /var/discourse
./launcher stop app
tar czf discourse_backup_$(date +%Y%m%d).tar.gz shared/
./launcher start app
Verdict
Discourse is the gold standard for self-hosted community forums. It's opinionated in its installation process and hungry for resources, but what you get in return is a mature, feature-rich platform that can scale from a small hobby community to a major open source project forum. The trust level system alone is worth the setup effort -- it turns your most engaged members into volunteer moderators organically. If you need a serious community platform and have a VPS with 2+ GB of RAM, Discourse is the clear first choice. If you're resource-constrained or want something lighter, look at Flarum.