---
title: "Deploy Discourse — Open Source Community Forum"
description: "Self-hosted Discourse with Postgres, Redis, and Sidekiq worker"
category: "Other"
url: https://railway.com/deploy/discourse-forum-postgres-redis
---

# Deploy Discourse — Open Source Community Forum

Self-hosted Discourse with Postgres, Redis, and Sidekiq worker

**[Deploy Discourse — Open Source Community Forum on Railway](https://railway.com/template/discourse-forum-postgres-redis)**

- **Creator:** SilverBanana
- **Category:** Other
- **Total deploys:** 1

## Template content

### Discourse https://discourse.org/favicon.ico

- **Image:** bitnamilegacy/discourse:3.5.0-debian-12-r0

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Sidekiq https://github.com/sidekiq.png

- **Image:** bitnamilegacy/discourse:3.5.0-debian-12-r0

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

# Deploy and Host Discourse on Railway

Discourse is the leading open-source community forum platform — threaded discussions, trust levels, moderation tooling, and full-text search, powering communities for Rust, Netlify, and thousands of others. Unlike Discord, where conversations vanish into an endless scroll, Discourse produces organised, searchable, permanent threads. Unlike Reddit, you own the data and set the rules.

This template deploys the full four-service stack: Discourse, a Sidekiq background worker, PostgreSQL, and Redis.

---

## What This Template Deploys

| Service | Purpose |
| --- | --- |
| **Discourse** | The Rails web application, forum UI, and admin panel |
| **Sidekiq** | Background job worker — emails, notifications, image processing, scheduled tasks |
| **PostgreSQL** | Posts, users, categories, and all forum data |
| **Redis** | Job queue backing Sidekiq, plus caching |

All four run on Railway's private network. Only Discourse is exposed publicly, and a persistent volume holds uploads and generated assets.

---

## About Hosting Discourse

Discourse is a Ruby on Rails application, and hosting Rails properly means running more than one process. The web app serves requests; a separate Sidekiq worker handles everything asynchronous — sending registration emails, delivering notifications, optimising uploaded images, and running scheduled maintenance jobs.

**That worker is not optional.** Deploy Discourse without Sidekiq and the forum appears to work while silently doing nothing in the background: nobody receives a registration email, notifications never arrive, and uploaded images never finish processing. This template runs Sidekiq as its own service, connected to the same database and Redis instance, so background work actually happens.

The second non-negotiable is SMTP. Discourse requires a working mail provider before anyone — including you — can complete registration, because account activation runs by email. Configure Mailgun, SendGrid, Postmark, or similar before your first deploy.

Discourse is also genuinely resource-hungry. Rails plus Sidekiq plus Postgres idles around 1.4–1.8 GB of RAM and climbs during image processing and database migrations. Budget 2 GB minimum and 4 GB for a comfortable production forum.

Typical cost: **~$25–45/month** on Railway across all four services, depending on RAM and storage. Discourse's own hosted plans start considerably higher, so self-hosting pays off quickly — and your community's data stays yours.

---

## How It Compares

| | Discourse (self-hosted) | Discourse Cloud | Discord | Circle |
| --- | --- | --- | --- | --- |
| Cost model | Flat ~$25–45/mo infra | Per-plan monthly | Free / Nitro | Per member tier |
| Data ownership | Full | Vendor-hosted | Vendor | Vendor |
| Searchable archive | Yes, indexed | Yes | Poor | Partial |
| SEO / public indexing | Yes | Yes | No | Limited |
| Threaded discussion | Yes | Yes | Channels only | Yes |
| Plugins & theming | Full control | Plan-dependent | Bots only | Limited |

Discord wins on real-time chat and zero setup. Discourse wins when you want discussions that persist, rank in search, and belong to you — the difference between a conversation and a knowledge base.

---

## Deploy in Under 5 Minutes

1. Click **Deploy on Railway** — all four services build automatically (~5 minutes)
2. Set `DISCOURSE_HOST` to your Railway public domain
3. Configure the `DISCOURSE_SMTP_*` variables with your mail provider's credentials
4. Set `DISCOURSE_USERNAME`, `DISCOURSE_PASSWORD`, and `DISCOURSE_EMAIL` for the admin account
5. Open your domain, sign in as admin, and run the setup wizard to name your community

Confirm Sidekiq is running before inviting users — check **Admin → Dashboard** for background job health.

---

## Common Use Cases

- **Product or open-source community** — a searchable support forum where answers stay findable instead of scrolling away
- **Discord replacement for lasting discussion** — keep real-time chat elsewhere and give long-form conversation a permanent home
- **Customer support knowledge base** — user questions become indexed content that answers the next person automatically
- **Paid or private community** — invite-only forums with trust levels and granular moderation controls
- **Internal team discussion** — asynchronous, threaded conversation for distributed teams that outgrew a chat channel
- **SEO-driven community content** — public threads are crawlable and rank, unlike closed platforms

---

## Configuration

| Variable | Required | Description |
| --- | --- | --- |
| `DISCOURSE_HOST` | Required | Your Railway public domain — links and emails are built from it |
| `DISCOURSE_DATABASE_HOST` | Auto-injected | PostgreSQL host via Railway reference variable |
| `DISCOURSE_DATABASE_NAME` | Auto-injected | Database name |
| `DISCOURSE_DATABASE_USER` | Auto-injected | Database user |
| `DISCOURSE_DATABASE_PASSWORD` | Auto-injected | Database password |
| `DISCOURSE_REDIS_HOST` | Auto-injected | Redis host via Railway reference variable |
| `DISCOURSE_SMTP_ADDRESS` | Required | SMTP hostname — registration fails without working mail |
| `DISCOURSE_SMTP_PORT` | Required | `587` for STARTTLS |
| `DISCOURSE_SMTP_USER_NAME` | Required | SMTP username |
| `DISCOURSE_SMTP_PASSWORD` | Required | SMTP password |
| `DISCOURSE_USERNAME` | Required | Admin account username |
| `DISCOURSE_PASSWORD` | Required | Admin account password — use a strong value |
| `DISCOURSE_EMAIL` | Required | Admin email address |

> **SMTP is mandatory, not optional.** Discourse activates accounts by email. Without working SMTP, no one can register — including your own admin account.

> **Sidekiq must stay running.** If the worker service stops, the forum keeps serving pages while every background job silently queues forever. Check Admin → Dashboard for job health.

---

## Dependencies for Discourse Hosting

- Railway account — expect ~$25–45/month across all four services
- An SMTP provider (Mailgun, SendGrid, Postmark, or similar) — strictly required
- A persistent Railway volume for uploads and assets (included)
- Optional: S3-compatible object storage for uploads on larger communities

### Deployment Dependencies

- [Discourse GitHub Repository](https://github.com/discourse/discourse)
- [Discourse Meta (Community Support)](https://meta.discourse.org/)
- [Discourse Install Documentation](https://github.com/discourse/discourse/blob/main/docs/INSTALL.md)
- [Railway Volumes Documentation](https://docs.railway.com/volumes)

### Implementation Details

Discourse's official installation uses the `discourse_docker` launcher, which builds a bespoke image per site — a pattern designed for a dedicated VPS rather than a container platform. This template instead uses a runnable Discourse image that supports external PostgreSQL and Redis through `DISCOURSE_DATABASE_HOST` and `DISCOURSE_REDIS_HOST`, which is what makes a managed-service deployment on Railway possible.

The web application and the Sidekiq worker run as two services from the same image with the same environment, differing only in start command — the worker launches Sidekiq directly. Both connect to the shared PostgreSQL and Redis services over Railway's private network, and both mount the shared data volume so uploads written by one are visible to the other.

Redis serves double duty as Sidekiq's job queue and as Discourse's cache, which is why it is a hard dependency rather than an optimisation. PostgreSQL holds all forum content; that database is your community, so schedule `pg_dump` backups accordingly.

---

## Frequently Asked Questions

**Why is there a separate Sidekiq service?** Discourse offloads email, notifications, image processing, and scheduled jobs to a background worker. Without it the forum renders pages normally but performs no background work at all — the most common broken self-hosted Discourse setup.

**Do I really need SMTP?** Yes. Account activation runs by email, so without a working mail provider nobody can complete registration, including the admin account. Configure it before your first deploy.

**How much RAM does it need?** 2 GB is the practical minimum and 4 GB is comfortable for production. Rails and Sidekiq together idle around 1.4–1.8 GB and spike during image processing and migrations.

**Why not use the official Discourse installer?** The official `./launcher bootstrap` flow builds a custom image on a dedicated host — it assumes a VPS you SSH into, not a managed container platform. This template uses a runnable image with external database support instead.

**Do uploads survive a redeploy?** Yes, on the mounted volume. For larger communities, configure S3-compatible object storage so uploads don't grow the volume indefinitely.

**Is this cheaper than Discourse's hosted plans?** Usually, yes — flat Railway infrastructure versus per-plan hosted pricing. You trade that saving for running upgrades, backups, and SMTP yourself.

**Can I install plugins and themes?** Themes and components install from the admin panel normally. Plugins requiring a rebuild are more involved on a container platform than with the official launcher, since they're compiled into the image.

---

## Why Deploy Discourse on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Discourse on Railway you get a complete community forum with the pieces that usually get forgotten — a real Sidekiq worker, PostgreSQL, Redis, private networking, automatic HTTPS, and a persistent volume for uploads. Own your community's archive, rank in search, and keep every discussion on infrastructure you control.

## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/discourse-forum-postgres-redis
