135 lines
3.9 KiB
YAML
135 lines
3.9 KiB
YAML
services:
|
|
panoramax_db:
|
|
image: postgis/postgis:16-3.4
|
|
container_name: panoramax_db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: panoramax
|
|
POSTGRES_USER: panoramax_user
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
volumes:
|
|
- ${SRV_DIR:-/srv/panoramax}/db_data:/var/lib/postgresql/data
|
|
networks:
|
|
- panoramax_network
|
|
healthcheck:
|
|
test: [ "CMD-SHELL", "pg_isready -U panoramax_user -d panoramax" ]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
panoramax_api:
|
|
image: panoramax/api:latest
|
|
container_name: panoramax_api
|
|
restart: unless-stopped
|
|
depends_on:
|
|
panoramax_db:
|
|
condition: service_healthy
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DB_HOST=panoramax_db
|
|
- DB_PORT=5432
|
|
- DB_NAME=panoramax
|
|
- DB_USERNAME=panoramax_user
|
|
- DB_PASSWORD=${DB_PASSWORD}
|
|
# Désactive le traitement interne pour déléguer au picture-worker
|
|
- PICTURE_PROCESS_THREADS_LIMIT=0
|
|
# Permet à Gunicorn de faire confiance aux en-têtes de proxy (comme X-Forwarded-Proto) envoyés par Caddy
|
|
- GUNICORN_CMD_ARGS=--forwarded-allow-ips=*
|
|
# Visibilité par défaut publique pour les métadonnées (images protégées au niveau du proxy)
|
|
- API_DEFAULT_PICTURE_VISIBILITY=anyone
|
|
# ports:
|
|
# Optionnel : Exposer localement pour le débug si besoin (décommenter si nécessaire)
|
|
# - "127.0.0.1:5001:5000"
|
|
# - "5000:5000"
|
|
networks:
|
|
- panoramax_network
|
|
- streetup_network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 2G
|
|
|
|
panoramax_worker:
|
|
image: panoramax/api:latest
|
|
restart: unless-stopped
|
|
command: picture-worker
|
|
depends_on:
|
|
panoramax_db:
|
|
condition: service_healthy
|
|
panoramax_api:
|
|
condition: service_started
|
|
panoramax_blur:
|
|
condition: service_healthy
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DB_HOST=panoramax_db
|
|
- DB_PORT=5432
|
|
- DB_NAME=panoramax
|
|
- DB_USERNAME=panoramax_user
|
|
- DB_PASSWORD=${DB_PASSWORD}
|
|
# Visibilité par défaut publique pour les métadonnées (images protégées au niveau du proxy)
|
|
- API_DEFAULT_PICTURE_VISIBILITY=anyone
|
|
networks:
|
|
- panoramax_network
|
|
deploy:
|
|
replicas: 4
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 4G
|
|
|
|
panoramax_blur:
|
|
image: panoramax/sgblur:latest
|
|
container_name: panoramax_blur
|
|
restart: unless-stopped
|
|
environment:
|
|
- WEB_CONCURRENCY=4 # Limite le nombre de workers concurrents pour préserver le CPU
|
|
- DETECT_URL=http://panoramax_detect:8001
|
|
depends_on:
|
|
panoramax_detect:
|
|
condition: service_healthy
|
|
networks:
|
|
- panoramax_network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 1G
|
|
healthcheck:
|
|
test: python -c "import requests; requests.get('http://localhost:8000/').raise_for_status()"
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 2s
|
|
|
|
panoramax_detect:
|
|
image: panoramax/sgblur:latest
|
|
container_name: panoramax_detect
|
|
entrypoint: ["uvicorn", "src.detect.detect_api:app", "--host", "0.0.0.0", "--port", "8001", "--workers", "4"]
|
|
restart: unless-stopped
|
|
environment:
|
|
- OMP_NUM_THREADS=1 # 1 seul thread PyTorch par processus pour éviter la surcharge de synchronisation
|
|
- MKL_NUM_THREADS=1 # 1 seul thread MKL par processus
|
|
- MKL_DYNAMIC=FALSE # Désactive la mise à l'échelle dynamique des threads de MKL
|
|
networks:
|
|
- panoramax_network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '4.0'
|
|
memory: 6G
|
|
healthcheck:
|
|
test: python -c "import requests; requests.get('http://localhost:8001/').raise_for_status()"
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 2s
|
|
|
|
networks:
|
|
panoramax_network:
|
|
driver: bridge
|
|
streetup_network:
|
|
external: true
|