OpenCodeHub Incident Runbook
Date: 2026-04-21
Owner: Platform Team
Review frequency: Quarterly
Severity Definitions
| Severity |
Impact |
Response Time |
Examples |
| P0 / Critical |
Full service down, data loss risk, security breach |
15 min, 24/7 |
All instances down, DB corruption, secret leaked |
| P1 / High |
Major feature broken, >10% users affected |
1 hour |
Auth broken, CI queue stuck, storage unavailable |
| P2 / Medium |
Feature degraded, workaround exists |
4 hours |
Slow UI, notifications delayed, intermittent errors |
| P3 / Low |
Minor issue, cosmetic |
Next sprint |
UI glitch, rare 500 errors, minor perf regression |
Incident Response Steps
1. Triage (< 5 min)
# Check health endpoint
curl -s https://your-domain.com/api/health | jq .
# Check error rates
curl -s https://your-domain.com/api/metrics | grep -A5 http_requests_total
# Check recent logs
curl -s https://your-domain.com/api/metrics | grep error
# Check CI queue
curl -s https://your-domain.com/api/metrics | grep ci_queue
# Check active runners
curl -s https://your-domain.com/api/metrics | grep active_runners
2. Assess
3. Mitigate
# Option A: Feature flag disable
kubectl set env deployment/opencodehub FEATURE_X_DISABLED=true
# Option B: Rollback (Docker)
docker run --rm opencodehub/opencodehub:previous-tag
# Update docker-compose.yml with previous tag
docker compose -f docker-compose.production.yml up -d
# Option C: Scale up (if resource issue)
kubectl scale deployment/opencodehub --replicas=5
# Option D: Restart (if memory leak suspected)
kubectl rollout restart deployment/opencodehub
4. Communicate
- Create incident Slack thread in
#incidents
- Update status page at
status.your-domain.com
- Notify affected users within 15 min (P0) or 1 hour (P1)
5. Resolve
- Verify fix with health/metrics checks
- Close incident in
#incidents with summary
- Create postmortem within 48 hours (P0/P1)
Common Scenarios
Scenario 1: App Won't Start
- Check
docker-compose logs -f app
- Verify PostgreSQL is reachable:
docker compose exec postgres pg_isready
- Check Redis is reachable:
docker compose exec redis redis-cli ping
- Verify env vars are set correctly
- Check migrations ran:
docker compose exec app bun run db:migrate
Scenario 2: High Error Rate (5xx)
- Check which endpoints are failing
- Check DB query times
- Check external dependencies (S3, email, etc.)
- Check recent deploys
- Roll back if recent change
Scenario 3: CI Queue Stuck
- Check active runners:
curl -s /api/metrics | grep active_runners
- Check runner logs:
kubectl logs -l runner=true
- Restart runner pods if needed
- Retry stuck jobs via admin API
Scenario 4: Slow Performance
- Check p95/p99 latencies from metrics
- Check DB slow queries:
docker compose exec postgres pg_stat_statements
- Check Redis memory:
docker compose exec redis redis-cli info memory
- Scale horizontally or add caching
- Check for stuck long-running jobs
Scenario 5: Database Connection Exhaustion
- Check DB connections:
docker compose exec postgres psql -c "SELECT count(*) FROM pg_stat_activity"
- Reduce connection pool size in env
- Restart app if needed
- Check for long-running transactions
RTO/RTO Targets
| Scenario |
RTO (Recovery Time Objective) |
RPO (Recovery Point Objective) |
| Full outage |
< 30 min |
< 5 min data loss |
| Data corruption |
< 4 hours |
< 1 hour data loss |
| Security incident |
< 1 hour |
< 0 (preserve evidence) |
Contacts
| Role |
Contact |
| Primary on-call |
Check PagerDuty schedule |
| Backup on-call |
Check PagerDuty schedule |
| DBA (PostgreSQL) |
Check escalation chain |
| Cloud infra |
AWS/GCP support portal |