# Example Backup Configuration # # This file demonstrates the complete backup configuration format # Copy and adapt for your specific backup needs version = "1.0" name = "my-backup" description = "Example multi-target backup configuration" # Choose backend: restic, borg, tar, cpio, or rsync backend = "restic" # Repository configuration [repository] # Repository type: local, s3, sftp, rest, or b2 type = "local" # Path or URL to repository path = "/mnt/backups/my-app" # Password file for encrypted repositories password_file = "/etc/backup/restic-password" # Environment variables for the backend [repository.env_vars] # Example for S3: # AWS_ACCESS_KEY_ID = "AKIAIOSFODNN7EXAMPLE" # AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" # Additional backend-specific options [repository.options] # Example options depend on the backend being used # Define backup targets [[targets]] name = "app-data" paths = [ "/var/lib/my-app", "/etc/my-app" ] # Glob patterns to exclude from backup excludes = [ "*.tmp", ".cache/*", "node_modules/*" ] # Tags to apply to this backup tags = ["production", "daily"] # Commands to run before backup pre_hooks = [ "systemctl stop my-app", "mysqldump -u root my-database > /tmp/db.sql" ] # Commands to run after backup post_hooks = [ "rm /tmp/db.sql", "systemctl start my-app" ] [[targets]] name = "web-content" paths = [ "/var/www/html", "/var/www/uploads" ] excludes = [ "*.temp", "cache/*", ".git/*" ] tags = ["web"] [[targets]] name = "configs" paths = [ "/etc", "/opt/app" ] excludes = [ "/etc/ssl/private", "/etc/shadow" ] tags = ["system"] # Retention policy - how long to keep snapshots [retention] # Keep last N snapshots keep_last = 10 # Keep hourly snapshots for N hours (optional) # keep_hourly = 24 # Keep daily snapshots for N days keep_daily = 7 # Keep weekly snapshots for N weeks keep_weekly = 4 # Keep monthly snapshots for N months keep_monthly = 12 # Keep yearly snapshots for N years keep_yearly = 5 # Tags to always preserve keep_tags = ["important", "release"] # Schedule configuration for automated backups [schedule] # Enable/disable scheduling enabled = true # Cron expression (standard format: minute hour day month weekday) # Examples: # "0 2 * * *" = 2 AM every day # "0 */6 * * *" = Every 6 hours # "0 1 * * 0" = 1 AM every Sunday # "30 2 1 * *" = 2:30 AM on 1st of every month cron = "0 2 * * *" # Init system: auto, systemd, launchd, cron, or openrc init_system = "systemd" # Action on failure: notify, retry, or ignore on_failure = "notify" # Pre and post backup hooks [hooks] # Commands to run before any backup pre_backup = [ "echo 'Backup starting at $(date)'" ] # Commands to run after successful backup post_backup = [ "echo 'Backup completed successfully'" ] # Commands to run on backup failure on_error = [ "mail -s 'Backup failed' admin@example.com <<< 'Backup operation failed at $(date)'" ] # Notification configuration [notifications] # Enable/disable notifications enabled = true # Send notification on successful backup on_success = false # Send notification on backup failure on_failure = true # Command to execute for notifications # Examples: # "mail -s 'Backup result' admin@example.com" # "curl -X POST https://hooks.slack.com/..." # "logger -t backup" command = "mail -s 'Backup alert' admin@example.com"