{# nocheck: comments-valid - vendored upstream Discourse app.yml; all inline docs intentional #} templates: {% if lookup('database', application_id, 'local') %} - "templates/postgres.template.yml" {% endif %} #- "templates/redis.template.yml" - "templates/web.template.yml" ## Uncomment the next line to enable the IPv6 listener #- "templates/web.ipv6.template.yml" - "templates/web.ratelimited.template.yml" ## Uncomment these two lines if you wish to add Lets Encrypt (https) #- "templates/web.ssl.template.yml" #- "templates/web.letsencrypt.ssl.template.yml" ## which TCP/IP ports should this container expose? ## If you want Discourse to share a port with another webserver like Apache or nginx, ## see https://meta.discourse.org/t/17247 for details {{ lookup('container_ports', ['discourse', 'http', DOCKER_BIND_HOST], key='expose') }} params: db_default_text_search_config: "pg_catalog.english" ## Set db_shared_buffers to a max of 25% of the total memory. ## will be set automatically by bootstrap based on detected RAM, or you can override db_shared_buffers: "{{ lookup('service_memory_mb', application_id, 'discourse', 0.25) }}MB" ## can improve sorting performance, but adds memory usage per-connection #db_work_mem: "40MB" ## Which Git revision should this container use? (default: tests-passed) version: {{ DISCOURSE_VERSION }} env: LC_ALL: "{{ DISCOURSE_LOCAL }}" LANG: "{{ DISCOURSE_LOCAL }}" LANGUAGE: "{{ DISCOURSE_LOCAL }}" #DISCOURSE_DEFAULT_LOCALE: {{ HOST_LL }} # Deactivated because not right format was selected @todo find right format DB_POOL: "{{ POSTGRES_ALLOWED_AVG_CONNECTIONS }}" RAILS_MAX_THREADS: "{{ [ (POSTGRES_ALLOWED_AVG_CONNECTIONS | int), 5 ] | min }}" UNICORN_WORKERS: "{{ [ (POSTGRES_ALLOWED_AVG_CONNECTIONS | int) // 2, 1 ] | max }}" ## How many concurrent web requests are supported? Depends on memory and CPU cores. ## will be set automatically by bootstrap based on detected CPUs, or you can override UNICORN_WORKERS: 8 ## Required. Discourse will not work with a bare IP number. DISCOURSE_HOSTNAME: {{ lookup('domain',application_id) }} ## Force HTTPS at boot time so asset precompilation bakes https:// URLs ## into stylesheets/@font-face. Without this the rails-runner SiteSetting ## update in `run:` lands AFTER assets are compiled, leaving http:// font ## URLs that violate the CSP (font-src https://...). DISCOURSE_FORCE_HTTPS: "{{ DISCOURSE_TLS_ENABLED | bool | string | lower }}" ## Uncomment if you want the container to be started with the same ## hostname (-h option) as specified above (default "$hostname-$config") #DOCKER_USE_HOSTNAME: true ## on initial signup example 'user1@example.com,user2@example.com' DISCOURSE_DEVELOPER_EMAILS: {{ lookup('users', 'administrator').email }} # Set Logo {% if service_provider.platform.logo | length > 0 %} DISCOURSE_LOGO_URL: "{{ service_provider.platform.logo }}" DISCOURSE_LOGO_SMALL_URL: "{{ service_provider.platform.logo }}" {% endif %} {% set email = lookup('email', application_id) %} {% if email.enabled | bool %} # SMTP ADDRESS, username, and password are required # WARNING the char '#' in SMTP password can cause problems! DISCOURSE_SMTP_ADDRESS: {{ email.host }} DISCOURSE_SMTP_PORT: {{ email.port }} DISCOURSE_SMTP_USER_NAME: {{ email.username }} DISCOURSE_SMTP_PASSWORD: {{ email.password | to_json }} DISCOURSE_SMTP_ENABLE_START_TLS: {{ email.start_tls }} DISCOURSE_SMTP_FORCE_TLS: {{ email.tls }} DISCOURSE_SMTP_DOMAIN: {{ email.domain }} DISCOURSE_NOTIFICATION_EMAIL: {{ email['from'] }} {% endif %} # Database Configuration DISCOURSE_DB_USERNAME: {{ lookup('database', application_id, 'username') }} DISCOURSE_DB_PASSWORD: {{ lookup('database', application_id, 'password') }} DISCOURSE_DB_HOST: {{ lookup('database', application_id, 'host') }} DISCOURSE_DB_NAME: {{ lookup('database', application_id, 'name') }} # Redis Configuration DISCOURSE_REDIS_HOST: {{ DISCOURSE_REDIS_HOST }} DISCOURSE_REDIS_PORT: {{ DISCOURSE_REDIS_PORT }} {% if DISCOURSE_REDIS_PASSWORD | length > 0 %} DISCOURSE_REDIS_PASSWORD: "{{ DISCOURSE_REDIS_PASSWORD }}" {% endif %} ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate #LETSENCRYPT_ACCOUNT_EMAIL: administrator@veen.world ## The http or https CDN address for this Discourse instance (configured to pull) ## see https://meta.discourse.org/t/14857 for details #DISCOURSE_CDN_URL: https://discourse-cdn.example.com ## The maxmind geolocation IP address key for IP address lookup ## see https://meta.discourse.org/t/-/137387/23 for details #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456 {% if DISCOURSE_TLS_SELFSIGNED_ENABLED | bool %} CA_TRUST_CERT: {{ CA_ROOT.cert_host }} CA_TRUST_NAME: {{ lookup('domain',application_id) }} {% endif %} ## The Docker container is stateless; all data is stored in /shared volumes: - volume: host: {{ DISCOURSE_VOLUME }} guest: /shared - volume: host: /var/discourse/shared/standalone/log/var-log guest: /var/log {% if DISCOURSE_TLS_SELFSIGNED_ENABLED | bool %} - volume: host: {{ CA_ROOT.cert_host }} guest: {{ CA_ROOT.cert_host }} - volume: host: {{ BIN_CA_TRUST }} guest: {{ BIN_CA_TRUST }} {% endif %} ## Plugins go here ## see https://meta.discourse.org/t/19157 for details hooks: after_code: - exec: cd: $home/plugins cmd: {% for plugin_name, plugin_config in DISCOURSE_PLUGINS.items() %} {% if plugin_config.enabled and plugin_config.source != 'bundled' %} - git clone --depth=1 --branch {{ plugin_config.config.ref }} {{ plugin_config.config.repository }} {% endif %} {% endfor %} ## Any custom commands to run after building run: - exec: echo "Beginning of custom commands" {% if DISCOURSE_TLS_SELFSIGNED_ENABLED | bool %} - exec: {{ BIN_CA_TRUST }} {% endif %} - exec: echo "End of custom commands" docker_args: - --network={{ DISCOURSE_NETWORK }} {% if DISCOURSE_REDIS_SHARED | bool %} - --network={{ DISCOURSE_REDIS_NETWORK }} {% endif %} {% if DISCOURSE_DATABASE_IS_SHARED | bool %} - --network={{ DISCOURSE_PG_NETWORK }} {% endif %} {% if DISCOURSE_LITELLM_ENABLED | bool %} - --network={{ DISCOURSE_LITELLM_NETWORK }} {% endif %} {% for extra_host in lookup('container_extra_hosts', entries_only=True, wantlist=True) %} - --add-host={{ extra_host }} {% endfor %} - --name={{ DISCOURSE_CONTAINER }} {{ lookup('container_extra_hosts', docker_flags=true) }}