-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrestic-helpers.template.yaml
More file actions
215 lines (189 loc) · 7.09 KB
/
restic-helpers.template.yaml
File metadata and controls
215 lines (189 loc) · 7.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Restic Helpers Configuration Template
# Copy this file to restic-helpers.yaml and customize for your setup
#
# For password management:
# 1. Set password directly: password: "your-password"
# 2. Use environment variable: password_env: "MY_PASSWORD_VAR"
# 3. Use .env file: Create .env or .env.local with RESTIC_PASSWORD_MYREPO=...
# 4. Use password file: password_file: "/path/to/password-file"
# 5. Use password command: password_command: "pass show backup/restic"
# Global settings for scheduled tasks and health monitoring
settings:
# How often restic-start-backups.py runs (Windows Task Scheduler)
# Default: 15 minutes
# backup_interval_minutes: 15
# How often restic-health-check.py runs (Windows Task Scheduler)
# Default: 180 minutes (3 hours)
# health_check_interval_minutes: 180
# Alert if no backup activity for this many minutes (repo is "stale")
# Default: 10080 minutes (7 days)
# health_check_stale_minutes: 10080
# Health check mode:
# 'all' - Warn only if ALL checked repos have no recent backups (default)
# 'any' - Warn if ANY checked repo has no recent backup
# health_check_mode: all
repositories:
# Basic local repository example
- name: my-documents
repo: "C:/restic-repos/documents"
# Password can be set directly (not recommended for shared configs)
# password: "your-password"
# Or use environment variable (recommended)
password_env: "RESTIC_PASSWORD_MY_DOCUMENTS"
sources:
- "C:/Users/username/Documents"
# Exclude patterns (glob syntax)
exclude:
- "*.tmp"
- "*.temp"
- "Thumbs.db"
- ".DS_Store"
# Read additional exclude patterns from files
# Looks in both script directory and each source directory
exclude_file:
- ".gitignore"
- ".resticignore"
# Exclude directories containing these marker files
# exclude_if_present:
# - ".nobackup"
# - "CACHEDIR.TAG"
# Retention policy - applied after each backup via 'restic forget'
# All options are optional; specify only what you need
retention:
keep-last: 10 # Keep the last 10 snapshots
keep-hourly: 24 # Keep 1 snapshot per hour for 24 hours
keep-daily: 30 # Keep 1 snapshot per day for 30 days
keep-weekly: 12 # Keep 1 snapshot per week for 12 weeks
keep-monthly: 24 # Keep 1 snapshot per month for 24 months
# keep-yearly: 5 # Keep 1 snapshot per year for 5 years
# keep-within: 2d # Keep all snapshots within 2 days
# keep-within-hourly: 1d # Keep hourly for last day
# keep-within-daily: 7d # Keep daily for last week
# Backup interval - how often this repo is backed up
# Default: no interval (backs up every time the scheduled task runs, e.g., 15m)
# Useful for cloud repos that don't need frequent backups
# Supported units: s (seconds), m (minutes), h (hours), d (days), w (weeks)
# backup-interval: 3h # Only backup this repo every 3 hours
# Auto-prune interval - how often to run 'forget --prune' to reclaim disk space
# Default: 4w (4 weeks). Set to 'never' or '0' to disable auto-prune.
# prune-interval: 4w
# Skip backup if no files changed since last backup (saves cloud sync noise)
# Uses restic's dry-run to detect changes before creating a snapshot.
# Useful for repos with cloud sync (sync-to) to avoid unnecessary uploads.
# Note: The dry-run check takes ~30s for large repos.
# skip-if-unchanged: true
# Windows VSS (Volume Shadow Copy) - backs up locked files
# Requires Administrator privileges
use-vss: true
# Optional: Add tags to all snapshots from this repo
# tags:
# - documents
# - important
# Repository with cloud sync to OneDrive
- name: mysrc-backup
repo: "C:/restic-repos/mysrc"
password_env: "RESTIC_PASSWORD_MYSRC"
sources:
- "C:/Users/username/mysrc"
exclude:
- "node_modules/"
- ".git/objects/"
- "__pycache__/"
- "*.pyc"
- ".venv/"
- "venv/"
- "target/"
- "build/"
- "dist/"
exclude_file:
- ".gitignore"
- ".backup-ignore"
retention:
keep-last: 100
keep-hourly: 72
keep-daily: 30
keep-weekly: 12
keep-monthly: 24
use-vss: true
# Sync repository to cloud after backup using rclone
# Requires: rclone configured with the remote
sync-to:
# OneDrive via rclone
- type: rclone
remote-path: "onedrive:Backups/restic-mysrc"
interval: 60m # Sync at most every 60 minutes
# Optional: extra rclone arguments
# sync-args:
# - "--bwlimit=10M"
# - "--transfers=4"
# Direct cloud repository (no local copy)
# Repository is stored directly on cloud via rclone backend
# - name: cloud-direct
# repo: "rclone:onedrive:Backups/restic-direct"
# password_env: "RESTIC_PASSWORD_CLOUD"
#
# sources:
# - "C:/Users/username/ImportantData"
#
# retention:
# keep-last: 50
# keep-daily: 30
# Repository with sync-from (e.g., NAS -> local before backup)
# Useful for backing up network shares
# - name: nas-backup
# repo: "C:/restic-repos/nas"
# password_env: "RESTIC_PASSWORD_NAS"
#
# sources:
# - "C:/Users/username/nas-local"
#
# # Pre-backup sync: copy from NAS to local before backup
# # This runs BEFORE restic backup
# sync-from:
# - type: rclone
# source: "//nas-server/shared/documents"
# destination: "C:/Users/username/nas-local"
# # Optional: extra rclone arguments
# # sync-args:
# # - "--exclude=*.tmp"
#
# retention:
# keep-last: 50
# keep-daily: 30
#
# # Then sync to cloud after backup
# sync-to:
# - type: rclone
# remote-path: "onedrive:Backups/nas-backup"
# interval: 120m
# WSL (Windows Subsystem for Linux) repository example
# Runs restic inside WSL to avoid Windows permission errors when backing up Linux files
# Requires: restic installed inside WSL (sudo apt install restic)
# - name: linux-src-backup
# repo: "C:/restic-repos/linux-src" # Windows path - auto-converted to /mnt/c/...
# password_env: "RESTIC_PASSWORD_LINUX"
# wsl: true # Run restic inside WSL
#
# sources:
# - /home/username/projects # Native Linux paths (not //wsl.localhost/...)
#
# exclude:
# - "__pycache__/"
# - "*.pyc"
# - "node_modules/"
# - ".git/"
# - "venv/"
#
# # Exclude file must also be a native Linux path
# exclude_file:
# - /home/username/projects/.backup-ignore
#
# retention:
# keep-last: 50
# keep-daily: 30
#
# use-vss: false # VSS not applicable for WSL
# Example .env.local file (create in same directory as scripts):
# RESTIC_PASSWORD_MY_DOCUMENTS=your-secure-password
# RESTIC_PASSWORD_MYSRC=another-secure-password
# RESTIC_PASSWORD_NAS=yet-another-password