manage.py check booted a full Django interpreter every 30s (~1.5s CPU per run) and never verified the server was actually responding. Probe the HTTP endpoint directly instead and relax the interval.
65 lines
1.4 KiB
YAML
65 lines
1.4 KiB
YAML
services:
|
|
redis:
|
|
image: redis:8-alpine
|
|
restart: unless-stopped
|
|
expose:
|
|
- "6379"
|
|
volumes:
|
|
- ./redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 3
|
|
|
|
django:
|
|
build: .
|
|
restart: unless-stopped
|
|
expose:
|
|
- "8000"
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
volumes:
|
|
- .:/app
|
|
command: ./entrypoint.sh
|
|
healthcheck:
|
|
test: ["CMD", "python3", "-c", "import http.client; c=http.client.HTTPConnection('localhost',8000,timeout=5); c.request('GET','/'); exit(0 if c.getresponse().status<400 else 1)"]
|
|
interval: 2m
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
huey:
|
|
build: .
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
django:
|
|
condition: service_healthy
|
|
volumes:
|
|
- .:/app
|
|
command: python manage.py run_huey
|
|
restart: unless-stopped
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${NGINX_PORT:-8080}:80"
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
django:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
healthcheck:
|
|
test: ["CMD", "nginx", "-t"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|