-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.server.yml
More file actions
97 lines (85 loc) · 3.23 KB
/
docker-compose.server.yml
File metadata and controls
97 lines (85 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# MyElectricalData - Server Mode (Production)
#
# Déploiement production du mode serveur (gateway multi-utilisateurs).
# Démarre uniquement le backend et frontend.
# Les services externes (PostgreSQL, Valkey) doivent être fournis.
#
# Usage:
# docker compose -f docker-compose.server.yml up -d
#
# Prérequis:
# - PostgreSQL accessible
# - Valkey/Redis accessible
#
# Ports:
# - Frontend: http://localhost:8000
# - Backend API: http://localhost:8081
services:
# Backend FastAPI - Server Mode
backend:
image: ghcr.io/myelectricaldata/myelectricaldata/backend:latest
restart: unless-stopped
ports:
- "${SERVER_BACKEND_PORT:-8081}:8000"
environment:
# === System ===
- PYTHONUNBUFFERED=1
- TZ=${TZ:-Europe/Paris}
- SERVER_MODE=true
# === Database (REQUIRED) ===
- DATABASE_URL=${DATABASE_URL:-postgresql+asyncpg://myelectricaldata:password@postgres:5432/myelectricaldata}
# === Cache Valkey/Redis (REQUIRED) ===
- REDIS_URL=${REDIS_URL:-redis://valkey:6379/0}
- CACHE_TTL_SECONDS=${CACHE_TTL_SECONDS:-86400}
# === Enedis API (REQUIRED) ===
- ENEDIS_CLIENT_ID=${ENEDIS_CLIENT_ID}
- ENEDIS_CLIENT_SECRET=${ENEDIS_CLIENT_SECRET}
- ENEDIS_ENVIRONMENT=${ENEDIS_ENVIRONMENT:-production}
- ENEDIS_REDIRECT_URI=${ENEDIS_REDIRECT_URI}
# === RTE API (REQUIRED for Tempo/EcoWatt) ===
- RTE_CLIENT_ID=${RTE_CLIENT_ID}
- RTE_CLIENT_SECRET=${RTE_CLIENT_SECRET}
# === Security ===
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(32))"
- SECRET_KEY=${SECRET_KEY:-change-me-in-production}
- ALGORITHM=${ALGORITHM:-HS256}
- ACCESS_TOKEN_EXPIRE_MINUTES=${ACCESS_TOKEN_EXPIRE_MINUTES:-43200}
# === Rate Limiting ===
- ENEDIS_RATE_LIMIT=${ENEDIS_RATE_LIMIT:-5}
- USER_DAILY_LIMIT_NO_CACHE=${USER_DAILY_LIMIT_NO_CACHE:-50}
- USER_DAILY_LIMIT_WITH_CACHE=${USER_DAILY_LIMIT_WITH_CACHE:-1000}
# === Application ===
- DEBUG=${DEBUG:-false}
- API_HOST=${API_HOST:-0.0.0.0}
- API_PORT=${API_PORT:-8000}
- FRONTEND_URL=${FRONTEND_URL:-https://myelectricaldata.fr}
- BACKEND_URL=${BACKEND_URL:-https://myelectricaldata.fr/api}
# === Email (optional) ===
- MAILGUN_API_KEY=${MAILGUN_API_KEY:-}
- MAILGUN_DOMAIN=${MAILGUN_DOMAIN:-}
- MAILGUN_FROM_EMAIL=${MAILGUN_FROM_EMAIL:-}
- REQUIRE_EMAIL_VERIFICATION=${REQUIRE_EMAIL_VERIFICATION:-false}
# === Captcha (optional) ===
- TURNSTILE_SECRET_KEY=${TURNSTILE_SECRET_KEY:-}
- REQUIRE_CAPTCHA=${REQUIRE_CAPTCHA:-false}
# === Admin ===
- ADMIN_EMAILS=${ADMIN_EMAILS:-}
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/ping')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Frontend React - Server Mode
frontend:
image: ghcr.io/myelectricaldata/myelectricaldata/frontend:latest
restart: unless-stopped
ports:
- "${SERVER_FRONTEND_PORT:-8000}:80"
environment:
- VITE_API_BASE_URL=/api
- VITE_BACKEND_URL=http://backend:8000
- VITE_SERVER_MODE=true
depends_on:
backend:
condition: service_healthy