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.
This commit is contained in:
2026-04-24 13:35:40 -05:00
parent f2d645235a
commit 4892053e7a
2 changed files with 21 additions and 10 deletions

6
Jenkinsfile vendored
View File

@@ -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

View File

@@ -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__