Files
lasuite-messages/compose.yaml
T
Sylvain ZimmerandGitHub f1a89a5bdb ✨(all) refactor several areas before 0.1 release (#265)
We are going to release a 0.1 version soon, along with our first production deployment. Starting from there, migrations and a consistent developer experience will be officially supported. To make that easier, this large patch cleans up several areas:
 * Reset migrations one last time
 * Update models for storage efficiency (move textchoices to integerchoices on high-volume tables)
 * Use Blobs for mail mime data and draft bodies. Having them in a separate PG table is a first step, we will later start offloading them to object storage.
 * Add default ZSTD compression to blobs
 * Add per-domain DKIM Keys
 * Add DNS check and provisioning, with a first Scaleway provider
 * Fix Keycloak user provisioning
 * Fix Attachment storage, they are now stored individually only at the drafting stage. Afterwards they are extracted from the main blob. This may be optimized later but at least we only store once. For JMAP compatibility, this requires using fake IDs in the blob API route.
 * Add a management command and recurring task to retry unsent messages
 * Improve the local developer experience with new ports and make commands
 * Repackage MTA-in and MTA-out to be closer to Backend: Poetry, multi-step Dockerfile, move compose and makefile to the root
 * Migrate to OpenSearch
 * Improve overall documentation and add a self-hosting page

Contributes to #177 and #185
2025-07-15 10:41:55 +02:00

350 lines
8.2 KiB
YAML

name: st-messages
services:
postgresql:
image: postgres:16.6
ports:
- "8912:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 1s
timeout: 2s
retries: 300
env_file:
- env.d/development/postgresql.defaults
- env.d/development/postgresql.local
redis:
image: redis:5
ports:
- "8913:6379"
opensearch:
image: opensearchproject/opensearch:2.19.2
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
- "DISABLE_INSTALL_DEMO_CONFIG=true"
- "DISABLE_SECURITY_PLUGIN=true"
# - http.cors.enabled=true
# - "http.cors.allow-origin=/.*/"
ports:
- "8914:9200" # REST API
- "8915:9600" # Performance Analyzer
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9200"]
interval: 1s
timeout: 5s
retries: 60
ulimits:
memlock:
soft: -1 # Set memlock to unlimited (no soft or hard limit)
hard: -1
nofile:
soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
hard: 65536
mailcatcher:
image: maildev/maildev:2.2.1
ports:
- "8904:1080"
# minio:
# user: ${DOCKER_USER:-1000}
# image: minio/minio
# environment:
# - MINIO_ROOT_USER=st-messages
# - MINIO_ROOT_PASSWORD=password
# ports:
# - "9000:9000"
# - "9001:9001"
# healthcheck:
# test: ["CMD", "mc", "ready", "local"]
# interval: 1s
# timeout: 20s
# retries: 300
# entrypoint: ""
# command: minio server --console-address :9001 /data
# volumes:
# - ./data/media:/data
# createbuckets:
# image: minio/mc
# depends_on:
# minio:
# condition: service_healthy
# restart: true
# entrypoint: >
# sh -c "
# /usr/bin/mc alias set st-messages http://minio:9000 st-messages password && \
# /usr/bin/mc mb st-messages/st-messages-media-storage && \
# /usr/bin/mc version enable st-messages/st-messages-media-storage && \
# exit 0;"
backend-dev:
build:
context: src/backend
target: runtime-dev
args:
DOCKER_USER: ${DOCKER_USER:-1000}
user: ${DOCKER_USER:-1000}
environment:
- PYLINTHOME=/app/.pylint.d
- DJANGO_CONFIGURATION=Development
env_file:
- env.d/development/backend.defaults
- env.d/development/backend.local
ports:
- "8901:8000"
volumes:
- ./src/backend:/app
- ./data/static:/data/static
depends_on:
postgresql:
condition: service_healthy
restart: true
redis:
condition: service_started
mta-out:
condition: service_started
opensearch:
condition: service_healthy
keycloak:
condition: service_started
# createbuckets:
# condition: service_started
backend-db:
profiles:
- tools
build:
context: src/backend
target: runtime-dev
args:
DOCKER_USER: ${DOCKER_USER:-1000}
user: ${DOCKER_USER:-1000}
environment:
- DJANGO_CONFIGURATION=DevelopmentMinimal
env_file:
- env.d/development/backend.defaults
- env.d/development/backend.local
ports:
- "8901:8000"
volumes:
- ./src/backend:/app
- ./data/static:/data/static
depends_on:
postgresql:
condition: service_healthy
restart: true
backend-poetry:
profiles:
- tools
volumes:
- ./src/backend:/app
build:
context: src/backend/
target: poetry
pull_policy: build
celery-dev:
build:
context: src/backend
target: runtime-dev
args:
DOCKER_USER: ${DOCKER_USER:-1000}
user: ${DOCKER_USER:-1000}
command: ["celery", "-A", "messages.celery_app", "worker", "-l", "DEBUG"]
environment:
- DJANGO_CONFIGURATION=Development
env_file:
- env.d/development/backend.defaults
- env.d/development/backend.local
volumes:
- ./src/backend:/app
- ./data/static:/data/static
depends_on:
- backend-dev
celery-ui:
build:
context: src/backend
target: runtime-dev
args:
DOCKER_USER: ${DOCKER_USER:-1000}
user: ${DOCKER_USER:-1000}
depends_on:
- redis
environment:
- FLOWER_UNAUTHENTICATED_API=true
- DJANGO_CONFIGURATION=Development
env_file:
- env.d/development/backend.defaults
- env.d/development/backend.local
volumes:
- ./src/backend:/app
ports:
- "8903:8803"
command: celery -A messages.celery_app flower --port=8803
# nginx:
# image: nginx:1.25
# ports:
# - "8083:8083"
# volumes:
# - ./docker/files/development/etc/nginx/conf.d:/etc/nginx/conf.d:ro
# depends_on:
# - keycloak
# - backend-dev
# - mta-in
# - mta-out
frontend-dev:
user: "${DOCKER_USER:-1000}"
build:
context: .
dockerfile: ./src/frontend/Dockerfile.dev
env_file:
- env.d/development/frontend.defaults
- env.d/development/frontend.local
command: ["npm", "run", "dev"]
volumes:
- ./src/frontend/:/home/frontend/
ports:
- "8900:3000"
frontend-tools:
user: "${DOCKER_USER:-1000}"
profiles:
- frontend-tools
build:
dockerfile: ./src/frontend/Dockerfile.dev
volumes:
- ./src/backend/core/api/openapi.json:/home/backend/core/api/openapi.json
- ./src/frontend/:/home/frontend/
frontend-tools-amd64:
user: "${DOCKER_USER:-1000}"
profiles:
- frontend-tools
platform: linux/amd64
build:
dockerfile: ./src/frontend/Dockerfile.dev
volumes:
- ./src/backend/core/api/openapi.json:/home/backend/core/api/openapi.json
- ./src/frontend/:/home/frontend/
# crowdin:
# image: crowdin/cli:3.16.0
# volumes:
# - ".:/app"
# env_file:
# - env.d/development/crowdin
# user: "${DOCKER_USER:-1000}"
# working_dir: /app
mta-in:
build:
context: src/mta-in
target: runtime-prod
env_file:
- env.d/development/mta-in.defaults
- env.d/development/mta-in.local
ports:
- "8910:25"
depends_on:
- backend-dev
mta-in-test:
profiles:
- tools
build:
context: src/mta-in
target: runtime-dev
env_file:
- env.d/development/mta-in.defaults
- env.d/development/mta-in.local
environment:
- EXEC_CMD=true
- MDA_API_BASE_URL=http://localhost:8000/api/mail/
- MTA_HOST=localhost
command: pytest -vvs tests/
volumes:
- ./src/mta-in:/app
mta-in-poetry:
profiles:
- tools
volumes:
- ./src/mta-in:/app
build:
context: src/mta-in
target: poetry
pull_policy: build
mta-out:
build:
context: src/mta-out
target: runtime-prod
env_file:
- env.d/development/mta-out.defaults
- env.d/development/mta-out.local
ports:
- "8911:587"
depends_on:
mailcatcher:
condition: service_started
mta-out-test:
profiles:
- tools
build:
context: src/mta-out
target: runtime-dev
env_file:
- env.d/development/mta-out.defaults
- env.d/development/mta-out.local
environment:
- EXEC_CMD=true
- MTA_OUT_HOST=localhost:587
- MTA_OUT_SMTP_USERNAME=user
- MTA_OUT_SMTP_PASSWORD=pass
- SMTP_RELAY_HOST=localhost:2525
command: pytest -vvs tests/
volumes:
- ./src/mta-out:/app
mta-out-poetry:
profiles:
- tools
volumes:
- ./src/mta-out:/app
build:
context: src/mta-out
target: poetry
pull_policy: build
keycloak:
image: quay.io/keycloak/keycloak:26.2.5
volumes:
- ./src/keycloak/realm.json:/opt/keycloak/data/import/realm.json:ro
- ./src/keycloak/themes/dsfr-2.2.1.jar:/opt/keycloak/providers/keycloak-theme.jar:ro
command:
- start-dev
- --features=preview
- --import-realm
- --proxy=edge
- --hostname=http://localhost:8902
- --hostname-admin=http://localhost:8902/
- --http-port=8802
env_file:
- env.d/development/keycloak.defaults
- env.d/development/keycloak.local
ports:
- "8902:8802"
depends_on:
- postgresql