انتقل إلى المحتوى الرئيسي

Health Check Endpoints

Monitor application health status.

Endpoint

GET /api/health

No authentication required. Returns application health status.

Response

{
"status": "ok",
"info": {
"database": { "status": "up" },
"redis": { "status": "up" },
"memory": { "status": "up", "rss": "256MB" }
},
"error": {},
"details": {
"database": { "status": "up" },
"redis": { "status": "up" }
}
}

Health Indicators

IndicatorChecksCritical
DatabasePostgreSQL connection aliveYes
RedisRedis connection aliveYes
MemoryRSS below thresholdNo
DiskDisk space availableNo

Status Codes

HTTP CodeStatusDescription
200HealthyAll indicators up
503UnhealthyOne or more indicators down

Usage in Docker

healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s

Usage in Kubernetes

livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 30
periodSeconds: 10

readinessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 5
periodSeconds: 5