Files
lasuite-docs/compose.yml

293 lines
8.6 KiB
YAML

---
# NOTE: based on https://github.com/suitenumerique/docs/pull/855/ and https://github.com/suitenumerique/docs/pull/583/
x-common-env: &common-env
DJANGO_CONFIGURATION: Production
DJANGO_ALLOWED_HOSTS: "*"
DJANGO_SECRET_KEY_FILE: /run/secrets/django_secret_key
DJANGO_SETTINGS_MODULE: impress.settings
DJANGO_SUPERUSER_PASSWORD_FILE: /run/secrets/django_superuser_password
# Logging
# Set to DEBUG level for dev only
LOGGING_LEVEL_HANDLERS_CONSOLE:
LOGGING_LEVEL_LOGGERS_ROOT:
LOGGING_LEVEL_LOGGERS_APP:
# Python
PYTHONPATH: /app
# Mail
DJANGO_EMAIL_BRAND_NAME:
DJANGO_EMAIL_HOST:
DJANGO_EMAIL_LOGO_IMG:
DJANGO_EMAIL_PORT:
DJANGO_EMAIL_HOST_USER:
DJANGO_EMAIL_HOST_PASSWORD_FILE:
# /run/secrets/django_email_host_password
# Backend url
IMPRESS_BASE_URL: "https://${DOMAIN}"
# Media
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
AWS_S3_ENDPOINT_URL: http://minio:9000
AWS_S3_ACCESS_KEY_ID: user
AWS_S3_SECRET_ACCESS_KEY_FILE: /run/secrets/aws_s3_secret_access_key
MEDIA_BASE_URL: https://${DOMAIN}
AWS_STORAGE_BUCKET_NAME: docs-media-storage
# OIDC - settings from .env, see .env.sample
OIDC_OP_JWKS_ENDPOINT:
OIDC_OP_AUTHORIZATION_ENDPOINT:
OIDC_OP_TOKEN_ENDPOINT:
OIDC_OP_USER_ENDPOINT:
OIDC_RP_CLIENT_ID:
OIDC_RP_CLIENT_SECRET_FILE: /run/secrets/oidc_rp_client_secret
OIDC_RP_SIGN_ALGO:
OIDC_RP_SCOPES:
LOGIN_REDIRECT_URL:
LOGIN_REDIRECT_URL_FAILURE:
LOGOUT_REDIRECT_URL:
OIDC_REDIRECT_ALLOWED_HOSTS:
OIDC_AUTH_REQUEST_EXTRA_PARAMS:
# AI
AI_FEATURE_ENABLED: "false"
AI_BASE_URL: https://openaiendpoint.com
AI_API_KEY: password
AI_MODEL: llama
# Collaboration
COLLABORATION_API_URL: https://$DOMAIN/collaboration/api/
x-postgres-env: &postgres-env
# Postgresql db container configuration
POSTGRES_DB: docs
POSTGRES_USER: docs
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
# App database configuration
DB_HOST: db
DB_NAME: docs
DB_USER: docs
DB_PASSWORD_FILE: /run/secrets/postgres_password
DB_PORT: 5432
x-yprovider-env: &yprovider-env
COLLABORATION_LOGGING: "true"
Y_PROVIDER_API_KEY: foobar
COLLABORATION_API_URL: http://y-provider:4444/api/
COLLABORATION_SERVER_ORIGIN: https://${DOMAIN}
COLLABORATION_SERVER_SECRET_FILE: /run/secrets/collaboration_server_secret
COLLABORATION_BACKEND_BASE_URL: https://${DOMAIN}
COLLABORATION_WS_URL: wss://${DOMAIN}/collaboration/ws/
services:
app:
image: lasuite/impress-frontend:v3.6.0
networks:
- backend
deploy:
labels:
- "traefik.enable=false"
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
- "coop-cloud.${STACK_NAME}.version=0.3.0+v3.6.0"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
interval: 15s
timeout: 30s
retries: 20
start_period: 10s
backend:
image: lasuite/impress-backend:v3.6.0
networks:
- backend
environment:
<<: [*common-env, *postgres-env, *yprovider-env]
secrets:
- collaboration_server_secret
- postgres_password
- aws_s3_secret_access_key
- oidc_rp_client_secret
- django_secret_key
- django_superuser_password
#- django_email_host_password
healthcheck:
test: ["CMD", "python", "manage.py", "check"]
interval: 15s
timeout: 30s
retries: 20
start_period: 10s
celery:
image: lasuite/impress-backend:v3.6.0
networks:
- backend
command: ["celery", "-A", "impress.celery_app", "worker", "-l", "INFO"]
environment:
<<: [*common-env, *postgres-env, *yprovider-env]
secrets:
- collaboration_server_secret
- django_superuser_password
- postgres_password
- aws_s3_secret_access_key
- oidc_rp_client_secret
- django_secret_key
#- django_email_host_password
y-provider:
image: lasuite/impress-y-provider:v3.6.0
networks:
- backend
secrets:
- collaboration_server_secret
environment: *yprovider-env
# NOTE: healthcheck - `wget` is available in the container, but `wget http://localhost:4444` gives a 403
db:
image: postgres:16
networks:
- backend
healthcheck:
test: ["CMD", "pg_isready", "-q", "-U", "docs", "-d", "docs"]
interval: 1s
timeout: 2s
retries: 300
environment:
<<: *postgres-env
PGDATA: var/lib/postgresql/data/pgdata
volumes:
- postgres:/var/lib/postgresql/data/pgdata
secrets:
- postgres_password
deploy:
labels:
backupbot.backup: "${ENABLE_BACKUPS:-true}"
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
redis:
image: redis:8
networks:
- backend
minio-bootstrap:
# NOTE: Not started by default, only run with a manual `abra app restart` / `docker service scale`
image: minio/mc:RELEASE.2025-08-13T08-35-41Z
environment:
- MINIO_ROOT_USER=minio
- MINIO_ROOT_PASSWORD_FILE=/run/secrets/minio_root_password
networks:
- backend
secrets:
- minio_root_password
deploy:
mode: replicated
replicas: 0
restart_policy:
condition: none
minio:
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
environment:
- MINIO_ROOT_USER=minio
- MINIO_ROOT_PASSWORD_FILE=/run/secrets/minio_root_password
secrets:
- minio_root_password
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 1s
timeout: 20s
retries: 300
entrypoint: ""
networks:
- backend
command: minio server /data
volumes:
- minio:/data
deploy:
labels:
backupbot.backup: "${ENABLE_BACKUPS:-true}"
web:
image: nginx:1.29
configs:
- source: nginx_conf
target: /etc/nginx/conf.d/default.conf
networks:
proxy:
backend:
deploy:
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.${STACK_NAME}.tls=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8083"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
networks:
proxy:
external: true
backend:
volumes:
postgres:
minio:
configs:
nginx_conf:
name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION}
file: nginx.conf
pg_backup:
name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
file: pg_backup.sh
minio_entrypoint:
name: ${STACK_NAME}_minio_entrypoint_${MINIO_ENTRYPOINT_VERSION}
file: entrypoint-minio.sh.tmpl
template_driver: golang
minio_bootstrap_entrypoint:
name: ${STACK_NAME}_minio_bootstrap_entrypoint_${MINIO_BOOTSTRAP_ENTRYPOINT_VERSION}
file: entrypoint-minio-bootstrap.sh.tmpl
template_driver: golang
yprovider_entrypoint:
name: ${STACK_NAME}_yprovider_entrypoint_${YPROVIDER_ENTRYPOINT_VERSION}
file: entrypoint-yprovider.sh.tmpl
template_driver: golang
backend_entrypoint:
name: ${STACK_NAME}_backend_entrypoint_${BACKEND_ENTRYPOINT_VERSION}
file: entrypoint-backend.sh.tmpl
template_driver: golang
celery_entrypoint:
name: ${STACK_NAME}_celery_entrypoint_${CELERY_ENTRYPOINT_VERSION}
file: entrypoint-celery.sh.tmpl
template_driver: golang
secrets:
minio_root_password:
name: ${STACK_NAME}_minio_root_password_${SECRET_MINIO_ROOT_PASSWORD_VERSION}
external: true
collaboration_server_secret:
name: ${STACK_NAME}_collaboration_server_secret_${SECRET_COLLABORATION_SERVER_SECRET_VERSION}
external: true
postgres_password:
name: ${STACK_NAME}_postgres_password_${SECRET_POSTGRES_PASSWORD_VERSION}
external: true
aws_s3_secret_access_key:
name: ${STACK_NAME}_aws_s3_secret_access_key_${SECRET_AWS_S3_SECRET_ACCESS_KEY_VERSION}
external: true
oidc_rp_client_secret:
name: ${STACK_NAME}_oidc_rp_client_secret_${SECRET_OIDC_RP_CLIENT_SECRET_VERSION}
external: true
django_secret_key:
name: ${STACK_NAME}_django_secret_key_${SECRET_DJANGO_SECRET_KEY_VERSION}
external: true
django_superuser_password:
name: ${STACK_NAME}_django_superuser_password_${SECRET_DJANGO_SUPERUSER_PASSWORD_VERSION}
external: true
# django_email_host_password:
# name: ${STACK_NAME}_django_email_host_passsword_${SECRET_DJANGO_EMAIL_HOST_PASSWORD_VERSION}
# external: true