Skip to content

discourse

Note

we do custom config from beginning so ./discourse-setup will not be used at all

fetch files

Warning

have to be installed as root. change to root with sudo -i

Note

dir is different than default

git clone https://github.com/discourse/discourse_docker.git /srv/discourse
cd /srv/docker/discourse
chmod 700 containers

configuration

Note

we use two templates. one for discourse itself and one for backend

discourse.yml

start with template and change name too

cp /srv/docker/discourse/samples/web_only.yml /srv/docker/discourse/containers/discourse.yml

remove port for caddy so discourse is not doing reverse proxing

expose:
  #- "80:80"   # http
  #- "443:443" # https

change network to caddy

docker_args:
  - '--network caddynet'
  - '--network internal-discoursenet'

networks:
  caddynet:
    external: true
  internal-discoursenet:
    external: true

add smtp

DISCOURSE_DEVELOPER_EMAILS: 'mail@domain.tld'
DISCOURSE_SMTP_ADDRESS: <smtp>
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: <mail@domain.tld>
DISCOURSE_SMTP_PASSWORD: <pw>
DISCOURSE_SMTP_ENABLE_START_TLS: true  
troubleshoot smtp

if app.yml and web_only.yml are renamed, edit lines in `./discourse-doctor to be able to run diagnostic script

+ `if [ -f containers/discourse.yml ]`
+ `    app_name="discourse"`
+ `  elif [ -f containers/discourse-backend.yml ]`
+`log "YML=discourse-backend.yml"`
+`    app_name="discourse-backend"`
+`    web_file=containers/$app_name.yml`
get_yml_file() {
  app_name=""
  if [ -f containers/discourse.yml ]
  then
    app_name="discourse"
    web_file=containers/$app_name.yml
    log "Found $web_file"
  elif [ -f containers/discourse-backend.yml ]
  then
    log "YML=discourse-backend.yml"
    app_name="discourse-backend"
    web_file=containers/$app_name.yml
    log "Found $web_file"
  else
    log "Can't find app.yml or web_only.yml."
    log "Giving up."
    exit
  fi
}
./discourse-doctor

storage

Tip

i like to have things called by their name not only just a generic name

volumes:
  - volume:
      host: /srv/docker/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /srv/dock/discourse/shared/standalone/log/var-log
      guest: /var/log

discourse-backend.yml

start with template and change name too

cp /srv/docker/discourse/samples/data.yml /srv/docker/discourse/containers/discourse-backend.yml

change network to internal

Note

create docker network with internal flag for backend docker network create --internal internal-discoursenet

docker_args:
  - '--network internal-discoursenet'

networks:
  internal-discoursenet:
    external: true

install

Warning

default ./launcher rebuild app is changed bc name of app.yml has changed to discourse.yml otherwise it would be ./launcher rebuild app

start install with custom config

start with backend and wait till its up so database is ready. check logs that database is ready for connection.

./launcher rebuild discourse-backend.yml
than start discourse itself
./launcher rebuild discourse

update

pull newest image

first stop both containers

./launcher stop discourse.yml && ./launcher stop discourse-backend.yml

start with backend till its ready up

./launcher rebuild discourse-backend.yml
then start discourse
./launcher rebuild discourse

update env variables

after changes to discourse.yml or discourse-backend.yml, detroy & start again

./launcher destroy discourse.yml && ./launcher destroy discourse-backend.yml

./launcher start discourse-backend.yml
wait till backend is ready up
./launcher start discourse.yml

logs

Tip

meanwhile i use dozzle for logs which is really handy

./launcher logs discourse.yml
./launcher logs discourse-backend.yml

source

https://meta.discourse.org/t/change-discourse-install-storage-location/88256?silent=true

https://meta.discourse.org/t/integrating-discourse-caddy-and-wordpress-with-docker-ports-for-reverse-proxy/337656

https://caddy.community/t/discourse-with-caddy-v2-in-docker/9244