services: db: image: postgres:16-alpine restart: unless-stopped volumes: - postgres_data:/var/lib/postgresql/data environment: POSTGRES_DB: ${SQL_DATABASE:-busmanager} POSTGRES_USER: ${SQL_USER:-busmanager} POSTGRES_PASSWORD: ${SQL_PASSWORD} healthcheck: test: ["CMD-SHELL", "pg_isready -U ${SQL_USER:-busmanager}"] interval: 5s timeout: 5s retries: 5 web: build: . restart: unless-stopped env_file: .env ports: - "${APP_PORT:-8000}:8000" depends_on: db: condition: service_healthy environment: SQL_HOST: db SQL_PORT: 5432 STATIC_ROOT: /app/staticfiles volumes: - static_files:/app/staticfiles # Runs the nightly coordinator status check (django-crontab job) cron: build: . restart: unless-stopped env_file: .env entrypoint: > sh -c "echo '0 6 * * * python /app/manage.py nightly_check_active_status >> /proc/1/fd/1 2>&1' | crontab - && crond -f -d 8" depends_on: db: condition: service_healthy environment: SQL_HOST: db SQL_PORT: 5432 volumes: postgres_data: static_files: