116 lines
3.8 KiB
YAML
116 lines
3.8 KiB
YAML
version: "3.8"
|
|
|
|
x-db-env: &db-env
|
|
# No, joplin doesn't support secrets here.
|
|
# https://discourse.joplinapp.org/t/add-ability-to-use-docker-secrets-in-joplin-server/32703/8
|
|
# We'll do a custom entrypoint script to work around this instead.
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/db_pass
|
|
POSTGRES_DB: joplin
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_HOST: db
|
|
|
|
services:
|
|
app:
|
|
image: joplin/server:3.7.3
|
|
networks:
|
|
- internal
|
|
- proxy
|
|
depends_on:
|
|
- db
|
|
secrets:
|
|
- db_pass
|
|
environment:
|
|
<<: *db-env
|
|
APP_PORT: 22300
|
|
APP_BASE_URL: https://${DOMAIN}
|
|
API_BASE_URL: https://${DOMAIN}
|
|
DB_CLIENT: pg
|
|
DELETE_EXPIRED_SESSIONS_SCHEDULE: ${DELETE_EXPIRED_SESSIONS_SCHEDULE}
|
|
LOCAL_AUTH_ENABLED: ${LOCAL_AUTH_ENABLED}
|
|
LOG_LEVEL: debug
|
|
# TODO: Could add in the Transcribe service, by cribbing more notes from
|
|
# https://github.com/laurent22/joplin/blob/dev/docker-compose.server.yml
|
|
# TRANSCRIBE_API_KEY: ${TRANSCRIBE_API_KEY}
|
|
# TRANSCRIBE_BASE_URL: http://transcribe:4567
|
|
TRANSCRIBE_ENABLED: 'false'
|
|
deploy:
|
|
restart_policy:
|
|
condition: on-failure
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=22300"
|
|
- "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}"
|
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.passhostheader=true"
|
|
# Redirect from EXTRA_DOMAINS to DOMAIN
|
|
- "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.regex=^http[s]?://([^/]*)/(.*)"
|
|
- "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.replacement=https://${DOMAIN}/$${2}"
|
|
- "traefik.http.middlewares.${STACK_NAME}-redirecthostname.redirectregex.permanent=true"
|
|
# Redirect HTTP to HTTPS
|
|
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.scheme=https"
|
|
- "traefik.http.middlewares.${STACK_NAME}-redirectscheme.redirectscheme.permanent=true"
|
|
## When you're ready for release, run "abra recipe sync <name>" to set this
|
|
- "coop-cloud.${STACK_NAME}.version=1.0.0+3.7.3"
|
|
## Enable backups: https://docs.coopcloud.tech/maintainers/handbook/#how-do-i-configure-backuprestore
|
|
- "backupbot.backup=${ENABLE_BACKUPS}"
|
|
healthcheck:
|
|
# No wget or curl, so we make do with node
|
|
test: ["CMD", "node", "/etc/healthcheck.js"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 10
|
|
start_period: 1m
|
|
entrypoint: /docker_entrypoint.sh
|
|
configs:
|
|
- source: healthcheck
|
|
target: /etc/healthcheck.js
|
|
- source: app_entrypoint
|
|
target: /docker_entrypoint.sh
|
|
mode: 0555
|
|
|
|
db:
|
|
image: "pgautoupgrade/pgautoupgrade:16-debian"
|
|
volumes:
|
|
- "postgres:/var/lib/postgresql/data"
|
|
networks:
|
|
- internal
|
|
deploy:
|
|
labels:
|
|
backupbot.backup.pre-hook: "/pg_backup.sh backup"
|
|
backupbot.backup.volumes.postgres.path: "backup.sql"
|
|
backupbot.restore.post-hook: "/pg_backup.sh restore"
|
|
configs:
|
|
- source: pg_backup
|
|
target: /pg_backup.sh
|
|
mode: 0555
|
|
secrets:
|
|
- db_pass
|
|
environment:
|
|
<<: *db-env
|
|
|
|
volumes:
|
|
postgres:
|
|
|
|
networks:
|
|
internal:
|
|
proxy:
|
|
external: true
|
|
|
|
secrets:
|
|
db_pass:
|
|
external: true
|
|
name: ${STACK_NAME}_db_pass_${SECRET_DB_PASS_VERSION}
|
|
|
|
configs:
|
|
pg_backup:
|
|
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
|
|
file: pg_backup.sh
|
|
healthcheck:
|
|
name: ${STACK_NAME}_healthcheck_${HEALTHCHECK_VERSION}
|
|
file: healthcheck.js.tmpl
|
|
template_driver: golang
|
|
app_entrypoint:
|
|
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
|
|
file: entrypoint.sh
|