Discourse is the next-generation community forum platform. Discourse has a thoroughly modern design and is written in JavaScript. Page loads are very fast and new content is loaded as the user scrolls down the page. Discourse allows you to create categories, tag posts, manage notifications, create user profiles, and includes features to let communities govern themselves by voting out trolls and spammers. Discourse is built for mobile from the ground up and support high-res devices.
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-discourse/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
Warning: This quick setup is only intended for development environments. You are encouraged to change the insecure default credentials and check out the available configuration options in the Environment Variables section for a more secure deployment.
- Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
- With Bitnami images the latest bug fixes and features are available as soon as possible.
- Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
- All our images are based on minideb a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading Linux distribution.
- All Bitnami images available in Docker Hub are signed with Docker Content Trust (DCT). You can use
DOCKER_CONTENT_TRUST=1
to verify the integrity of the images. - Bitnami container images are released daily with the latest distribution packages available.
This CVE scan report contains a security report with all open CVEs. To get the list of actionable security issues, find the "latest" tag, click the vulnerability report link under the corresponding "Security scan" field and then select the "Only show fixable" filter on the next page.
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.
Subscribe to project updates by watching the bitnami/discourse GitHub repo.
The recommended way to get the Bitnami Discourse Docker Image is to pull the prebuilt image from the Docker Hub Registry.
$ docker pull bitnami/discourse:latest
To use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.
$ docker pull bitnami/discourse:[TAG]
If you wish, you can also build the image yourself.
$ docker build -t bitnami/discourse:latest 'https://github.com/bitnami/bitnami-docker-discourse.git#master:2/debian-10'
Discourse requires access to a PostgreSQL database to store information. We'll use the Bitnami Docker Image for PostgreSQL for the database requirements.
The main folder of this repository contains a functional docker-compose.yml
file. Run the application using it as shown below:
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-discourse/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
If you want to run the application manually instead of using docker-compose
, these are the basic steps you need to run:
$ docker network create discourse-network
$ docker volume create --name postgresql_data
$ docker run -d --name postgresql \
--env ALLOW_EMPTY_PASSWORD=yes \
--env POSTGRESQL_USERNAME=bn_discourse \
--env POSTGRESQL_PASSWORD=bitnami123 \
--env POSTGRESQL_DATABASE=bitnami_discourse \
--network discourse-network \
--volume postgresql_data:/bitnami/postgresql \
bitnami/postgresql:latest
$ docker volume create --name redis_data
$ docker run -d --name redis \
--env ALLOW_EMPTY_PASSWORD=yes \
--network discourse-network \
--volume redis_data:/bitnami/redis \
bitnami/redis:latest
$ docker volume create --name discourse_data
$ docker run -d --name discourse \
-p 8080:8080 -p 8443:8443 \
--env ALLOW_EMPTY_PASSWORD=yes \
--env DISCOURSE_DATABASE_USER=bn_discourse \
--env DISCOURSE_DATABASE_PASSWORD=bitnami123 \
--env DISCOURSE_DATABASE_NAME=bitnami_discourse \
--env DISCOURSE_HOST=www.example.com \
--network discourse-network \
--volume discourse_data:/bitnami/discourse \
bitnami/discourse:latest
$ docker run -d --name sidekiq \
--network discourse-network \
--volume discourse_data:/bitnami/discourse \
bitnami/discourse:latest /opt/bitnami/scripts/discourse-sidekiq/run.sh
Access your application at http://your-ip/
If you need to run discourse administrative commands like Create admin account from console, you can do so by executing a shell inside the container and running with the proper environment variables.
cd /opt/bitnami/discourse
RAILS_ENV=production bundle exec rake admin:create
If you remove the container all your data will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence you should mount a directory at the /bitnami/discourse
path. If the mounted directory is empty, it will be initialized on the first run. Additionally you should mount a volume for persistence of the PostgreSQL data.
The above examples define the Docker volumes named postgresql_data
and discourse_data
. The Discourse application state will persist as long as volumes are not removed.
To avoid inadvertent removal of volumes, you can mount host directories as data volumes. Alternatively you can make use of volume plugins to host the volume data.
This requires a minor change to the docker-compose.yml
file present in this repository:
postgresql:
...
volumes:
- - 'postgresql_data:/bitnami/postgresql'
+ - /path/to/postgresql-persistence:/bitnami/postgresql
...
redis:
...
volumes:
- - 'redis_data:/bitnami/redis'
+ - /path/to/redis-persistence:/bitnami/redis
...
discourse:
...
volumes:
- - 'discourse_data:/bitnami/discourse'
+ - /path/to/discourse-persistence:/bitnami/discourse
...
sidekiq:
...
volumes:
- - 'discourse_data:/bitnami/discourse'
+ - /path/to/discourse-persistence:/bitnami/discourse
...
-volumes:
- postgresql_data:
- driver: local
- redis_data:
- driver: local
- discourse_data:
- driver: local
$ docker network create discourse-network
$ docker run -d --name postgresql \
--env ALLOW_EMPTY_PASSWORD=yes \
--env POSTGRESQL_USERNAME=bn_discourse \
--env POSTGRESQL_PASSWORD=bitnami123 \
--env POSTGRESQL_DATABASE=bitnami_discourse \
--network discourse-network \
--volume /path/to/postgresql-persistence:/bitnami/postgresql \
bitnami/postgresql:latest
$ docker run -d --name redis \
--env ALLOW_EMPTY_PASSWORD=yes \
--network discourse-network \
--volume /path/to/redis-persistence:/bitnami/redis \
bitnami/redis:latest
$ docker run -d --name discourse \
-p 8080:8080 -p 8443:8443 \
--env ALLOW_EMPTY_PASSWORD=yes \
--env DISCOURSE_DATABASE_USER=bn_discourse \
--env DISCOURSE_DATABASE_PASSWORD=bitnami123 \
--env DISCOURSE_DATABASE_NAME=bitnami_discourse \
--env DISCOURSE_HOST=www.example.com \
--network discourse-network \
--volume /path/to/discourse-persistence:/bitnami/discourse \
bitnami/discourse:latest
$ docker run -d --name sidekiq \
--network discourse-network \
--volume /path/to/discourse-persistence:/bitnami/discourse \
bitnami/discourse:latest
You can mount your configuration files to the /opt/bitnami/discourse/mounted-conf
directory. Make sure that your configuration files follow the standardized names used by Discourse. Some of the most common files include:
discourse.conf
database.yml
site_settings.yml
The set of default standard configuration files may be found here. You may refer to the the Discourse webpage for further details and specific configuration guides.
When you start the Discourse image, you can adjust the configuration of the instance by passing one or more environment variables either on the docker-compose file or on the docker run
command line. If you want to add a new environment variable:
-
For docker-compose add the variable name and value under the application section in the
docker-compose.yml
file present in this repository:discourse: ... environment: - DISCOURSE_PASSWORD=my_password ...
-
For manual execution add a
--env
option with each variable and value:$ docker run -d --name discourse -p 80:8080 -p 443:8443 \ --env DISCOURSE_PASSWORD=my_password \ --network discourse-tier \ --volume /path/to/discourse-persistence:/bitnami \ bitnami/discourse:latest
Available environment variables:
DISCOURSE_ENABLE_HTTPS
: Whether to use HTTPS by default. Default: noDISCOURSE_EXTERNAL_HTTP_PORT_NUMBER
: Port to used by WordPress to generate URLs and links when accessing using HTTP. Will be ignored if multisite mode is not enabled. Default 80DISCOURSE_EXTERNAL_HTTPS_PORT_NUMBER
: Port to used by WordPress to generate URLs and links when accessing using HTTPS. Will be ignored if multisite mode is not enabled. Default 443DISCOURSE_USERNAME
: Discourse application username. Default: userDISCOURSE_PASSWORD
: Discourse application password. Default: bitnami123DISCOURSE_EMAIL
: Discourse application email. Default: [email protected]DISCOURSE_FIRST_NAME
: Discourse user first name. Default: UserNameDISCOURSE_LAST_NAME
: Discourse user last name. Default: LastNameDISCOURSE_SITE_NAME
: Discourse site name. Default: My site!DISCOURSE_HOST
: Discourse hostname to create application URLs for features such as email notifications and emojis. It can be either an IP or a domain. Default: www.example.comDISCOURSE_PRECOMPILE_ASSETS
: Whether to precompile assets during the initialization. Required when installing plugins. Default: yesDISCOURSE_EXTRA_CONF_CONTENT
: Extra configuration to append to thediscourse.conf
configuration file. No defaults.DISCOURSE_PASSENGER_SPAWN_METHOD
: Passenger method used for spawning application processes. Valid values: direct, smart. Default: directDISCOURSE_PASSENGER_EXTRA_FLAGS
: Extra flags to pass to the Passenger start command. No defaults.DISCOURSE_PORT_NUMBER
: Port number in which Discourse will run. Default: 3000DISCOURSE_ENV
: Discourse environment mode. Allowed values: development, production, test. Default: productionDISCOURSE_ENABLE_CONF_PERSISTENCE
: Whether to enable persistence of the Discoursediscourse.conf
configuration file. Default: noDISCOURSE_SKIP_BOOTSTRAP
: Whether to skip performing the initial bootstrapping for the application. This is necessary in case you use a database that already has Discourse data. Default: no
DISCOURSE_DATABASE_HOST
: Hostname for PostgreSQL server. Default: postgresqlDISCOURSE_DATABASE_PORT_NUMBER
: Port used by the PostgreSQL server. Default: 5432DISCOURSE_DATABASE_NAME
: Database name that Discourse will use to connect with the database. Default: bitnami_discourseDISCOURSE_DATABASE_USER
: Database user that Discourse will use to connect with the database. Default: bn_discourseDISCOURSE_DATABASE_PASSWORD
: Database password that Discourse will use to connect with the database. No defaults.ALLOW_EMPTY_PASSWORD
: It can be used to allow blank passwords. Default: no
DISCOURSE_REDIS_HOST
: Hostname for Redis(TM). Default: redisDISCOURSE_REDIS_PORT_NUMBER
: Port used by Redis(TM). Default: 6379DISCOURSE_REDIS_PASSWORD
: Password for Redis(TM).
POSTGRESQL_CLIENT_DATABASE_HOST
: Hostname for the PostgreSQL server. Default: postgresqlPOSTGRESQL_CLIENT_DATABASE_PORT_NUMBER
: Port used by the PostgreSQL server. Default: 5432POSTGRESQL_CLIENT_DATABASE_POSTGRES_USER
: Database admin user. Default: rootPOSTGRESQL_CLIENT_DATABASE_POSTGRES_PASSWORD
: Database password for the database admin user. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_NAME
: New database to be created by the mysql client module. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_USER
: New database user to be created by the mysql client module. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD
: Database password for thePOSTGRESQL_CLIENT_CREATE_DATABASE_USER
user. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS
: PostgreSQL extensions to enable in the specified database during the first initialization. No defaults.ALLOW_EMPTY_PASSWORD
: It can be used to allow blank passwords. Default: no
To configure Discourse to send email using SMTP you can set the following environment variables:
DISCOURSE_SMTP_HOST
: SMTP host.DISCOURSE_SMTP_PORT
: SMTP port.DISCOURSE_SMTP_USER
: SMTP account user.DISCOURSE_SMTP_PASSWORD
: SMTP account password.DISCOURSE_SMTP_PROTOCOL
: If specified, SMTP protocol to use. Allowed values: tls, ssl. No default.DISCOURSE_SMTP_AUTH
: SMTP authentication method. Allowed values: login, plain, cram_md5. Default: login.
This would be an example of SMTP configuration using a Gmail account:
-
Modify the
docker-compose.yml
file present in this repository:discourse: ... environment: - DISCOURSE_DATABASE_USER=bn_discourse - DISCOURSE_DATABASE_NAME=bitnami_discourse - ALLOW_EMPTY_PASSWORD=yes - DISCOURSE_SMTP_HOST=smtp.gmail.com - DISCOURSE_SMTP_PORT=587 - [email protected] - DISCOURSE_SMTP_PASSWORD=your_password - DISCOURSE_SMTP_PROTOCOL=tls ...
-
For manual execution:
$ docker run -d --name discourse -p 80:8080 -p 443:8443 \ --env DISCOURSE_DATABASE_USER=bn_discourse \ --env DISCOURSE_DATABASE_NAME=bitnami_discourse \ --env DISCOURSE_SMTP_HOST=smtp.gmail.com \ --env DISCOURSE_SMTP_PORT=587 \ --env [email protected] \ --env DISCOURSE_SMTP_PASSWORD=your_password \ --env DISCOURSE_SMTP_PROTOCOL=tls \ --network discourse-tier \ --volume /path/to/discourse-persistence:/bitnami \ bitnami/discourse:latest
In order to verify your configuration works properly, you can test your configuration parameters from the container itself.
$ docker run -u root -it bitnami/discourse:latest bash
$ install_packages swaks
$ swaks --to [email protected] --from [email protected] --server your.smtp.server.com --auth LOGIN --auth-user [email protected] -tls
See the documentation on troubleshooting SMTP issues if there are problems.
The Bitnami Discourse container supports connecting the Discourse application to an external database. This would be an example of using an external database for Discourse.
-
Modify the
docker-compose.yml
file present in this repository:discourse: ... environment: - - DISCOURSE_DATABASE_HOST=mariadb + - DISCOURSE_DATABASE_HOST=mariadb_host - DISCOURSE_DATABASE_PORT_NUMBER=3306 - DISCOURSE_DATABASE_NAME=discourse_db - DISCOURSE_DATABASE_USER=discourse_user - - ALLOW_EMPTY_PASSWORD=yes + - DISCOURSE_DATABASE_PASSWORD=discourse_password ...
-
For manual execution:
$ docker run -d --name discourse\ -p 8080:8080 -p 8443:8443 \ --network discourse-network \ --env DISCOURSE_DATABASE_HOST=mariadb_host \ --env DISCOURSE_DATABASE_PORT_NUMBER=3306 \ --env DISCOURSE_DATABASE_NAME=discourse_db \ --env DISCOURSE_DATABASE_USER=discourse_user \ --env DISCOURSE_DATABASE_PASSWORD=discourse_password \ --volume discourse_data:/bitnami/discourse \ bitnami/discourse:latest
In case the database already contains data from a previous Discourse installation, you need to set the variable DISCOURSE_SKIP_BOOTSTRAP
to yes
. Otherwise, the container would execute the installation wizard and could modify the existing data in the database. Note that, when setting DISCOURSE_SKIP_BOOTSTRAP
to yes
, values for environment variables such as DISCOURSE_USERNAME
, DISCOURSE_PASSWORD
or DISCOURSE_EMAIL
will be ignored.
The Bitnami Discourse Docker image sends the container logs to stdout
. To view the logs:
$ docker logs discourse
Or using Docker Compose:
$ docker-compose logs discourse
You can configure the containers logging driver using the --log-driver
option if you wish to consume the container logs differently. In the default configuration docker uses the json-file
driver.
To backup your data, configuration and logs, follow these simple steps:
$ docker stop discourse
Or using Docker Compose:
$ docker-compose stop discourse
We need to mount two volumes in a container we will use to create the backup: a directory on your host to store the backup in, and the volumes from the container we just stopped so we can access the data.
$ docker run --rm -v /path/to/discourse-backups:/backups --volumes-from discourse busybox \
cp -a /bitnami/discourse /backups/latest
Restoring a backup is as simple as mounting the backup as volumes in the containers.
For the PostgreSQL database container:
$ docker run -d --name postgresql \
...
- --volume /path/to/postgresql-persistence:/bitnami/postgresql \
+ --volume /path/to/postgresql-backups/latest:/bitnami/postgresql \
bitnami/postgresql:latest
For the Discourse container:
$ docker run -d --name discourse \
...
- --volume /path/to/discourse-persistence:/bitnami/discourse \
+ --volume /path/to/discourse-backups/latest:/bitnami/discourse \
bitnami/discourse:latest
Bitnami provides up-to-date versions of PostgreSQL and Discourse, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container. We will cover here the upgrade of the Discourse container. For the PostgreSQL upgrade see: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#upgrade-this-image
The bitnami/discourse:latest
tag always points to the most recent release. To get the most recent release you can simple repull the latest
tag from the Docker Hub with docker pull bitnami/discourse:latest
. However it is recommended to use tagged versions.
$ docker pull bitnami/discourse:latest
Stop the currently running container using the command
$ docker-compose stop discourse
Follow the steps in Backing up your container to take a snapshot of the current application state.
Remove the currently running container by executing the following command:
docker-compose rm -v discourse
Update the image tag in docker-compose.yml
and re-create your container with the new image:
$ docker-compose up -d
- The size of the container image has been decreased.
- The configuration logic is now based on Bash scripts in the rootfs/ folder.
- Discourse and Sidekiq now make use of the same volume to persist data. This solves issues related to being unable to locate some files generated on-demand by the Sidekiq job scheduler. Related issues: #142
- The Discourse container now uses Passenger's 'direct' process spawning method (instead of the default 'smart'), which fixes a bug where settings would randomly revert back to the original values. This setting may cause an increase in memory usage. It is possible to configure the spawning method by setting the
DISCOURSE_PASSENGER_SPAWN_METHOD
environment variable. Related issues: #107, #109.
- It is now possible to import existing Discourse databases from other installations, as requested in this ticket. In order to do this, use the environment variable
DISCOURSE_SKIP_INSTALL
, which forces the container not to run the initial Discourse setup wizard.
We'd love for you to contribute to this container. You can request new features by creating an issue, or submit a pull request with your contribution.
If you encountered a problem running this container, you can file an issue. For us to provide better support, be sure to include the following information in your issue:
- Host OS and version
- Docker version (
docker version
) - Output of
docker info
- Version of this container
- The command you used to run the container, and any relevant output you saw (masking any sensitive information)
Copyright (c) 2021 Bitnami
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.