Files
leerdoelen_tracker/docker-compose.yml
Sam f991cef71d
All checks were successful
Build & Push / Build & Push image (push) Successful in 31s
add more tweaks for stability for more users at the same time working in it
2026-02-28 15:24:15 +01:00

73 lines
2.7 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
db:
image: postgres:16-alpine
container_name: leerdoelen_db
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-leerdoelen}
POSTGRES_USER: ${POSTGRES_USER:-leerdoelen}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-leerdoelen}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: leerdoelen_redis
restart: unless-stopped
command: redis-server --save "" --appendonly no --maxmemory 64mb --maxmemory-policy allkeys-lru --requirepass ${REDIS_PASSWORD:-changeme_redis}
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-changeme_redis}", "ping"]
interval: 10s
timeout: 3s
retries: 3
backend:
# In productie: image uit de Gitea registry (gezet door CI/CD pipeline)
# Lokaal ontwikkelen: verander naar 'build: ./backend'
image: ${BACKEND_IMAGE:-leerdoelen-backend:local}
build:
context: ./backend
# 'build' wordt genegeerd als 'image' al bestaat in de registry.
# Gebruik 'docker compose build' om lokaal te (her)bouwen.
container_name: leerdoelen_backend
restart: unless-stopped
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-leerdoelen}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-leerdoelen}
SECRET_KEY: ${SECRET_KEY}
FLASK_ENV: ${FLASK_ENV:-production}
FLASK_APP: app.py
# OAuth2 - later in te vullen
MICROSOFT_CLIENT_ID: ${MICROSOFT_CLIENT_ID:-}
MICROSOFT_CLIENT_SECRET: ${MICROSOFT_CLIENT_SECRET:-}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-}
BASE_URL: ${BASE_URL:-http://localhost}
ORG_NAME: ${ORG_NAME:-GO! Scholengroep}
REDIS_URL: redis://:${REDIS_PASSWORD:-changeme_redis}@redis:6379/0
# Gunicorn tuning — standaard: (2 × CPU) + 1 workers, 2 threads per worker
# Pas aan op basis van je server: 2 vCPU → 5 workers, 4 vCPU → 9 workers
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-5}
GUNICORN_THREADS: ${GUNICORN_THREADS:-2}
LOG_LEVEL: ${LOG_LEVEL:-info}
volumes:
- ./doelen:/app/doelen:ro # JSON doelen bestanden (read-only)
ports:
- "127.0.0.1:${APP_PORT:-5000}:5000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
# Nginx container verwijderd — SSL offloading gebeurt door de host nginx.
# Flask is bereikbaar op 127.0.0.1:${APP_PORT} van de host.
volumes:
postgres_data: