@@ -74,20 +74,37 @@ graph LR
7474
7575### PVC Backups (VolSync)
7676
77- All application PVCs are backed up daily at 2 AM using VolSync with Restic:
77+ Application PVCs are backed up using VolSync with Restic, with a tiered schedule:
78+
79+ ** Critical Apps (Hourly):**
80+ home-assistant, paperless-ngx, karakeep, meilisearch, n8n, immich, open-webui, khoj
81+
82+ | Setting | Value |
83+ | ---------| -------|
84+ | Schedule | ` 0 * * * * ` (hourly) |
85+ | Retention | 24 hourly + 7 daily |
86+
87+ ** Non-Critical Apps (Daily):**
88+ container-registry, redis, mqtt, searxng, fizzy, nginx, jellyfin, nestmtx, homepage-dashboard, plex
7889
7990| Setting | Value |
8091| ---------| -------|
8192| Schedule | ` 0 2 * * * ` (daily at 2 AM) |
8293| Retention | 14 days |
94+
95+ ** Common Settings:**
96+
97+ | Setting | Value |
98+ | ---------| -------|
8399| Backend | Restic |
84100| Target | RustFS S3 on TrueNAS (192.168.10.133:30292) |
85101| Bucket | ` volsync ` |
86102| Copy Method | Snapshot |
87103
88104Each app has:
89105- ` ReplicationSource ` - Defines backup schedule and retention
90- - ` ReplicationDestination ` - Pre-provisioned for restore capability
106+ - ` ReplicationDestination ` - Dormant restore definition (no trigger)
107+ - ` PVC ` - References ReplicationDestination via ` dataSourceRef `
91108- ` ExternalSecret ` - Pulls S3 credentials from 1Password
92109
93110### Database Backups (Native)
@@ -107,31 +124,44 @@ PostgreSQL databases use their native backup tools:
107124
108125## 3. Disaster Recovery
109126
110- ### Restoring a PVC (VolSync)
111-
112- When you need to restore a PVC from backup:
127+ ### Volume Populator Pattern (Automatic Restore)
113128
114- 1 . ** Trigger the ReplicationDestination** :
115- ``` bash
116- kubectl patch replicationdestination < app> -restore -n < namespace> \
117- --type merge \
118- -p ' {"spec":{"trigger":{"manual":"restore-' $( date +%s) ' "}}}'
119- ```
129+ PVCs use the ** Volume Populator** pattern for automatic restore:
120130
121- 2 . ** Wait for restore to complete** :
122- ``` bash
123- kubectl get replicationdestination < app> -restore -n < namespace> -w
124- ```
125-
126- 3 . ** Update PVC to use restored data** (if needed):
127131``` yaml
132+ # In each app's PVC
128133spec :
129134 dataSourceRef :
130135 kind : ReplicationDestination
131136 apiGroup : volsync.backube
132137 name : <app>-restore
133138` ` `
134139
140+ **How it works:**
141+ 1. PVC references a dormant ReplicationDestination (no trigger)
142+ 2. When PVC is newly created (no existing Longhorn volume), Kubernetes uses the dataSourceRef
143+ 3. VolSync automatically restores from S3 backup to populate the new PVC
144+ 4. If Longhorn already has the data, dataSourceRef is ignored
145+
146+ **This enables zero-intervention restore:**
147+ - Deploy app → PVC created → auto-restore from S3 → app starts with data
148+ - Longhorn replication is Layer 1 (node failure)
149+ - S3 backup is Layer 2 (cluster loss)
150+
151+ ### Manual Restore (if needed)
152+
153+ For manual restore scenarios, you can trigger the ReplicationDestination:
154+
155+ ` ` ` bash
156+ # Add manual trigger to force restore
157+ kubectl patch replicationdestination <app>-restore -n <namespace> \
158+ --type merge \
159+ -p '{"spec":{"trigger":{"manual":"restore-'$(date +%s)'"}}}'
160+
161+ # Wait for restore to complete
162+ kubectl get replicationdestination <app>-restore -n <namespace> -w
163+ ```
164+
135165### Restoring a Database
136166
137167** CloudNativePG:**
@@ -159,11 +189,11 @@ After a complete cluster rebuild:
159189
160190| Feature | Before (Longhorn) | Now (VolSync) |
161191| ---------| -------------------| ---------------|
162- | Backup tool | Longhorn built-in | VolSync + Kopia |
163- | Backup schedule | RecurringJobs (tiered) | Single daily schedule |
164- | Restore method | Hardcoded restore-job.yaml | Declarative ReplicationDestination |
192+ | Backup tool | Longhorn built-in | VolSync + Restic |
193+ | Backup schedule | RecurringJobs (tiered) | Tiered: hourly (critical) + daily (non-critical) |
194+ | Restore method | Hardcoded restore-job.yaml | Volume Populator (automatic on PVC create) |
165195| Database backups | PVC snapshots (inconsistent) | Native WAL archiving (consistent) |
166- | Complexity | Multiple tiers, shell scripts | Simple, uniform config |
196+ | Complexity | Multiple tiers, shell scripts | Declarative YAML per app |
167197
168198## 5. Monitoring
169199
0 commit comments