Deploy Discourse with Dokploy: Docker Compose Setup Guide
Step-by-step guide to deploying Discourse community forum on your VPS using Dokploy and Docker Compose. Includes PostgreSQL, Redis, Sidekiq workers, and SSL configuration.
Deploy Discourse with Dokploy
Dokploy is an open-source server management platform that simplifies deploying Docker Compose applications on your VPS. It handles reverse proxy configuration, SSL certificates, and deployment management — which is useful for running Discourse's multi-service community forum platform.
This guide walks you through deploying Discourse with PostgreSQL, Redis, and Sidekiq workers. Discourse is a modern, open-source discussion platform designed for community engagement.
Prerequisites
- A VPS with at least 2 vCPUs, 4 GB RAM, and 30 GB storage
- Dokploy installed and running on your server (installation docs)
- A domain name (e.g.,
forum.yourdomain.com) with DNS A record pointing to your server's IP - An SMTP email service — Discourse requires working email for account activation and notifications
Docker Compose Configuration
Create a new Compose project in Dokploy and paste the following configuration:
version: "3.8"
services:
discourse:
image: bitnami/discourse:latest
restart: unless-stopped
ports:
- "3000:3000"
environment:
- DISCOURSE_HOST=${DISCOURSE_DOMAIN}
- DISCOURSE_SITE_NAME=${DISCOURSE_SITE_NAME:-My Forum}
- DISCOURSE_DATABASE_HOST=discourse-db
- DISCOURSE_DATABASE_PORT_NUMBER=5432
- DISCOURSE_DATABASE_NAME=discourse
- DISCOURSE_DATABASE_USER=discourse
- DISCOURSE_DATABASE_PASSWORD=${DISCOURSE_DB_PASSWORD}
- DISCOURSE_REDIS_HOST=discourse-redis
- DISCOURSE_REDIS_PORT_NUMBER=6379
- DISCOURSE_USERNAME=${DISCOURSE_ADMIN_USER:-admin}
- DISCOURSE_PASSWORD=${DISCOURSE_ADMIN_PASSWORD}
- DISCOURSE_EMAIL=${DISCOURSE_ADMIN_EMAIL}
- DISCOURSE_SMTP_HOST=${SMTP_SERVER}
- DISCOURSE_SMTP_PORT=${SMTP_PORT:-587}
- DISCOURSE_SMTP_USER=${SMTP_LOGIN}
- DISCOURSE_SMTP_PASSWORD=${SMTP_PASSWORD}
- DISCOURSE_SMTP_PROTOCOL=tls
volumes:
- ../files/discourse-data:/bitnami/discourse
depends_on:
discourse-db:
condition: service_healthy
discourse-redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/srv/status || exit 1"]
interval: 30s
timeout: 10s
retries: 10
discourse-sidekiq:
image: bitnami/discourse:latest
restart: unless-stopped
command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
environment:
- DISCOURSE_HOST=${DISCOURSE_DOMAIN}
- DISCOURSE_DATABASE_HOST=discourse-db
- DISCOURSE_DATABASE_PORT_NUMBER=5432
- DISCOURSE_DATABASE_NAME=discourse
- DISCOURSE_DATABASE_USER=discourse
- DISCOURSE_DATABASE_PASSWORD=${DISCOURSE_DB_PASSWORD}
- DISCOURSE_REDIS_HOST=discourse-redis
- DISCOURSE_REDIS_PORT_NUMBER=6379
- DISCOURSE_SMTP_HOST=${SMTP_SERVER}
- DISCOURSE_SMTP_PORT=${SMTP_PORT:-587}
- DISCOURSE_SMTP_USER=${SMTP_LOGIN}
- DISCOURSE_SMTP_PASSWORD=${SMTP_PASSWORD}
- DISCOURSE_SMTP_PROTOCOL=tls
volumes:
- ../files/discourse-data:/bitnami/discourse
depends_on:
discourse-db:
condition: service_healthy
discourse-redis:
condition: service_healthy
discourse-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_DB=discourse
- POSTGRES_USER=discourse
- POSTGRES_PASSWORD=${DISCOURSE_DB_PASSWORD}
volumes:
- ../files/discourse-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U discourse"]
interval: 10s
timeout: 5s
retries: 5
discourse-redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- ../files/discourse-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
Note: This deployment uses the Bitnami Discourse image which includes the application and Sidekiq workers as separate services. Discourse absolutely requires working SMTP email — account activation, password resets, and notifications all depend on it. The first boot takes 5–10 minutes as Discourse compiles assets and initializes the database.
Environment Variables
Set these in Dokploy's Environment tab for your compose project:
| Variable | Purpose | Example |
|---|---|---|
DISCOURSE_DOMAIN |
Your Discourse forum domain | forum.yourdomain.com |
DISCOURSE_DB_PASSWORD |
PostgreSQL database password | a-strong-random-password |
DISCOURSE_ADMIN_USER |
Initial admin username | admin |
DISCOURSE_ADMIN_PASSWORD |
Initial admin password (min 10 chars) | a-strong-admin-password |
DISCOURSE_ADMIN_EMAIL |
Admin email address | admin@yourdomain.com |
DISCOURSE_SITE_NAME |
Forum site name | My Community Forum |
SMTP_SERVER |
SMTP server hostname | smtp.mailgun.org |
SMTP_PORT |
SMTP server port | 587 |
SMTP_LOGIN |
SMTP username | discourse@yourdomain.com |
SMTP_PASSWORD |
SMTP password | your-smtp-password |
In Dokploy, environment variables are set via the Environment editor in the project settings. Do not create a .env file manually — Dokploy manages this for you. SMTP is mandatory — Discourse will not function properly without email delivery.
Volumes & Data Persistence
This setup uses Dokploy's ../files convention for bind-mounted volumes:
../files/discourse-data— Discourse application data, uploads, backups, and compiled assets../files/discourse-db-data— PostgreSQL database files../files/discourse-redis-data— Redis persistence data for job queues and caching
The ../files path is relative to the compose file inside Dokploy's project directory. This ensures your data persists across redeployments. Avoid using absolute paths because Dokploy may clean them during redeployment.
Domain & SSL Setup
- In your Dokploy project, navigate to the Domains tab
- Click Add Domain and enter your domain (e.g.,
forum.yourdomain.com) - Set the container port to
3000 - Enable HTTPS — Dokploy automatically provisions a Let's Encrypt SSL certificate
- Save and wait for the certificate to be issued (usually under a minute)
Dokploy's built-in Traefik reverse proxy handles TLS termination and routes traffic to the Discourse container.
Verifying the Deployment
- In Dokploy, go to your project's Deployments tab and click Deploy
- Watch the build logs — all four services should start. First boot takes 5–10 minutes for asset compilation
- Check the Logs tab for the
discourseservice. Look for: Puma startup messages andListening on - Open
https://forum.yourdomain.comin your browser — you should see the Discourse homepage - Log in with your admin credentials and run through the setup wizard
- Send a test email from Admin > Settings > Email to verify SMTP is working
Troubleshooting
Discourse shows "502 Bad Gateway" for several minutes after deploy This is normal on first boot. Discourse compiles assets and runs database migrations which takes 5–10 minutes. Monitor the logs and wait for the health check to pass. Subsequent boots are much faster.
Email not sending — users can't activate accounts
Discourse requires working SMTP. Verify all SMTP_* variables are correct. Check the Sidekiq logs for email delivery errors. Test from Discourse Admin > Settings > Email > "Send Test Email". Without working email, Discourse is essentially non-functional.
Sidekiq jobs failing or stuck
Ensure the Sidekiq service has the same database, Redis, and SMTP credentials as the main Discourse service. Check discourse-sidekiq logs for specific error messages. Verify Redis is healthy and accessible.
"Out of memory" errors Discourse with PostgreSQL and Redis needs at least 4 GB RAM. If your VPS has less, consider adding swap space. Check container memory limits in Dokploy and increase if needed.
SSL certificate not issuing Ensure your domain's DNS A record points to your server's IP and has propagated. Dokploy uses Let's Encrypt HTTP-01 challenges, so port 80 must be accessible. Check Traefik logs in Dokploy for certificate-related errors.
Learn more about Discourse in our complete overview.
Need a VPS? Hostinger VPS starts at $4.99/mo — perfect for running Discourse.
For more on Docker Compose deployments in Dokploy, see the Dokploy Docker Compose documentation.
App data sourced from selfh.st open-source directory.
Ready to get started?
Get the best VPS hosting deal today. Hostinger offers 4GB RAM VPS starting at just $4.99/mo.
Get Hostinger VPS — $4.99/mo// up to 75% off + free domain included
// related topics
fordnox
Expert VPS reviews and hosting guides. We test every provider we recommend.
// last updated: February 12, 2026. Disclosure: This article may contain affiliate links.