fix: gunicorn + wait-for-db + healthcheck en docker-compose
Some checks failed
DEPLOY_MULTI_BRACH/pipeline/head There was a failure building this commit
Some checks failed
DEPLOY_MULTI_BRACH/pipeline/head There was a failure building this commit
- entrypoint.sh: sustituye runserver por gunicorn (workers=2, timeout=120) - entrypoint.sh: espera a PostgreSQL antes de migrar cuando DB_HOST está definido - docker-compose.yml: unifica nombre de servicio db, añade healthcheck robusto, corrige env_file path a ../.env Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,45 +1,41 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
gitea-db:
|
||||
image: postgres:15
|
||||
# Usará el nombre de tu .env (django_db_local)
|
||||
container_name: ${DB_CONTAINER_NAME:-django_db_dev}
|
||||
restart: always
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
container_name: ${DB_CONTAINER_NAME:-django_core_db}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${DB_NAME:-gitea}
|
||||
POSTGRES_USER: ${DB_USER:-gitea}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-gitea}
|
||||
POSTGRES_DB: ${DB_NAME:-django_core_db}
|
||||
POSTGRES_USER: ${DB_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
# --- ESTO ES LO QUE FALTA ---
|
||||
ports:
|
||||
- "${DATABASE_EXPOSE_PORT:-5432}:5432"
|
||||
# ----------------------------
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-gitea} -d ${DB_NAME:-gitea}"]
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-django_core_db}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
web:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: deployments/Dockerfile
|
||||
container_name: ${APP_CONTAINER_NAME:-django_app_dev}
|
||||
restart: always
|
||||
container_name: ${APP_CONTAINER_NAME:-django_core_app}
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
- ../.env
|
||||
environment:
|
||||
- DEBUG=${DEBUG_MODE:-1}
|
||||
# IMPORTANTE: Este nombre debe coincidir con el nombre del servicio arriba (gitea-db)
|
||||
- DB_HOST=gitea-db
|
||||
- DB_HOST=db
|
||||
- DB_PORT=5432
|
||||
ports:
|
||||
- "${PORT:-8000}:8000"
|
||||
depends_on:
|
||||
gitea-db:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
postgres_data:
|
||||
|
||||
Reference in New Issue
Block a user