From 65e12bfd63c8d856d7f3c6caaf4904423892e38d Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Sat, 21 Nov 2026 15:08:48 +0100 Subject: [PATCH] Document opt-in scheduled backup retention --- deploy/panel.env.example | 1 + .../retention.conf | 2 + docs/deployment.md | 46 +++++++++++++++++-- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 deploy/systemd/coulobre-account-backup@.service.d/retention.conf diff --git a/deploy/panel.env.example b/deploy/panel.env.example index 445f065..ae0cf98 100644 --- a/deploy/panel.env.example +++ b/deploy/panel.env.example @@ -16,6 +16,7 @@ COULOBRE_BROKER_URL=amqp://coulobre:@127.0.0.1:5672/coulobre # COULOBRE_LOCAL_MAILBOX_PROVISIONING=1 # COULOBRE_LOCAL_ACCOUNT_BACKUPS=1 # COULOBRE_LOCAL_ACCOUNT_BACKUP_MAIL=1 +# COULOBRE_LOCAL_BACKUP_RETENTION=1 # COULOBRE_LOCAL_WEBSITE_RESTORE=1 # COULOBRE_LOCAL_DATABASE_RESTORE=1 # COULOBRE_LOCAL_MAILBOX_RESTORE=1 diff --git a/deploy/systemd/coulobre-account-backup@.service.d/retention.conf b/deploy/systemd/coulobre-account-backup@.service.d/retention.conf new file mode 100644 index 0000000..f5a0654 --- /dev/null +++ b/deploy/systemd/coulobre-account-backup@.service.d/retention.conf @@ -0,0 +1,2 @@ +[Service] +Environment=COULOBRE_LOCAL_BACKUP_RETENTION=1 diff --git a/docs/deployment.md b/docs/deployment.md index 9aff926..f546e78 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -402,8 +402,10 @@ of the completed ZIP. Only one backup can be queued or running for an account at a time. The node gives each backup up to 30 minutes. Archives are stored under `/var/lib/coulobre/account-backups/` with root-only -access. Retrieve archives and manage their retention on the server. Recovery -uses the existing [account bundle commands](development.md#recover-backups-from-the-bundle). +access. Retrieve them on the server. The account's **Backup archives** page +shows all backup requests, archive sizes reported by the node, and expiration +status. Recover archives with the +[account bundle commands](development.md#recover-backups-from-the-bundle). #### Schedule backups for an account @@ -417,8 +419,44 @@ The scheduler captures the account's current resources when it queues the backup. If an account already has a backup queued or running at dispatch, the scheduler skips that occurrence. After a period offline, it queues at most one missed backup per account and continues with the next future time. -Scheduled ZIPs are stored alongside manual backups and require the same -server-side retention management. + +#### Manage retention of scheduled account backups + +Automatic expiration is disabled by default. To offer it in the panel, +enable local account backups first, then install the retention drop-in. + +```sh +sudo install -D -m 0644 deploy/systemd/coulobre-account-backup@.service.d/retention.conf \ + /etc/systemd/system/coulobre-account-backup@.service.d/retention.conf +sudo systemctl daemon-reload +``` + +Set `COULOBRE_LOCAL_BACKUP_RETENTION=1` in `/etc/coulobre/panel.env`. + +```sh +panel_manage migrate --noinput +sudo systemctl restart coulobre-panel coulobre-worker coulobre-beat coulobre-backup-worker +``` + +Open **Backup archives** and select **Manage retention**. Enter a count of +1 to 90 to keep the latest successful scheduled backups or clear the field +to disable expiration for the account. Manual backups and scheduled backups +marked **Protected** are kept in addition to that count. Operators need +the usual backup permissions, permission to view mailbox requests, and +**Can manage account backup retention**. + +The planner selects at most one older archive per account every five +minutes. Backups used by a queued or running restore are ineligible. +The backup node checks the retained ZIP manifests and their entry lists +before removing an older archive. If any retained ZIP is missing or fails +those checks, the candidate is kept and the result appears in the archive +history. Changing the policy or protecting an archive cancels any expiration +for the account that has yet to start. An expiration already in progress can +finish. + +Expired entries stay in the history and lose their restore actions. Keep +the corresponding `.expired` records beside the ZIPs to prevent a late +worker delivery from recreating an expired archive. #### Restore from local account backups in the panel