deploy(compose): healthcheck su server e client, depends_on condizionati (#38)
server: healthcheck su /api/health. client: healthcheck su /auth/login (pagina di login, raggiungibile senza sessione). depends_on passa a condition: service_healthy dove dipende da server/client (client->server, nginx->server+client in dev). Aggiunge WEB_CONCURRENCY=4 e TRUSTED_PROXY_COUNT=1 nell'environment del server (li legge il backend). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+20
-3
@@ -34,11 +34,19 @@ services:
|
|||||||
DB_HOST: mysql
|
DB_HOST: mysql
|
||||||
UPLOAD_DIR: uploads
|
UPLOAD_DIR: uploads
|
||||||
VISION_WORKER_URL: http://vision:8100
|
VISION_WORKER_URL: http://vision:8100
|
||||||
|
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-4}
|
||||||
|
TRUSTED_PROXY_COUNT: ${TRUSTED_PROXY_COUNT:-1}
|
||||||
volumes:
|
volumes:
|
||||||
- upload_data:/app/uploads
|
- upload_data:/app/uploads
|
||||||
depends_on:
|
depends_on:
|
||||||
mysql:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health', timeout=5)"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 20s
|
||||||
networks:
|
networks:
|
||||||
- tmflow-net
|
- tmflow-net
|
||||||
|
|
||||||
@@ -70,7 +78,14 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
API_SERVER_URL: http://server:8000
|
API_SERVER_URL: http://server:8000
|
||||||
depends_on:
|
depends_on:
|
||||||
- server
|
server:
|
||||||
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/auth/login', timeout=5)"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 20s
|
||||||
networks:
|
networks:
|
||||||
- tmflow-net
|
- tmflow-net
|
||||||
|
|
||||||
@@ -87,8 +102,10 @@ services:
|
|||||||
# - ./certbot/conf:/etc/letsencrypt:ro
|
# - ./certbot/conf:/etc/letsencrypt:ro
|
||||||
# - ./certbot/www:/var/www/certbot:ro
|
# - ./certbot/www:/var/www/certbot:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- server
|
server:
|
||||||
- client
|
condition: service_healthy
|
||||||
|
client:
|
||||||
|
condition: service_healthy
|
||||||
networks:
|
networks:
|
||||||
- tmflow-net
|
- tmflow-net
|
||||||
|
|
||||||
|
|||||||
+16
-1
@@ -35,11 +35,19 @@ services:
|
|||||||
UPLOAD_DIR: uploads
|
UPLOAD_DIR: uploads
|
||||||
VISION_WORKER_URL: http://vision:8100
|
VISION_WORKER_URL: http://vision:8100
|
||||||
SERVER_SECRET_KEY: ${SERVER_SECRET_KEY:?manca SERVER_SECRET_KEY}
|
SERVER_SECRET_KEY: ${SERVER_SECRET_KEY:?manca SERVER_SECRET_KEY}
|
||||||
|
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-4}
|
||||||
|
TRUSTED_PROXY_COUNT: ${TRUSTED_PROXY_COUNT:-1}
|
||||||
volumes:
|
volumes:
|
||||||
- upload_data:/app/uploads
|
- upload_data:/app/uploads
|
||||||
depends_on:
|
depends_on:
|
||||||
mysql:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health', timeout=5)"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 20s
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.tmflow-api.rule=Host(`tieflow.tielogic.xyz`) && (PathPrefix(`/api/`) || PathPrefix(`/uploads/`))"
|
- "traefik.http.routers.tmflow-api.rule=Host(`tieflow.tielogic.xyz`) && (PathPrefix(`/api/`) || PathPrefix(`/uploads/`))"
|
||||||
@@ -81,7 +89,14 @@ services:
|
|||||||
API_SERVER_URL: http://server:8000
|
API_SERVER_URL: http://server:8000
|
||||||
CLIENT_SECRET_KEY: ${CLIENT_SECRET_KEY:?manca CLIENT_SECRET_KEY}
|
CLIENT_SECRET_KEY: ${CLIENT_SECRET_KEY:?manca CLIENT_SECRET_KEY}
|
||||||
depends_on:
|
depends_on:
|
||||||
- server
|
server:
|
||||||
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/auth/login', timeout=5)"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 20s
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.tmflow-web.rule=Host(`tieflow.tielogic.xyz`)"
|
- "traefik.http.routers.tmflow-web.rule=Host(`tieflow.tielogic.xyz`)"
|
||||||
|
|||||||
Reference in New Issue
Block a user