diff --git a/ops/borg-ui/scripts/USER_SCRIPTS_SETUP.md b/ops/borg-ui/scripts/USER_SCRIPTS_SETUP.md index 16d5e80..7d57469 100644 --- a/ops/borg-ui/scripts/USER_SCRIPTS_SETUP.md +++ b/ops/borg-ui/scripts/USER_SCRIPTS_SETUP.md @@ -1,10 +1,10 @@ # Unraid User Scripts Setup -This document describes the intended automation path for `pre-backup-dumps.sh`. +This document describes the intended automation path for the Borg pre-flight scripts. ## Decision -The pre-backup dump refresh should run: +The Borg pre-flight should run: - on the Unraid host - through the User Scripts plugin or host cron @@ -14,7 +14,13 @@ It should **not** be implemented as a Borg UI inline hook in the current design. ## Why host-side -`pre-backup-dumps.sh` currently assumes: +`pre-borg.sh` currently chains the host-side checks: + +- `services/posture-check/posture-check.sh` +- `ops/borg-ui/scripts/pre-backup-dumps.sh` +- `ops/restore-tests/check-restore-freshness.sh` + +The dump step assumes: - access to the host Docker daemon via `docker exec` - access to host paths under `/mnt/user/...` @@ -24,24 +30,35 @@ That makes host execution simpler, more transparent, and lower-risk than giving ## Recommended rollout -1. Store the script on the host, for example at: - - `/mnt/user/appdata/borg-ui/scripts/pre-backup-dumps.sh` -2. Make it executable: - - `chmod +x /mnt/user/appdata/borg-ui/scripts/pre-backup-dumps.sh` -3. Create a User Scripts entry such as: +1. Use the repo clone on the host: + - `/mnt/user/services/homelab-infra` +2. Make the scripts executable: + - `chmod +x /mnt/user/services/homelab-infra/ops/borg-ui/scripts/pre-borg.sh` + - `chmod +x /mnt/user/services/homelab-infra/ops/borg-ui/scripts/pre-backup-dumps.sh` +3. Create a User Scripts entry: - `borg-pre-backup-dumps` -4. Let that entry run: - - on a fixed schedule before the expected Borg backup window - - or manually before ad hoc Borg runs -5. Keep Borg UI focused on backing up `/local/borg-dumps`, not on generating the dumps itself. +4. Script body: + +```bash +#!/bin/bash +REPO_ROOT=/mnt/user/services/homelab-infra \ +DUMP_ROOT=/mnt/user/backups/borg/dumps \ +ALLOW_POSTURE_WARNING=1 \ +bash /mnt/user/services/homelab-infra/ops/borg-ui/scripts/pre-borg.sh +``` + +5. Schedule: daily at `04:00`, before the expected Borg backup window. +6. Keep Borg UI focused on backing up `/local/borg-dumps`, not on generating the dumps itself. ## Operational model The intended sequence is: -1. Host script refreshes `latest` dump artifacts. -2. Borg UI backs up `/local/borg-dumps` together with the rest of `critical_infra`. -3. Borg history preserves dump history, so the host only needs to keep the most recent dump set. +1. Host wrapper checks posture. +2. Host script refreshes `latest` dump artifacts. +3. Freshness check verifies expected dumps. +4. Borg UI backs up `/local/borg-dumps` together with the rest of `critical_infra`. +5. Borg history preserves dump history, so the host only needs to keep the most recent dump set. ## Current dump target diff --git a/ops/restore-tests/schedule.md b/ops/restore-tests/schedule.md index 2a8994a..7c292fe 100644 --- a/ops/restore-tests/schedule.md +++ b/ops/restore-tests/schedule.md @@ -45,11 +45,23 @@ Spaeter: - `vaultwarden` - Jeden 3. Samstag im Monat, 07:00: - `gitea` -- Jeden 2. Monat am 2. Samstag, 08:00: +- Jeden 2. Samstag in ungeraden Monaten, 08:00: - `paperless` +- Jeden 1. des Monats, 09:00: + - `monthly-random-restore.sh` - Quartalsweise am 1. Werktag des Quartals: - DR-/Restore-Sanity-Check +## Unraid User Scripts Cron + +| Script | Cron | Bedeutung | +|---|---|---| +| `restore-freshness-weekly` | `30 6 * * 1` | jeden Montag 06:30 | +| `restore-vaultwarden-monthly` | `0 7 1-7 * 6` | erster Samstag im Monat 07:00 | +| `restore-gitea-monthly` | `15 7 15-21 * 6` | dritter Samstag im Monat 07:15 | +| `restore-paperless-bimonthly` | `0 8 8-14 1,3,5,7,9,11 *` | zweiter Samstag in ungeraden Monaten 08:00 | +| `monthly-random-restore` | `0 9 1 * *` | erster Kalendertag im Monat 09:00 | + ## Betriebsmodus - V1: diff --git a/services/posture-check/unraid-user-scripts.md b/services/posture-check/unraid-user-scripts.md index 8b16699..b732b56 100644 --- a/services/posture-check/unraid-user-scripts.md +++ b/services/posture-check/unraid-user-scripts.md @@ -17,7 +17,7 @@ bash /mnt/user/services/homelab-infra/services/posture-check/posture-check.sh ## `posture-check-hourly` -Zeit: stuendlich. +Zeit: stuendlich bei Minute 17, Cron `17 * * * *`. ```bash #!/bin/bash @@ -26,7 +26,7 @@ bash /mnt/user/services/homelab-infra/services/posture-check/posture-check.sh ## `cert-token-check-daily` -Zeit: taeglich, z. B. 06:10. +Zeit: taeglich 06:10, Cron `10 6 * * *`. ```bash #!/bin/bash @@ -35,7 +35,7 @@ bash /mnt/user/services/homelab-infra/services/posture-check/cert-token-check.sh ## `compose-runtime-drift-daily` -Zeit: taeglich, z. B. 06:20. +Zeit: taeglich 06:20, Cron `20 6 * * *`. ```bash #!/bin/bash