Switch production config to env vars with defaults
Remove hardcoded S3 settings and dev-specific defaults from production docker-compose, use .env instead of .env.production, and comment out development-only values in .env.example
This commit is contained in:
+6
-5
@@ -10,14 +10,14 @@ APP_VERSION=2.0.0
|
|||||||
DEBUG=false
|
DEBUG=false
|
||||||
SECRET_KEY=changez-moi-par-une-valeur-longue-et-aleatoire
|
SECRET_KEY=changez-moi-par-une-valeur-longue-et-aleatoire
|
||||||
|
|
||||||
# ── Serveur ──────────────────────────────────────────────────
|
# ── Serveur (pour dev seulement) ──────────────────────────────
|
||||||
HOST=0.0.0.0
|
# HOST=0.0.0.0
|
||||||
PORT=8000
|
# PORT=8000
|
||||||
|
|
||||||
# ── Base de données ──────────────────────────────────────────
|
# ── Base de données ──────────────────────────────────────────
|
||||||
# SQLite (dev): sqlite+aiosqlite:///./data/imago.db
|
# SQLite (dev): sqlite+aiosqlite:///./data/imago.db
|
||||||
# PostgreSQL: postgresql+asyncpg://user:pass@host:5432/imago
|
PostgreSQL: postgresql+asyncpg://user:pass@host:5432/imago
|
||||||
DATABASE_URL=sqlite+aiosqlite:///./data/imago.db
|
# DATABASE_URL=sqlite+aiosqlite:///./data/imago.db
|
||||||
|
|
||||||
# ── Stockage ─────────────────────────────────────────────────
|
# ── Stockage ─────────────────────────────────────────────────
|
||||||
# local (fichiers sur disque) ou s3 (MinIO / AWS S3 / Cloudflare R2)
|
# local (fichiers sur disque) ou s3 (MinIO / AWS S3 / Cloudflare R2)
|
||||||
@@ -25,6 +25,7 @@ STORAGE_BACKEND=local
|
|||||||
UPLOAD_DIR=./data/uploads
|
UPLOAD_DIR=./data/uploads
|
||||||
THUMBNAILS_DIR=./data/thumbnails
|
THUMBNAILS_DIR=./data/thumbnails
|
||||||
MAX_UPLOAD_SIZE_MB=50
|
MAX_UPLOAD_SIZE_MB=50
|
||||||
|
SIGNED_URL_SECRET=changez-moi-en-prod
|
||||||
|
|
||||||
# ── Stockage S3 (si STORAGE_BACKEND=s3) ──────────────────────
|
# ── Stockage S3 (si STORAGE_BACKEND=s3) ──────────────────────
|
||||||
S3_BUCKET=imago
|
S3_BUCKET=imago
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
# Imago — Docker Compose Production
|
# Imago — Docker Compose Production
|
||||||
# Usage: docker compose -f docker-compose.production.yml up -d
|
# Usage:
|
||||||
|
# 1. Copier .env.example → .env et remplir les secrets
|
||||||
|
# 2. docker compose -f docker-compose.production.yml up -d
|
||||||
|
#
|
||||||
|
# Docker Compose lit automatiquement le fichier .env du répertoire courant.
|
||||||
|
# Les variables d'environnement sont référencées avec ${VAR} ou ${VAR:-défaut}.
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# ── Admin Panel (React + Nginx) ───────────────────────────
|
# ── Admin Panel (React + Nginx) ───────────────────────────
|
||||||
admin:
|
admin:
|
||||||
image: docker-registry.dev.home:5000/imago-admin:latest
|
image: docker-registry.dev.home:5000/imago-admin:latest
|
||||||
ports:
|
ports:
|
||||||
- "3001:80"
|
- "${ADMIN_PORT:-3001}:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -15,17 +20,18 @@ services:
|
|||||||
backend:
|
backend:
|
||||||
image: docker-registry.dev.home:5000/imago-backend:latest
|
image: docker-registry.dev.home:5000/imago-backend:latest
|
||||||
ports:
|
ports:
|
||||||
- "8001:8000"
|
- "${BACKEND_PORT:-8001}:8000"
|
||||||
env_file: .env.production
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
REDIS_URL: redis://redis:6379/0
|
# Connexions internes Docker (hostnames fixes)
|
||||||
DATABASE_URL: postgresql+asyncpg://imago:imago@db:5432/imago
|
DATABASE_URL: postgresql+asyncpg://imago:imago@db:5432/imago
|
||||||
STORAGE_BACKEND: s3
|
REDIS_URL: redis://redis:6379/0
|
||||||
S3_ENDPOINT_URL: http://minio:9000
|
# Variables de l'application (lues depuis .env, défaut local)
|
||||||
S3_BUCKET: imago
|
STORAGE_BACKEND: ${STORAGE_BACKEND:-local}
|
||||||
S3_ACCESS_KEY: minioadmin
|
UPLOAD_DIR: ${UPLOAD_DIR:-/app/data/uploads}
|
||||||
S3_SECRET_KEY: minioadmin
|
THUMBNAILS_DIR: ${THUMBNAILS_DIR:-/app/data/thumbnails}
|
||||||
S3_REGION: us-east-1
|
MAX_UPLOAD_SIZE_MB: ${MAX_UPLOAD_SIZE_MB:-50}
|
||||||
|
SIGNED_URL_SECRET: ${SIGNED_URL_SECRET:-changez-moi-en-prod}
|
||||||
volumes:
|
volumes:
|
||||||
- uploads:/app/data/uploads
|
- uploads:/app/data/uploads
|
||||||
- thumbnails:/app/data/thumbnails
|
- thumbnails:/app/data/thumbnails
|
||||||
@@ -36,19 +42,22 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# ── ARQ Worker ────────────────────────────────────────────
|
||||||
worker:
|
worker:
|
||||||
image: docker-registry.dev.home:5000/imago-backend:latest
|
image: docker-registry.dev.home:5000/imago-backend:latest
|
||||||
command: python worker.py
|
command: python worker.py
|
||||||
env_file: .env.production
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
REDIS_URL: redis://redis:6379/0
|
|
||||||
DATABASE_URL: postgresql+asyncpg://imago:imago@db:5432/imago
|
DATABASE_URL: postgresql+asyncpg://imago:imago@db:5432/imago
|
||||||
STORAGE_BACKEND: s3
|
REDIS_URL: redis://redis:6379/0
|
||||||
S3_ENDPOINT_URL: http://minio:9000
|
STORAGE_BACKEND: ${STORAGE_BACKEND:-local}
|
||||||
S3_BUCKET: imago
|
UPLOAD_DIR: ${UPLOAD_DIR:-/app/data/uploads}
|
||||||
S3_ACCESS_KEY: minioadmin
|
THUMBNAILS_DIR: ${THUMBNAILS_DIR:-/app/data/thumbnails}
|
||||||
S3_SECRET_KEY: minioadmin
|
MAX_UPLOAD_SIZE_MB: ${MAX_UPLOAD_SIZE_MB:-50}
|
||||||
S3_REGION: us-east-1
|
SIGNED_URL_SECRET: ${SIGNED_URL_SECRET:-changez-moi-en-prod}
|
||||||
|
volumes:
|
||||||
|
- uploads:/app/data/uploads
|
||||||
|
- thumbnails:/app/data/thumbnails
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -56,6 +65,7 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# ── Base de données ───────────────────────────────────────
|
||||||
db:
|
db:
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
environment:
|
environment:
|
||||||
@@ -72,6 +82,7 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# ── Redis ─────────────────────────────────────────────────
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: redis:7-alpine
|
||||||
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
|
||||||
@@ -84,6 +95,7 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# ── MinIO (optionnel — utilisé seulement si STORAGE_BACKEND=s3)
|
||||||
minio:
|
minio:
|
||||||
image: minio/minio
|
image: minio/minio
|
||||||
command: server /data --console-address ':9001'
|
command: server /data --console-address ':9001'
|
||||||
|
|||||||
Reference in New Issue
Block a user