chore(prod): startup migrations, readiness checks and backend healthcheck

- add backend entrypoint that can run alembic upgrade head on startup
- add RUN_MIGRATIONS_ON_STARTUP setting and compose wiring
- add /health/live and /health/ready endpoints with db+redis checks
- add backend container healthcheck against readiness endpoint
- document readiness and startup migration behavior
This commit is contained in:
2026-03-08 02:50:57 +03:00
parent 74d9163dde
commit df79a70baf
6 changed files with 61 additions and 3 deletions

View File

@@ -38,12 +38,17 @@ Run full stack (web + api + worker + postgres + redis + minio + mailpit):
1. cp .env.docker.example .env
2. edit `.env` (`SECRET_KEY`, passwords, domain, `S3_PUBLIC_ENDPOINT_URL`)
3. docker compose up -d --build
2. Open:
4. check backend readiness:
- `http://localhost:8000/health/live`
- `http://localhost:8000/health/ready`
5. Open:
- Web: http://localhost
- API docs: http://localhost:8000/docs
- Mailpit UI: http://localhost:8025
- MinIO console: http://localhost:9001
`RUN_MIGRATIONS_ON_STARTUP=true` (default in compose) runs `alembic upgrade head` before backend start.
### Production Mode
Use production override to close internal ports (postgres/redis/minio/mailpit/backend):