Files
foxhunt/docs/runbooks/disaster-recovery.md
jgrusewski 7458f1be01 feat(wave12): E2E validation complete - 225-feature pipeline ready
 Validation Results:
- PPO training: 24.2s (1 epoch, 950 samples, dim=225)
- Feature extraction: 105μs/bar (9.5x faster than target)
- Model checkpoint: 293KB (147KB actor + 146KB critic)
- GPU memory: 145MB used (96.4% headroom)
- Zero dimension mismatches

📊 Success Criteria (5/5):
 Feature dimension = 225 (Wave C 201 + Wave D 24)
 Model state_dim = 225
 Training completed without errors
 Checkpoint saved successfully
 No dimension mismatch errors

📁 Training Data Ready:
- ES.FUT: 2.9MB, 180 days
- NQ.FUT: 4.4MB, 180 days
- 6E.FUT: 2.8MB, 180 days
- ZN.FUT: 65KB, 90 days (clean)

🚀 Next: Full production model retraining (4 models, ~10min GPU time)

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 22:48:04 +02:00

3.6 KiB

Disaster Recovery Runbook

Last Updated: 2025-10-22 RTO (Recovery Time Objective): 4 hours RPO (Recovery Point Objective): 1 hour


Disaster Scenarios

Scenario Probability Impact Recovery Strategy
Single node failure High Low Auto-recovery via K8s
Availability zone outage Medium Medium Multi-AZ failover
Region-wide outage Low High Multi-region DR
Database corruption Low High Point-in-time recovery
Ransomware attack Very Low Critical Offline backups

Backup Strategy

Daily Backups

# PostgreSQL daily backup (automated via CronJob)
cat > postgres-backup-cronjob.yaml << 'PBEOF'
apiVersion: batch/v1
kind: CronJob
metadata:
  name: postgres-backup
  namespace: foxhunt
spec:
  schedule: "0 3 * * *"  # 3 AM daily
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: backup
            image: postgres:15
            command:
            - /bin/sh
            - -c
            - |
              pg_dump -U foxhunt -h foxhunt-postgresql -d foxhunt -Fc > /backup/foxhunt_$(date +\%Y\%m\%d).dump
              aws s3 cp /backup/foxhunt_$(date +\%Y\%m\%d).dump s3://foxhunt-backups/daily/
            env:
            - name: PGPASSWORD
              valueFrom:
                secretKeyRef:
                  name: foxhunt-secrets
                  key: database-password
            volumeMounts:
            - name: backup
              mountPath: /backup
          volumes:
          - name: backup
            emptyDir: {}
          restartPolicy: OnFailure
PBEOF

kubectl apply -f postgres-backup-cronjob.yaml

Backup Verification

# List backups
aws s3 ls s3://foxhunt-backups/daily/ | tail -10

# Test restore (monthly)
aws s3 cp s3://foxhunt-backups/daily/foxhunt_20251022.dump /tmp/
kubectl exec -i -n foxhunt foxhunt-postgresql-test-0 -- \
    pg_restore -U foxhunt -d foxhunt_test -c < /tmp/foxhunt_20251022.dump

# Verify record count matches

Multi-Region DR Setup

Primary Region: us-east-1

DR Region: us-west-2

# Set up replication (AWS RDS example)
aws rds create-db-instance-read-replica \
    --db-instance-identifier foxhunt-postgres-dr \
    --source-db-instance-identifier foxhunt-postgres \
    --db-instance-class db.r5.2xlarge \
    --region us-west-2

# Monitor replication lag
aws rds describe-db-instances \
    --db-instance-identifier foxhunt-postgres-dr \
    --region us-west-2 \
    --query 'DBInstances[0].StatusInfos'

Failover Procedure (Regional Outage)

# 1. Promote DR database to primary
aws rds promote-read-replica \
    --db-instance-identifier foxhunt-postgres-dr \
    --region us-west-2

# 2. Update DNS to point to DR region
aws route53 change-resource-record-sets \
    --hosted-zone-id Z1234567890ABC \
    --change-batch '{ 
        "Changes": [{
            "Action": "UPSERT",
            "ResourceRecordSet": {
                "Name": "api.foxhunt.example.com",
                "Type": "A",
                "AliasTarget": {
                    "HostedZoneId": "Z2WEST",
                    "DNSName": "foxhunt-dr-alb.us-west-2.elb.amazonaws.com",
                    "EvaluateTargetHealth": true
                }
            }
        }]
    }'

# 3. Deploy application to DR region
kubectl config use-context foxhunt-dr-us-west-2
helm install foxhunt ./helm/foxhunt \
    --namespace foxhunt \
    --values values-dr.yaml \
    --wait

# 4. Verify DR system operational
curl -sf https://api.foxhunt.example.com/health

End of Disaster Recovery Runbook