Running Discourse on Coolify
Discourse does not officially provide a Docker image to run their forum software, which makes it harder to install on Coolify.
Solution:
Use the Bitnami Discourse Docker Image with a custom docker-compose file.
Discourse docker-compose.yml for Coolify:
services:
postgresql:
image: 'docker.io/bitnami/postgresql:16'
volumes:
- 'postgresql_data:/bitnami/postgresql'
environment:
- POSTGRESQL_DATABASE=discourse_db
- POSTGRESQL_PASSWORD=PASSWORD_YOUR_PG_PASS
redis:
image: 'docker.io/bitnami/redis:7.4'
environment:
- REDIS_PASSWORD=PASSWORD_YOUR_DISCOURSE_PASS
volumes:
- 'redis_data:/bitnami/redis'
discourse:
image: 'docker.io/bitnami/discourse:3.3.2'
ports:
- '3145:3000'
volumes:
- 'discourse_data:/bitnami/discourse'
depends_on:
- postgresql
- redis
environment:
- DISCOURSE_HOST=yourdomain.com
- DISCOURSE_DATABASE_HOST=postgresql
- DISCOURSE_USERNAME=admin
- DISCOURSE_PASSWORD=PASSWORD_YOUR_DISCOURSE_PASS
- [email protected]
- DISCOURSE_SITENAME=Forum
- DISCOURSE_POSTGRESQL_NAME=discourse_db
- DISCOURSE_POSTGRESQL_USERNAME=postgres
- DISCOURSE_POSTGRESQL_PASSWORD=PASSWORD_YOUR_PG_PASS
- DISCOURSE_SMTP_HOST=in-v3.mailjet.com
- DISCOURSE_SMTP_PORT=587
- DISCOURSE_SMTP_USER=YOUR_MAILJET_USER
- DISCOURSE_SMTP_PASSWORD=YOUR_MAILJET_PASSWORD
- DISCOURSE_REDIS_HOST=redis
- DISCOURSE_REDIS_PORT_NUMBER=6379
- DISCOURSE_REDIS_PASSWORD=PASSWORD_YOUR_DISCOURSE_PASS
- POSTGRESQL_CLIENT_POSTGRES_USER=postgres
- POSTGRESQL_CLIENT_POSTGRES_PASSWORD=PASSWORD_YOUR_PG_PASS
- POSTGRESQL_CLIENT_CREATE_DATABASE_NAME=discourse_db
- 'POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS=hstore,pg_trgm'
- BITNAMI_DEBUG=true
sidekiq:
image: 'docker.io/bitnami/discourse:3.3.2'
depends_on:
- discourse
volumes:
- 'sidekiq_data:/bitnami/discourse'
command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
environment:
- DISCOURSE_HOST=yourdomain.com
- DISCOURSE_DATABASE_HOST=postgresql
- DISCOURSE_DATABASE_PORT_NUMBER=5432
- DISCOURSE_DATABASE_USER=postgres
- DISCOURSE_DATABASE_NAME=discourse_db
- DISCOURSE_DATABASE_PASSWORD=PASSWORD_YOUR_PG_PASS
- DISCOURSE_REDIS_HOST=redis
- DISCOURSE_REDIS_PASSWORD=PASSWORD_YOUR_DISCOURSE_PASS
- DISCOURSE_REDIS_PORT_NUMBER=6379
- DISCOURSE_SMTP_HOST=in-v3.mailjet.com
- DISCOURSE_SMTP_PORT=587
- DISCOURSE_SMTP_USER=YOUR_MAILJET_USER
- DISCOURSE_SMTP_PASSWORD=YOUR_MAILJET_PASSWORD
Use this in Coolify → New Resource → Docker Compose Empty