Operations Guide
Health Checks
The backend exposes /healthz for liveness and /readyz for readiness:
bash
curl http://localhost:8080/healthz
curl http://localhost:8080/readyzThrough nginx (TLS):
bash
curl -k https://localhost/healthzLogs
bash
# All services
make prod-logs
# Specific service
docker logs -f umoo-backend
docker logs -f umoo-postgres
docker logs -f umoo-nginxThe backend outputs structured JSON logs in production (UMOO_LOG_FORMAT=json).
Monitoring
NATS
NATS monitoring is available at http://localhost:8222:
bash
curl http://localhost:8222/varz # Server variables
curl http://localhost:8222/connz # Connection info
curl http://localhost:8222/routez # Route info
curl http://localhost:8222/subsz # Subscription infoPostgreSQL
Check connection pool and active queries:
bash
docker exec umoo-postgres psql -U umoo -d umoo -c \
"SELECT pid, state, query_start, query FROM pg_stat_activity WHERE datname='umoo';"Redis
bash
docker exec umoo-redis redis-cli -a $REDIS_PASSWORD INFO memory
docker exec umoo-redis redis-cli -a $REDIS_PASSWORD INFO clientsBackup and Restore
PostgreSQL Backup
bash
docker exec umoo-postgres pg_dump -U umoo umoo > backup_$(date +%Y%m%d_%H%M%S).sqlPostgreSQL Restore
bash
docker exec -i umoo-postgres psql -U umoo umoo < backup_20260101_120000.sqlRedis Backup
Redis is configured with AOF persistence. Data is stored in the redis_data volume.
bash
docker exec umoo-redis redis-cli -a $REDIS_PASSWORD BGSAVE
docker cp umoo-redis:/data/dump.rdb ./redis_backup_$(date +%Y%m%d).rdbTroubleshooting
Service Won't Start
bash
# Check container status
docker ps -a | grep umoo
# Check recent logs
docker logs --tail 50 umoo-backend
# Verify dependencies are healthy
docker inspect --format='{{.State.Health.Status}}' umoo-postgres
docker inspect --format='{{.State.Health.Status}}' umoo-redis
docker inspect --format='{{.State.Health.Status}}' umoo-nats-1Database Connection Issues
bash
# Test connectivity from backend container
docker exec umoo-backend sh -c 'nc -z postgres 5432 && echo OK || echo FAIL'
# Check PostgreSQL max connections
docker exec umoo-postgres psql -U umoo -c "SHOW max_connections;"
docker exec umoo-postgres psql -U umoo -c "SELECT count(*) FROM pg_stat_activity;"NATS Cluster Problems
bash
# Check cluster routes
curl -s http://localhost:8222/routez | python3 -m json.tool
# Verify all nodes see each other
for port in 8222; do
echo "Node on $port:"
curl -s "http://localhost:$port/routez" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f' Routes: {d[\"num_routes\"]}')"
doneRate Limiting
If clients receive HTTP 429 responses, check the rate limit configuration:
- Nginx:
limit_req_zoneinnginx.conf(default 100r/s per IP) - Application: Per-tenant rate limiting via Redis (configurable per tenant)
Graceful Shutdown
The backend supports graceful drain. On SIGTERM:
- Health endpoint returns unhealthy (nginx stops routing)
- In-flight requests complete (30s timeout)
- WebSocket connections drain
- Database and Redis connections close
- Process exits
bash
# Graceful restart
docker restart umoo-backend
# Or via compose
make prod-down && make prod-upResource Monitoring
bash
docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}"