Operations, Maintenance & Disaster Recovery
This guide provides system operators with procedures for maintaining, troubleshooting, and recovering self-hosted brūhi Cloud instances.
Service Architecture & Health Checks
Section titled “Service Architecture & Health Checks”brūhi Cloud runs as a multi-process container supervised by supervisord, coupled with a Caddy reverse proxy:
┌────────────────────────────────────────────────────────┐│ bruhi-caddy ││ (Port 80, 443 / SSL & HTTP/3 Ingress) │└──────────────────────────┬─────────────────────────────┘ │ Reverse Proxy :8000 ▼┌────────────────────────────────────────────────────────┐│ bruhi-cloud ││ ┌──────────────────────────────────────────────────┐ ││ │ FastAPI Server & SvelteKit UI (:8000) │ ││ └───────────────────────┬──────────────────────────┘ ││ │ localhost:7700 ││ ┌───────────────────────▼──────────────────────────┐ ││ │ bruhi-audio Playout Engine (Daemon) │ ││ └──────────────────────────────────────────────────┘ │└────────────────────────────────────────────────────────┘Automated & Manual Health Checks
Section titled “Automated & Manual Health Checks”# 1. Check container running state and restart countsdocker compose ps
# 2. Query HTTP health check endpointcurl -i http://localhost:8000/healthz# Expected output: HTTP/1.1 200 OK -> {"status":"ok"}
# 3. Verify internal playout engine statusdocker compose exec bruhi-cloud curl -s http://localhost:7700/healthz
# 4. Check live HLS output generation in RAM tmpfsdocker compose exec bruhi-cloud ls -lh /hlsRoutine Updates & Rollback Runbook
Section titled “Routine Updates & Rollback Runbook”Updating brūhi Cloud
Section titled “Updating brūhi Cloud”Production environments configured via install.sh do not use git pull because ~/bruhi-cloud is a standalone configuration directory. Use curl to update definitions:
-
Create Pre-Update Hot Backup
Terminal window cd ~/bruhi-clouddocker compose exec bruhi-cloud sqlite3 /app/data/bruhi.db ".backup '/app/data/pre-update-$(date +%F).db'"docker compose cp bruhi-cloud:/app/data/pre-update-$(date +%F).db ./ -
Refresh Deployment Files & Pull Image
Terminal window curl -fsSL https://raw.githubusercontent.com/bruhi-technologies/bruhi-deploy/main/docker-compose.yml -o docker-compose.ymlcurl -fsSL https://raw.githubusercontent.com/bruhi-technologies/bruhi-deploy/main/Caddyfile -o Caddyfiledocker compose pull -
Recreate Containers with Auto-Migration
Terminal window docker compose up -dFastAPI applies missing SQLite migrations automatically during startup.
-
Verify Operational State
Terminal window docker compose pscurl -f http://localhost:8000/healthzdocker compose logs --tail=50 bruhi-cloud
Rolling Back a Failed Update
Section titled “Rolling Back a Failed Update”If an update introduces a regression or fails to boot:
- Stop the current stack:
Terminal window docker compose down - Pin the previously working container image tag in
docker-compose.yml:image: ghcr.io/bruhi-technologies/bruhi-cloud:v0.22.0 - Restore the pre-update SQLite database:
Terminal window docker compose run --rm -v bruhi-cloud_bruhi_db:/data alpine cp /data/pre-update-*.db /data/bruhi.db - Restart the stack:
Terminal window docker compose up -d
Disaster Recovery & Backup Restoration
Section titled “Disaster Recovery & Backup Restoration”Restoring from Database Backup
Section titled “Restoring from Database Backup”To restore a saved SQLite backup file (bruhi-backup.db) into the running container:
-
Stop Application Container
Terminal window docker compose stop bruhi-cloud -
Replace Database File in Docker Volume
Terminal window docker run --rm \-v bruhi-cloud_bruhi_db:/data \-v $(pwd):/backup \alpine cp /backup/bruhi-backup.db /data/bruhi.db -
Verify SQLite Integrity
Terminal window docker run --rm \-v bruhi-cloud_bruhi_db:/data \alpine sqlite3 /data/bruhi.db "PRAGMA integrity_check;"# Expected output: ok -
Restart Stack
Terminal window docker compose start bruhi-cloud
Operational Recovery Runbook
Section titled “Operational Recovery Runbook”1. Storage Exhaustion (Disk 100% Full)
Section titled “1. Storage Exhaustion (Disk 100% Full)”Symptom: Recordings fail to save, SQLite writes fail with disk I/O error, or Docker crashes.
Recovery Steps:
- Check disk utilization:
Terminal window df -h /docker system df - Prune obsolete Docker images and build caches:
Terminal window docker image prune -a --filter "until=72h" -f - Remove old segment recordings from the audio volume:
Terminal window docker compose exec bruhi-cloud find /app/audio_files/recordings -name "*.part" -mtime +2 -delete - Configure S3 Object Storage offloading in Admin Dashboard → Storage & Maintenance to prevent local disk exhaustion.
2. Database Locks & WAL Bloat
Section titled “2. Database Locks & WAL Bloat”Symptom: Logs show sqlite3.OperationalError: database is locked or database disk image is malformed.
Recovery Steps:
- Force a WAL checkpoint to truncate journal logs:
Terminal window docker compose exec bruhi-cloud sqlite3 /app/data/bruhi.db "PRAGMA wal_checkpoint(TRUNCATE);" - Check database integrity:
Terminal window docker compose exec bruhi-cloud sqlite3 /app/data/bruhi.db "PRAGMA integrity_check;" - If corruption is detected, dump and rebuild:
Terminal window docker compose exec bruhi-cloud sqlite3 /app/data/bruhi.db ".dump" | docker compose exec -T bruhi-cloud sqlite3 /app/data/bruhi-repaired.dbdocker compose run --rm -v bruhi-cloud_bruhi_db:/data alpine mv /data/bruhi-repaired.db /data/bruhi.dbdocker compose restart bruhi-cloud
3. Audio Playout Engine Lockup or Dead Air
Section titled “3. Audio Playout Engine Lockup or Dead Air”Symptom: Studio displays “Connecting to Audio Engine” or listener stream goes silent.
Recovery Steps:
- Check if the internal audio daemon is running:
Terminal window docker compose exec bruhi-cloud ps aux | grep bruhi-audio - Query the audio engine status directly:
Terminal window docker compose exec bruhi-cloud curl -s http://localhost:7700/healthz - Restart only the
bruhi-cloudcontainer without tearing down network volumes:Terminal window docker compose restart bruhi-cloud
Incident Escalation: What Information to Collect
Section titled “Incident Escalation: What Information to Collect”Before escalating an outage or opening an issue on GitHub, capture the following diagnostics:
# 1. Collect container statuses and restart countsdocker compose ps > incident-report.txt
# 2. Collect recent application error logsdocker compose logs --tail=200 bruhi-cloud >> incident-report.txt
# 3. Collect reverse proxy access & SSL logsdocker compose logs --tail=100 caddy >> incident-report.txt
# 4. Record host resource metricsuptime >> incident-report.txtfree -m >> incident-report.txtdf -h >> incident-report.txt
# 5. Check database integritydocker compose exec bruhi-cloud sqlite3 /app/data/bruhi.db "PRAGMA integrity_check;" >> incident-report.txt