Manage scheduled backup retention and archive history #37

Merged
parkel merged 3 commits from feature/backup-archive-management into main 2026-11-21 15:17:27 +01:00
3 changed files with 45 additions and 4 deletions
Showing only changes of commit 65e12bfd63 - Show all commits

No files matched your search

+1
View File
@@ -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
@@ -0,0 +1,2 @@
[Service]
Environment=COULOBRE_LOCAL_BACKUP_RETENTION=1
+42 -4
View File
@@ -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