From 4892053e7ace9445f23eab85f9448660283a0268 Mon Sep 17 00:00:00 2001 From: AlexeerCT Date: Fri, 24 Apr 2026 13:35:40 -0500 Subject: [PATCH] Update docker-compose.yml and Jenkinsfile for improved service health checks and logging - Adjusted health check parameters in docker-compose.yml for backend services to enhance reliability during startup. - Increased memory limits and reservations for backend services to accommodate higher resource demands. - Updated service dependencies in docker-compose.yml to ensure proper startup order based on health status. - Enhanced Jenkinsfile to include additional logging for backend and Celery services, aiding in troubleshooting during CI runs. --- Jenkinsfile | 6 ++++++ docker-compose.yml | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 27852621..36a752e5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -232,6 +232,12 @@ pipeline { docker logs --tail 400 anexo76-postgres-keycloak 2>&1 || true echo "--- logs: anexo76-keycloak (Keycloak) ---" docker logs --tail 250 anexo76-keycloak 2>&1 || true + echo "--- logs: anexo76-backend (FastAPI / migraciones) ---" + docker logs --tail 400 anexo76-backend 2>&1 || true + echo "--- logs: worker (celery) ---" + docker logs --tail 200 worker 2>&1 || true + echo "--- logs: celery_beat ---" + docker logs --tail 200 celery_beat 2>&1 || true } if ! e2e_compose up -d --build; then e2e_compose_fail_logs diff --git a/docker-compose.yml b/docker-compose.yml index 065d2eb1..55c17606 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -210,12 +210,13 @@ services: - frontend-net restart: unless-stopped command: [ "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload", "--log-level", "info" ] + # El lifespan corre Alembic antes de servir; 1.ª subida a DB vacía puede tardar varios minutos (E2E/CI) healthcheck: test: [ "CMD-SHELL", "curl -f http://localhost:8000/api/health || exit 1" ] - interval: 15s - timeout: 5s - retries: 5 - start_period: 60s + interval: 20s + timeout: 10s + retries: 20 + start_period: 600s logging: driver: "json-file" options: @@ -224,9 +225,9 @@ services: deploy: resources: limits: - memory: 512M + memory: 1024M reservations: - memory: 256M + memory: 512M # Frontend - SvelteKit frontend: @@ -312,8 +313,10 @@ services: - S3_USE_SSL=${S3_USE_SSL:-false} - S3_FILE_STORAGE=${S3_FILE_STORAGE:-true} depends_on: - - backend - - valkey + backend: + condition: service_healthy + valkey: + condition: service_started volumes: - ./backend:/app - backend_cache:/app/__pycache__ @@ -349,8 +352,10 @@ services: - S3_USE_SSL=${S3_USE_SSL:-false} - S3_FILE_STORAGE=${S3_FILE_STORAGE:-true} depends_on: - - backend - - valkey + backend: + condition: service_healthy + valkey: + condition: service_started volumes: - ./backend:/app - backend_cache:/app/__pycache__