discourse/compose.yaml

126 lines
3.4 KiB
YAML

services:
app:
image: bitnami/discourse:3.1.1
networks:
- proxy
- internal
# entrypoint: ['tail', '-f', '/dev/null']
environment:
- ALLOW_EMPTY_PASSWORD=yes
- DISCOURSE_DATABASE_HOST=${STACK_NAME}_db
- DISCOURSE_DATABASE_NAME=discourse
- DISCOURSE_DATABASE_PASSWORD_FILE=/run/secrets/db_password
- DISCOURSE_DATABASE_USER=discourse
- DISCOURSE_HOST=${DOMAIN}
- DISCOURSE_NOTIFICATION_EMAIL
- DISCOURSE_SMTP_AUTH
- DISCOURSE_SMTP_HOST
- DISCOURSE_SMTP_PORT
- DISCOURSE_SMTP_PROTOCOL
- DISCOURSE_SMTP_USER
- PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0
volumes:
- 'discourse_data:/bitnami/discourse'
secrets:
- db_password
depends_on:
- db
- redis
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=3000"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost:3000"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 1m
db:
image: postgres:13
networks:
- internal
secrets:
- db_password
volumes:
- 'postgresql_data:/var/lib/postgresql/data'
configs:
- source: db_entrypoint
target: /docker-entrypoint.sh
mode: 0555
entrypoint: /docker-entrypoint.sh
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
- POSTGRES_USER=discourse
- POSTGRES_DB=discourse
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
deploy:
labels:
backupbot.backup: "true"
backupbot.backup.pre-hook: "bash -c 'PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /tmp/backup.sql'"
backupbot.backup.post-hook: "rm -rf /tmp/backup.sql"
backupbot.backup.path: "/tmp/backup.sql"
redis:
image: redis:7.2-alpine
networks:
- internal
volumes:
- 'redis_data:/data'
sidekiq:
image: bitnami/discourse:3.0.6
networks:
- internal
depends_on:
- discourse
volumes:
- 'discourse_data:/bitnami/discourse'
command: /opt/bitnami/scripts/discourse-sidekiq/run.sh
secrets:
- db_password
environment:
- ALLOW_EMPTY_PASSWORD=yes
- DISCOURSE_DATABASE_HOST=db
- DISCOURSE_DATABASE_NAME=discourse
- DISCOURSE_DATABASE_PASSWORD_FILE=/run/secrets/db_password
- DISCOURSE_DATABASE_PORT_NUMBER=5432
- DISCOURSE_DATABASE_USER=discourse
- DISCOURSE_HOST=${DOMAIN}
- DISCOURSE_REDIS_HOST=redis
- DISCOURSE_REDIS_PORT_NUMBER=6379
- DISCOURSE_SMTP_HOST
- DISCOURSE_SMTP_PORT
- DISCOURSE_SMTP_PROTOCOL
- DISCOURSE_SMTP_USER
- PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0
- DISCOURSE_SMTP_AUTH
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password
volumes:
postgresql_data:
redis_data:
discourse_data:
networks:
proxy:
external: true
internal:
configs:
db_entrypoint:
name: ${STACK_NAME}_db_entrypoint
file: entrypoint.postgres.sh.tmpl
template_driver: golang