Skip to content

Database Backups & Disaster Recovery ​

RUSEON Core maintains all operational state (camera configurations, user accounts, folder structures, webhook subscriptions, and archive catalog indices) inside an embedded BadgerDB v4 database.

This guide details creating atomic database backups, scheduling automated snapshots, and executing disaster recovery procedures.


1. What is Stored in Backups ​

  • Camera Registry: RTSP URLs, ONVIF credentials, stream profiles, and recording rules.
  • Access & Security: User accounts, hashed passwords, API tokens, and role assignments.
  • Organization: Camera folder hierarchies and tag taxonomies.
  • Archive Catalog: Timeline index intervals and recording file references.

(Note: Raw fMP4 video recordings are stored as independent filesystem files in /app/recordings and should be replicated using filesystem snapshots or rsync).


2. Manual Backup with ruseon-cli ​

Execute an atomic database dump without stopping the running server:

bash
# Create an atomic backup snapshot
ruseon-cli backup create \
  --config /etc/ruseon/config.yaml \
  --output /var/lib/ruseon/backups/ruseon_backup_$(date +%Y%m%d_%H%M%S).bak

3. Automated Daily Cron Backup ​

Add a scheduled cron job to /etc/cron.d/ruseon-backup:

cron
# Run daily database backup at 03:00 UTC and delete backups older than 30 days
0 3 * * * ruseon /opt/ruseon/bin/ruseon-cli backup create --config /etc/ruseon/config.yaml --output /var/lib/ruseon/backups/backup_$(date +\%Y\%m\%d).bak && find /var/lib/ruseon/backups/ -name "backup_*.bak" -mtime +30 -delete

4. Disaster Recovery Procedure ​

To restore a database snapshot onto a fresh or recovered host:

bash
# 1. Stop the RUSEON service
sudo systemctl stop ruseon

# 2. Restore the database from snapshot
ruseon-cli backup restore \
  --config /etc/ruseon/config.yaml \
  --input /var/lib/ruseon/backups/ruseon_backup_20260814.bak

# 3. Start the RUSEON service
sudo systemctl start ruseon

# 4. Verify system state via health probe
curl http://localhost:8080/readyz

Released under the MIT License.