Skip to content

feat(backup): 3-2-1 backup strategy with multi-target support#400

Open
Heykool wants to merge 1 commit intoillbnm:masterfrom
Heykool:feat/backup-dr-3-2-1
Open

feat(backup): 3-2-1 backup strategy with multi-target support#400
Heykool wants to merge 1 commit intoillbnm:masterfrom
Heykool:feat/backup-dr-3-2-1

Conversation

@Heykool
Copy link
Copy Markdown

@Heykool Heykool commented Mar 31, 2026

Summary

Implements the 3-2-1 backup strategy for the homelab-stack as described in issue #12.

What was implemented

scripts/backup.sh — Full-featured backup script with:

  • — backup all stacks or media-only
  • — preview what would be backed up
  • — restore from any backup
  • — list available backups
  • — verify backup integrity
  • Multi-target support:
  • Docker volumes + configs + databases backup
  • ntfy push notifications on success/failure
  • Backup manifest with metadata
  • Retention policy ()
  • Existing was completely rewritten; still works standalone

docs/disaster-recovery.md — Complete DR guide with:

  • Full restore procedure (fresh host from scratch)
  • Service restore order: Base → Databases → SSO → Monitoring → Storage → Network → Applications
  • RTO estimates (full restore: 2–4h, volume only: 30–60min, single service: 5–15min)
  • Verification checklist (base infra, DBs, SSO, monitoring, storage, media, notifications)
  • Configuration guide for all backup targets (S3/MinIO, Backblaze B2, SFTP, Cloudflare R2)
  • systemd timer + crontab setup instructions

systemd/ — Daily 2:00 AM automation:

  • — runs at 02:00 with 15min jitter
  • — runs the backup script

.env.example — Added backup configuration section:

  • , ,
  • ,
  • AWS/B2/SFTP credential variables

Acceptance Criteria

  • backup.sh --target all backs up all volumes, configs, and databases
  • backup.sh --target media backs up media volumes only
  • --dry-run previews without writing
  • --restore <id> performs full restore
  • --list shows available backups
  • --verify validates backup integrity
  • Local, S3, B2, SFTP, R2 targets supported via .env
  • Daily 2:00 AM timer/systemd schedule
  • ntfy notifications on backup success/failure
  • DR docs with restore procedure, service order, RTO, verification checklist
  • New files documented in README updates

Testing

# Dry run
./scripts/backup.sh --target all --dry-run

# List backups
./scripts/backup.sh --list

# Enable daily timer
sudo cp systemd/*.service /etc/systemd/system/
sudo systemctl enable --now homelab-backup.timer

Bounty

- scripts/backup.sh: Full backup script with:
  - --target all|media for selective backups
  - --dry-run preview mode
  - --restore <backup_id> for full restore
  - --list and --verify modes
  - Support for BACKUP_TARGET=local|s3|b2|sftp|r2
  - Docker volumes, configs, and databases backup
  - ntfy notifications on success/failure
  - Retention policy (BACKUP_RETENTION_DAYS)
  - Restic-compatible manifest

- docs/disaster-recovery.md: Complete DR guide with:
  - Full restore procedure (new host from scratch)
  - Service restore order (Base → DB → SSO → others)
  - RTO estimates per scenario
  - Verification checklist
  - Backup target configuration guide
  - systemd timer + crontab setup instructions

- systemd/: Timer (daily 2:00 AM) + service files

- .env.example: Backup configuration variables

Closes illbnm#12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant