Incident Runbook
OpenCodeHub Incident Runbook
Section titled “OpenCodeHub Incident Runbook”Date: 2026-04-21 Owner: Platform Team Review frequency: Quarterly
Severity Definitions
Section titled “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
Section titled “Incident Response Steps”1. Triage (< 5 min)
Section titled “1. Triage (< 5 min)”# Check health endpointcurl -s https://your-domain.com/api/health | jq .
# Check error ratescurl -s https://your-domain.com/api/metrics | grep -A5 http_requests_total
# Check recent logscurl -s https://your-domain.com/api/metrics | grep error
# Check CI queuecurl -s https://your-domain.com/api/metrics | grep ci_queue
# Check active runnerscurl -s https://your-domain.com/api/metrics | grep active_runners2. Assess
Section titled “2. Assess”- What is the scope? (single user, single repo, all users)
- What broke? (new deploy, dependency, external service)
- Is there a workaround?
- Check recent deploys:
kubectl rollout history deployment/opencodehub
3. Mitigate
Section titled “3. Mitigate”# Option A: Feature flag disablekubectl set env deployment/opencodehub FEATURE_X_DISABLED=true
# Option B: Rollback (Docker)docker run --rm swadhinbiswas/opencodehub:previous-tag# Update docker-compose.yml with previous tagdocker 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/opencodehub4. Communicate
Section titled “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
Section titled “5. Resolve”- Verify fix with health/metrics checks
- Close incident in
#incidentswith summary - Create postmortem within 48 hours (P0/P1)
Common Scenarios
Section titled “Common Scenarios”Scenario 1: App Won’t Start
Section titled “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)
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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 |