Discourse is an open source discussion platform with built-in moderation and governance systems that let discussion communities protect themselves from bad actors even without official moderators.
- The main reason here to choose Bitnami image vs the official one that Bitnami image is pre-bootstrapped image which minimize the time required at the solution start up.
- Bitnami closely tracks upstream source changes and promptly publishes new versions so the latest bug fixes and features are available as soon as possible.
check project updates bitnami/containers GitHub repo.
this repo forked from Bitnami image Docker Hub Registry.
docker build -t tf-discourse-aio:latest .
docker run --name tf-discourse -p 80:3000 --env-file flist.env tf-discourse-aio:latestAccess your application at http://localhost/
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
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.confdatabase.ymlsite_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 manual execution add a
--envoption with each variable and value:$ docker run -d --name tf-discourse-aio -p 80:3000 \ --env DISCOURSE_PASSWORD=my_password \ --network discourse-tier \ --volume /path/to/discourse-persistence:/bitnami \ threefolddev/discourse-aio:latest
Available environment variables:
DISCOURSE_ENABLE_HTTPS: Whether to use HTTPS by default. Default: noDISCOURSE_EXTERNAL_HTTP_PORT_NUMBER: Port to used by Discourse 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 Discourse 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: user@example.comDISCOURSE_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.confconfiguration 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.confconfiguration 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
This environment variable changes Passenger Standalone's behavior see here for full Passenger config reference.
PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY: Allow compiling Passenger Native Support if binaries wasn't found. make surelibz-devis installed otherwise compiling may fail. Default: 1PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY: Allow downloading Passenger Native Support if binaries wasn't found. make surewgetorcurlare available. Default: 1PASSENGER_ADDRESS: Instructs Passenger to listen for requests on the given IP address. This means that Passenger will only be able to accept requests that are sent to that IP address. Default: 0.0.0.0PASSENGER_LOG_LEVEL: Allows one to specify how much information Passenger should write to the log file. A higher log level value means that more information will be logged. Possible values are:0to7. Default: 3
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(R). Default: redisDISCOURSE_REDIS_PORT_NUMBER: Port used by Redis(R). Default: 6379DISCOURSE_REDIS_PASSWORD: Password for Redis(R).DISCOURSE_REDIS_USE_SSL: Whether to enable SSL for Redis(R). Default: no
POSTGRESQL_CLIENT_DATABASE_HOST: Hostname for the PostgreSQL server. Default: postgresqlPOSTGRESQL_CLIENT_DATABASE_PORT_NUMBER: Port used by the PostgreSQL server. Default: 5432POSTGRESQL_CLIENT_POSTGRES_USER: Database admin user. Default: rootPOSTGRESQL_CLIENT_POSTGRES_PASSWORD: Database password for the database admin user. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_NAMES: List of new databases to be created by the postgresql-client module. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_USER: New database user to be created by the postgresql-client module. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD: Database password for thePOSTGRESQL_CLIENT_CREATE_DATABASE_USERuser. No defaults.POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS: PostgreSQL extensions to enable in the specified database during the first initialization. No defaults.POSTGRESQL_CLIENT_EXECUTE_SQL: SQL code to execute in the PostgreSQL server. 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 environment variables used for the
discourseandsidekiqcontainers in thedocker-compose.ymlfile present in this repository:discourse: ... environment: ... - DISCOURSE_SMTP_HOST=smtp.gmail.com - DISCOURSE_SMTP_PORT=587 - DISCOURSE_SMTP_USER=your_email@gmail.com - DISCOURSE_SMTP_PASSWORD=your_password - DISCOURSE_SMTP_PROTOCOL=tls ... sidekiq: ... environment: ... - DISCOURSE_SMTP_HOST=smtp.gmail.com - DISCOURSE_SMTP_PORT=587 - DISCOURSE_SMTP_USER=your_email@gmail.com - DISCOURSE_SMTP_PASSWORD=your_password - DISCOURSE_SMTP_PROTOCOL=tls ...
-
For manual execution:
-
First, create the Discourse container:
$ 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 DISCOURSE_SMTP_USER=your_email@gmail.com \ --env DISCOURSE_SMTP_PASSWORD=your_password \ --env DISCOURSE_SMTP_PROTOCOL=tls \ --network discourse-tier \ --volume /path/to/discourse-persistence:/bitnami \ bitnami/discourse:latest
-
Then, create the Sidekiq container:
$ docker run -d --name sidekiq \ --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 DISCOURSE_SMTP_USER=your_email@gmail.com \ --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 your_email@domain.com --from your_email@domain.com --server your.smtp.server.com --auth LOGIN --auth-user your_email@domain.com -tlsSee the documentation on troubleshooting SMTP issues if there are problems.
The Discourse Docker image sends the app logs to stdout. To view the logs:
$ zinit log discourseTo backup your data, make a copy of /bitnami/discourse, /bitnami/redis, /bitnami/postgresql
Passenger supplies several ways to restart an application that is running in Passenger. This guide explains how you can restart applications on Passenger.