Files
benevoles/docker-compose.yml
T
AdamThomasandClaude Sonnet 5 b268e308ab Étape 10 : envoi d'emails par SMTP
- app/email/ : sender (smtplib, STARTTLS ou SSL, connexion réutilisée pour un
  lot) + templates (rendu, textes dans locales/fr.json). EMAIL_ENABLED=false
  (défaut) ⇒ journalisé seulement, sans destinataire ni corps (RGPD).
- Lien magique : POST .../auth/magic-link envoie désormais l'email
  (PUBLIC_BASE_URL + magic_link_path + ?token=). Helper app/auth/magic_link.py
  partagé. Sans SMTP, le jeton non nominatif reste journalisé pour le dev.
- Récapitulatif de planning : POST /editions/{id}/notifications/planning
  (COORDINATION). subject/body sont des modèles ({prenom}, {nom}, {nb_creneaux},
  {nb_heures}, {creneaux}, {lien_connexion} → lien magique personnel émis).
  Cible tous les bénévoles avec email ou une liste. Envoi en BackgroundTasks.
- Config : PUBLIC_BASE_URL, EMAIL_ENABLED, SMTP_* ; .env.example,
  docker-compose (dev + prod), deploy/README.
- 9 tests (sender activé/désactivé, rendu, notifications : contenu, gabarit par
  défaut, lien magique embarqué, sous-ensemble, réservé COORDINATION).
  137 tests au total ; ruff + alembic check verts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uUsRg7XzopkCPWimwg9ZM
2026-09-10 08:08:55 +02:00

71 lines
2.3 KiB
YAML

name: benevoles
services:
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-benevoles}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-benevoles}
POSTGRES_DB: ${POSTGRES_DB:-benevoles}
ports:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
- ./docker/postgres-init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-benevoles}"]
interval: 5s
timeout: 5s
retries: 10
backend:
build: ./backend
command: uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
environment:
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-benevoles}:${POSTGRES_PASSWORD:-benevoles}@db:5432/${POSTGRES_DB:-benevoles}
TEST_DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-benevoles}:${POSTGRES_PASSWORD:-benevoles}@db:5432/benevoles_test
ENVIRONMENT: development
JWT_SECRET: ${JWT_SECRET:-dev-insecure-secret-change-me-please-32b}
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-http://localhost:5173}
EMAIL_ENABLED: ${EMAIL_ENABLED:-false}
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
SMTP_STARTTLS: ${SMTP_STARTTLS:-true}
SMTP_SSL: ${SMTP_SSL:-false}
SMTP_FROM: ${SMTP_FROM:-Festival des bénévoles <no-reply@example.test>}
TZ: Europe/Paris
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
volumes:
- ./backend:/app
- venv:/app/.venv
frontend:
build: ./frontend
command: npm run dev -- --host --port 5173
environment:
# mock = jeu de démonstration en mémoire (défaut, aucun backend requis).
# http = API réelle : renseigner aussi VITE_EDITION_ID (UUID d'une édition
# existante, p. ex. après `docker compose run --rm backend uv run python -m app.seed`).
VITE_API_MODE: ${VITE_API_MODE:-mock}
VITE_EDITION_ID: ${VITE_EDITION_ID:-}
# Cible du proxy `/api` de Vite à l'intérieur du réseau compose.
VITE_API_TARGET: http://backend:8000
ports:
- "5173:5173"
depends_on:
- backend
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
volumes:
db_data:
venv:
frontend_node_modules: