Files
willhaben-tracker/docker-compose.yml
T
hermes f540cbe7ef feat(phase-0): stability hardening — search path fix, auto-migrations, graceful shutdown, health endpoint
- Remove SET search_path from db.py and migration SQL (Supabase uses public schema)
- Add migrate.py with tracking table for forward-only SQL migrations
- Add entrypoint.sh: waits for DB, runs migrations, then starts app
- Copy 01-schema.sql + zz-seed.sql to worker/src/migrations/
- Add health.py: /health endpoint (200/503) with DB connectivity + scheduler staleness checks
  - /stats endpoint with keyword/ad/notification counts
- Rewrite main.py shutdown sequence: signal handler, 5s grace for scheduler, ordered cleanup
- Update Dockerfile: HEALTHCHECK directive, entrypoint, COPY migrations
- Update docker-compose.yml: stop_grace_period=15s, healthcheck config, env vars
- Add aiohttp>=3.9 to requirements.txt for health server
2026-07-04 11:30:45 -04:00

28 lines
835 B
YAML

services:
worker:
build: ./worker
restart: unless-stopped
env_file:
- .env
environment:
# Health check port (exposed to host for docker healthcheck)
- HEALTH_PORT=8765
# Scheduler staleness threshold in seconds
- HEALTHCHECK_SCHEDULER_STALE_S=300
networks:
- supabase_default
# Graceful shutdown timeout — Docker sends SIGTERM, container has this long to clean up.
stop_grace_period: 15s
# Docker healthcheck (uses the in-container aiohttp server)
healthcheck:
test: ["CMD", "python", "-c",
"import httpx,os; r=httpx.get(f'http://localhost:{os.getenv(\"HEALTH_PORT\",\"8765\")}/health'); r.raise_for_status()"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
networks:
supabase_default:
external: true