Dockerfile to build a Discourse container image.
- This Container uses Debian as a base which includes s6 overlay enabled for PID 1 Init capabilities, zabbix-agent based on TRUNK compiled for individual container monitoring, Cron also installed along with other tools (bash,curl, less, logrotate, nano, updated postgres-client, vim) for easier management.
- Unlike the official Discourse image, this is meant to be self contained without requiring a base image or use the
launcher
- Nginx performance report removed, SQL Query, Voting and Solved Plugins installed.
- Introduction
- Authors
- Table of Contents
- Prerequisites
- Installation
- Configuration
- Maintenance
- References
This image assumes that you are using a reverse proxy such as jwilder/nginx-proxy and optionally the Let's Encrypt Proxy Companion @ https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion in order to serve your pages. However, it will run just fine on it's own if you map appropriate ports.
You will also require an external Redis container, along with an external Postgres DB container, as well an an external SMTP server.
Automated builds of the image are available on Docker Hub and is the recommended method of installation.
docker pull tiredofit/discourse:(imagetag)
The following image tags are available:
latest
- Most recent stable release of PHP w/Debian Jessie
-
The quickest way to get started is using docker-compose. See the examples folder for a working docker-compose.yml that can be modified for development or production use.
-
Set various environment variables to understand the capabilities of this image.
-
Map persistent storage for access to configuration and data files for backup.
To get started:
- cd to the examples directory
- update the
DISCOURSE_HOSTNAME
,DISCOURSE_DEVELOPER_EMAILS
- optionally expose map port 3000 of the discourse-app service to port 80, so it reachable without
- run
$ docker-compose up
# …
networks:
- proxy
- services
ports:
- 80:3000
If JS files have are not loading try regenerate them
$ docker exec -it discourse-app bash
$ rails assets:precompile
The container operates heavily from the /app
folder, however there are a few folders that should be persistently mapped to ensure data persistence. The following directories are used for configuration and can be mapped for persistent storage.
Directory | Description |
---|---|
/app/log |
Logfiles |
/app/public/uploads |
Uploads Directory |
/app/public/backups |
Backups Directory |
Edit the environment variables to point to a working Postgres Server with the appropriate credentials, and create a database with the name discourse
and assign appropriate permissions. The database will automatically populate and also upgrade upon startup if the discourse version changes with new releases of this image.
Along with the Environment Variables from the Base image, below is the complete list of available options that can be used to customize your installation.
Parameter | Description |
---|---|
DISCOURSE_DB_HOST |
Your Postgres DB Host e.g. DISCOURSE-db |
DISCOURSE_DB_PASSWORD |
The password for the discourse db e.g. password |
DISCOURSE_REDIS_HOST |
External Redis Host e.g. DISCOURSE-redis |
DISCOURSE_HOSTNAME |
The URL of your Public Discourse Installation e.g. discourse.example.org |
DISCOURSE_SMTP_ADDRESS |
The hostname of your external SMTP server e.g. postfix-relay |
DISCOURSE_SMTP_PORT |
The port that SMTP listens on e.g. 25 |
DISCOURSE_SMTP_USER_NAME |
Optional - Username for SMTP Authentication e.g. smtpuser |
DISCOURSE_SMTP_PASSWORD |
Optional - Password for SMTP Authentication e.g. password |
DISCOURSE_DEVELOPER_EMAILS |
The administrative email which the first account will be created with e.g. [email protected] |
The following ports are exposed.
Port | Description |
---|---|
3000 |
Rails |
For debugging and maintenance purposes you may want access the containers shell.
docker exec -it (whatever your container name is e.g. discourse) bash
Enter inside the container and type rails admin:create and follow the instructions. Then visit your Discourse forum by appending /admin
to the suffix of the URL to be able to start configuring the system.