admin: backup logs via parameters.php, nextcloud secondary backup

- surface backup/cleanup cron logs + backup freshness status
- email xamxam@erg.be when SQLite backups go stale (backup watchdog)
- sync SQLite snapshots to Nextcloud WebDAV + remote-freshness watchdog
- precise retention pruning, manual sync in check recipe, and Nextcloud-sync docs
This commit is contained in:
Pontoporeia
2026-08-24 11:34:57 +02:00
parent 3e721b19f0
commit fb5e856288
12 changed files with 823 additions and 35 deletions
+9 -19
View File
@@ -162,28 +162,18 @@
---
## Phase 5 — Remote Sync *(for later)*
## Phase 5 — Remote Sync *(implemented — see [nextcloud-sync.md](nextcloud-sync.md))*
**Goal:** Push backups off the VM to a remote destination so a disk failure or VM loss doesn't take your history with it.
- [ ] Choose a remote destination (Backblaze B2, S3, SFTP, etc.)
- [ ] Install and configure rclone:
```bash
apt install rclone
rclone config # set up a remote, name it "mybackups"
```
- [ ] Add remote sync to the backup script after the `gzip` step:
```bash
rclone copy "$BACKUP_FILE" mybackups:myapp-backups/
```
- [ ] Enable versioning on the remote bucket (B2/S3) so even remote overwrites are recoverable
- [ ] Test a full restore from remote:
```bash
rclone copy mybackups:myapp-backups/db-<timestamp>.db.gz /tmp/
gunzip /tmp/db-<timestamp>.db.gz
sqlite3 /tmp/db-<timestamp>.db ".tables"
```
- [ ] (Optional) Set up a separate cron to prune remote copies older than 6 months
Implemented via a PHP WebDAV sync to Nextcloud (`cloud.erg.school`), reusing the SMTP credentials — see [nextcloud-sync.md](nextcloud-sync.md) for the full reference. The checklist below is superseded by that doc.
- [x] Choose a remote destination — **Nextcloud WebDAV** (`/XAMXAM-BCK`)
- [x] Transport — **PHP `curl`**, not rclone (reuses SMTP credentials, no extra binary)
- [x] Add remote sync separate from the backup script — `scripts/nextcloud-sync.php` (daily cron, 20 min after the 02:00 snapshot)
- [x] Remote retention — keep last 7 snapshots (`REMOTE_KEEP`)
- [x] Test a full restore from remote — restore procedure documented in [nextcloud-sync.md](nextcloud-sync.md)
- [x] Monitoring — `backup-watchdog.php` alerts on stale/missing remote copy
---