- Overview
- Manual Backups
- Automated Backups (macOS)
- Restoring from Backup
- Backup Rotation
- Troubleshooting
- FAQ
This backup solution protects your Torrent VPN Stack configuration and data through automated or manual backups.
- qBittorrent Configuration: Settings, web UI preferences, RSS feeds, filters
- Gluetun Configuration: VPN settings, firewall rules (if stored in volume)
- Prometheus Data (optional): Metrics history
- Grafana Data (optional): Dashboards, datasources, users
- Location:
~/backups/torrent-vpn-stack/(configurable via.env) - Format: Compressed tar.gz archives with timestamps
- Naming:
{volume}-config-YYYY-MM-DD-HHMMSS.tar.gz - Retention: Last 7 days by default (configurable)
# Run backup script
./scripts/backup.sh
# View what would be backed up (dry-run)
./scripts/backup.sh --dry-run
# Verbose output
./scripts/backup.sh --verboseEdit .env to customize backup behavior:
# Backup directory
BACKUP_DIR=~/backups/torrent-vpn-stack
# Retention period (days)
BACKUP_RETENTION_DAYS=7
# Volumes to backup (comma-separated)
BACKUP_VOLUMES=qbittorrent,gluetun[INFO] Starting Torrent VPN Stack Backup...
[INFO] Creating backup directory: /Users/you/backups/torrent-vpn-stack
[INFO] Backing up torrent-vpn-stack_qbittorrent-config...
[INFO] ✓ Backup created: qbittorrent-config-2026-01-03-150000.tar.gz (2.3M)
[INFO] Backing up torrent-vpn-stack_gluetun-config...
[INFO] ✓ Backup created: gluetun-config-2026-01-03-150000.tar.gz (45K)
[INFO] Rotating old backups (keeping last 7 days)...
[INFO] ✓ Deleted 2 old backup(s)
[INFO] ✓ Backup completed successfully!
Run the setup script to schedule daily backups:
# Setup with default schedule (3 AM daily)
./scripts/setup-backup-automation.sh
# Customize backup time (24-hour format)
./scripts/setup-backup-automation.sh --hour 2 # 2 AM- Creates launchd plist in
~/Library/LaunchAgents/ - Schedules daily backup at specified hour
- Logs output to
~/Library/Logs/torrent-vpn-stack-backup.log - Automatically rotates old backups
# Check if job is loaded
launchctl list | grep torrent-vpn-stack
# Manually trigger backup to test
launchctl start com.torrent-vpn-stack.backup
# View logs
tail -f ~/Library/Logs/torrent-vpn-stack-backup.log./scripts/remove-backup-automation.sh# List available backups
./scripts/restore.sh --list
# Interactive restore (select from list)
./scripts/restore.sh# Restore specific backup
./scripts/restore.sh --backup qbittorrent-config-2026-01-03-030000.tar.gz
# Dry-run to preview
./scripts/restore.sh --backup qbittorrent-config-2026-01-03-030000.tar.gz --dry-run
# Skip confirmation (use with caution!)
./scripts/restore.sh --backup qbittorrent-config-2026-01-03-030000.tar.gz --no-confirm- Safety Backup: Creates backup of current state before restore
- Stop Container: Stops affected container (qbittorrent, gluetun, etc.)
- Clear Volume: Removes existing data from Docker volume
- Extract Backup: Extracts backup archive to volume
- Restart Container: Starts container with restored data
- Automatic Safety Backup: Current state backed up before restore
- Confirmation Prompt: Requires explicit "yes" to proceed
- Dry-Run Mode: Preview actions without making changes
- Container Management: Automatically stops/starts containers
Old backups are automatically deleted based on retention policy.
- Runs after each backup
- Deletes backups older than
BACKUP_RETENTION_DAYS - Keeps backups from last N days
- Applies per-volume (qbittorrent backups independent of gluetun backups)
With BACKUP_RETENTION_DAYS=7:
- Daily backups at 3 AM
- After 7 days, oldest backup is deleted
- Always have 7 days of backup history
# Delete all backups older than 30 days
find ~/backups/torrent-vpn-stack -name "*.tar.gz" -mtime +30 -delete
# Delete specific volume backups
rm ~/backups/torrent-vpn-stack/qbittorrent-config-*.tar.gzSymptoms: Backup script exits with error
Diagnosis:
# Check Docker is running
docker ps
# Verify volumes exist
docker volume ls | grep torrent-vpn-stack
# Check disk space
df -h ~/backupsSolutions:
- Start Docker Desktop
- Start stack:
docker compose up -d - Free up disk space if needed
Symptoms: Restore fails with "volume not found" error
Solution: Start the stack first to create volumes:
docker compose up -dThen retry restore.
Symptoms: No backups created automatically
Diagnosis:
# Check if job is loaded
launchctl list | grep torrent-vpn-stack
# View logs
cat ~/Library/Logs/torrent-vpn-stack-backup.log
cat ~/Library/Logs/torrent-vpn-stack-backup-error.logSolutions:
-
Reload job:
launchctl unload ~/Library/LaunchAgents/com.torrent-vpn-stack.backup.plist launchctl load ~/Library/LaunchAgents/com.torrent-vpn-stack.backup.plist
-
Check script permissions:
chmod +x ./scripts/backup.sh
-
Manually test:
launchctl start com.torrent-vpn-stack.backup
Symptoms: Backup runs for many minutes
Cause: Large downloads directory or Prometheus data
Solutions:
-
Exclude large volumes:
# In .env BACKUP_VOLUMES=qbittorrent,gluetun # Don't backup prometheus, grafana
-
Reduce Prometheus retention: Edit
docker-compose.yml:prometheus: command: - '--storage.tsdb.retention.time=7d' # Reduce from 30d
A: Yes, the backup script creates read-only snapshots and doesn't interrupt running containers.
A:
- Volume Backup (this solution): Backs up Docker volumes containing config
- File Backup: Would backup
~/Downloads/torrents(user responsibility)
Note: Downloaded torrent files are NOT backed up automatically. Back up DOWNLOADS_PATH separately if needed.
A: Yes, set BACKUP_DIR to mounted network drive:
BACKUP_DIR=/Volumes/NAS/backups/torrent-vpn-stackA:
- Run manual backup:
./scripts/backup.sh - Copy
~/backups/torrent-vpn-stack/to new system - Install stack on new system
- Restore backups:
./scripts/restore.sh
A: Not built-in. For encryption:
# After backup, encrypt with GPG
gpg --symmetric ~/backups/torrent-vpn-stack/qbittorrent-config-*.tar.gz
# Decrypt before restore
gpg --decrypt backup.tar.gz.gpg > backup.tar.gzA: No automatic recovery. Best practices:
- Keep multiple retention days
- Sync backups to cloud storage
- Test restores periodically
A: Typical sizes:
- qBittorrent config: 1-5 MB
- Gluetun config: < 100 KB
- Prometheus (30 days): 2-3 GB
- Grafana: 50-100 MB
With 7-day retention: ~500 MB total (excluding Prometheus)
- Docker Volume Backup: https://docs.docker.com/storage/volumes/#back-up-restore-or-migrate-data-volumes
- macOS launchd: https://www.launchd.info/
- Cron Alternative (Linux): Use crontab instead of launchd
Need Help? Check the main troubleshooting guide or open an issue on GitHub.