64 lines
1.6 KiB
Markdown
64 lines
1.6 KiB
Markdown
|
|
# Health Check Configuration — ERP Nutzfahrzeuge
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Health Endpoint
|
||
|
|
|
||
|
|
**URL:** `GET /api/v1/health`
|
||
|
|
|
||
|
|
**Expected response:**
|
||
|
|
- HTTP Status: `200 OK`
|
||
|
|
- Body: `{"status":"ok"}`
|
||
|
|
|
||
|
|
**No authentication required.**
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Coolify Health Check
|
||
|
|
|
||
|
|
Configure in Coolify resource settings:
|
||
|
|
|
||
|
|
| Setting | Value |
|
||
|
|
|---------|-------|
|
||
|
|
| Health check path | `/api/v1/health` |
|
||
|
|
| Health check port | `8000` |
|
||
|
|
| Health check interval | `30s` (recommended) |
|
||
|
|
| Health check timeout | `5s` (recommended) |
|
||
|
|
| Health check retries | `3` (recommended) |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Additional Monitoring Endpoints
|
||
|
|
|
||
|
|
| Endpoint | Method | Auth | Purpose |
|
||
|
|
|----------|--------|------|---------|
|
||
|
|
| `/` | GET | No | Root info — returns app name, version, docs URL |
|
||
|
|
| `/openapi.json` | GET | No | OpenAPI schema — useful for API monitoring |
|
||
|
|
| `/docs` | GET | No | Swagger UI (disable in production via `APP_ENV=production` if needed) |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Docker Compose Health Check
|
||
|
|
|
||
|
|
If using Docker Compose, add to the backend service:
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health"]
|
||
|
|
interval: 30s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 3
|
||
|
|
start_period: 10s
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
| Symptom | Likely Cause | Action |
|
||
|
|
|---------|-------------|--------|
|
||
|
|
| Health check returns 502 | Backend not started or crashed | Check container logs, verify `DATABASE_URL` is reachable |
|
||
|
|
| Health check returns 503 | App startup in progress | Increase `start_period` in health check config |
|
||
|
|
| Health check times out | Network/firewall issue | Verify port mapping and firewall rules |
|
||
|
|
| Health check returns 500 | Internal error (DB connection, config) | Check application logs for traceback |
|