Document and deploy opt-in account backup recovery
Coulobre Panel CI / Checks (Python 3.12) (pull_request) Canceled after 0s
Coulobre Panel CI / Checks (Python 3.14) (pull_request) Canceled after 0s

This commit is contained in:
parkel committed 2026-11-21 14:54:51 +01:00
1 parent d1ad61b121
commit 92bd75c196
8 files changed
+75 -30

No files matched your search

+2
View File
@@ -17,3 +17,5 @@ COULOBRE_BROKER_URL=amqp://coulobre:@127.0.0.1:5672/coulobre
# COULOBRE_LOCAL_ACCOUNT_BACKUPS=1 # COULOBRE_LOCAL_ACCOUNT_BACKUPS=1
# COULOBRE_LOCAL_ACCOUNT_BACKUP_MAIL=1 # COULOBRE_LOCAL_ACCOUNT_BACKUP_MAIL=1
# COULOBRE_LOCAL_WEBSITE_RESTORE=1 # COULOBRE_LOCAL_WEBSITE_RESTORE=1
# COULOBRE_LOCAL_DATABASE_RESTORE=1
# COULOBRE_LOCAL_MAILBOX_RESTORE=1
@@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Coulobre local website restore socket Description=Coulobre local account restore socket
[Socket] [Socket]
ListenStream=/run/coulobre-account-restore.sock ListenStream=/run/coulobre-account-restore.sock
@@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Coulobre local website restore request Description=Coulobre local account restore request
CollectMode=inactive-or-failed CollectMode=inactive-or-failed
[Service] [Service]
@@ -8,9 +8,8 @@ User=root
WorkingDirectory=/opt/coulobre WorkingDirectory=/opt/coulobre
StateDirectory=coulobre/account-restores StateDirectory=coulobre/account-restores
StateDirectoryMode=0700 StateDirectoryMode=0700
ReadWritePaths=-/srv/coulobre/web
UMask=0077 UMask=0077
ExecStart=/opt/coulobre/bin/coulobre-account-backup restore-website-request ExecStart=/opt/coulobre/bin/coulobre-account-backup restore-request
StandardInput=socket StandardInput=socket
StandardOutput=socket StandardOutput=socket
StandardError=journal StandardError=journal
@@ -0,0 +1,6 @@
[Unit]
After=mariadb.service
[Service]
Environment=COULOBRE_LOCAL_DATABASE_RESTORE=1
ReadWritePaths=-/var/lib/coulobre/database-node
@@ -0,0 +1,6 @@
[Unit]
After=postfix.service dovecot.service
[Service]
Environment=COULOBRE_LOCAL_MAILBOX_RESTORE=1
ReadWritePaths=-/srv/coulobre-mail
@@ -0,0 +1,3 @@
[Service]
Environment=COULOBRE_LOCAL_WEBSITE_RESTORE=1
ReadWritePaths=-/srv/coulobre/web
+52 -23
View File
@@ -420,11 +420,11 @@ most one missed backup per account and continues with the next future time.
Scheduled ZIPs are stored alongside manual backups and require the same Scheduled ZIPs are stored alongside manual backups and require the same
server-side retention management. server-side retention management.
#### Restore website files from the panel #### Restore from local account backups in the panel
Enable this feature when the website and account backup archive are on the Enable local account backups first. Install the restore socket and give the
same server. Install the restore socket and give the backup worker access to backup worker access to it. The archive and the resources being restored
it. must be on the same server.
```sh ```sh
sudo groupadd --system coulobre-restore-requests sudo groupadd --system coulobre-restore-requests
@@ -432,35 +432,64 @@ sudo install -m 0644 deploy/systemd/coulobre-account-restore.socket \
deploy/systemd/coulobre-account-restore@.service /etc/systemd/system/ deploy/systemd/coulobre-account-restore@.service /etc/systemd/system/
sudo install -D -m 0644 deploy/systemd/coulobre-backup-worker.service.d/restore.conf \ sudo install -D -m 0644 deploy/systemd/coulobre-backup-worker.service.d/restore.conf \
/etc/systemd/system/coulobre-backup-worker.service.d/restore.conf /etc/systemd/system/coulobre-backup-worker.service.d/restore.conf
sudo systemctl daemon-reload
``` ```
Set `COULOBRE_LOCAL_WEBSITE_RESTORE=1` in `/etc/coulobre/panel.env`. Enable the options you need in `/etc/coulobre/panel.env`.
| Setting | Additional restore permission |
| --- | --- |
| `COULOBRE_LOCAL_WEBSITE_RESTORE=1` | **Can add website restore job** |
| `COULOBRE_LOCAL_DATABASE_RESTORE=1` | **Can restore an account database** |
| `COULOBRE_LOCAL_MAILBOX_RESTORE=1` | **Can restore an account mailbox** |
Install the socket service drop-in for each enabled action. If you replace
an existing website-only restore unit, install the website drop-in to keep
website recovery enabled. MariaDB recovery uses the local default MariaDB
socket. Mailbox recovery uses local Postfix and Dovecot.
```sh
# Website restores
sudo install -D -m 0644 deploy/systemd/coulobre-account-restore@.service.d/website.conf \
/etc/systemd/system/coulobre-account-restore@.service.d/website.conf
# Database restores
sudo install -D -m 0644 deploy/systemd/coulobre-account-restore@.service.d/database.conf \
/etc/systemd/system/coulobre-account-restore@.service.d/database.conf
# Mailbox restores
sudo install -D -m 0644 deploy/systemd/coulobre-account-restore@.service.d/mailbox.conf \
/etc/systemd/system/coulobre-account-restore@.service.d/mailbox.conf
```
```sh ```sh
panel_manage migrate --noinput panel_manage migrate --noinput
sudo systemctl daemon-reload
sudo systemctl restart coulobre-panel coulobre-worker coulobre-backup-worker sudo systemctl restart coulobre-panel coulobre-worker coulobre-backup-worker
``` ```
Select **Restore website** on a completed backup for the current account and Operators also need the backup permissions listed above and permission to
domain. Operators need the backup permissions listed above and **Can add view mailbox requests for any backup that includes mail. Select the restore
website restore job**. A backup that includes mail also requires permission action on a completed backup.
to view mailbox requests.
For one file, enter its path relative to the document root. Make sure the - **Restore website** restores one file or all website files. A single file
parent directory exists. Select **Replace the existing file at this path** needs an existing parent directory. Select **Replace the existing file at
only if an existing site-owned file should be overwritten. Choose **Entire this path** to permit overwriting. The old and restored copies must fit
website** to restore all website files to an empty document root. When within the website quota during staging. The whole website option needs
replacing a file, its old and restored copies must fit within the website's an empty document root.
storage quota during staging. The **Website restores** section records the - **Restore database** offers databases listed in the backup that still
source backup, operator, and result. belong to the account. Use the matching empty managed database and keep
the application disconnected during recovery. If the import fails after
creating objects, inspect the database before attempting another restore.
- **Restore mailbox** offers mailboxes listed in the backup that still
belong to the account. Use a newly provisioned mailbox with no Maildir.
Keep delivery and client access paused for that mailbox during recovery,
with Postfix and Dovecot running for local checks. The restored mailbox
uses the destination credentials and current quota configuration.
Restore request records under `/var/lib/coulobre/account-restores/` prevent The **Backup restores** section shows each target, source backup, operator,
an interrupted worker from applying the same restore twice. Keep these and result. Keep the request records under
records while corresponding jobs could still be delivered. If the panel `/var/lib/coulobre/account-restores/` while corresponding jobs could still be
cannot confirm a restore, check the destination before submitting another. delivered. If the panel cannot confirm a restore, check the destination
Use the [account bundle commands](development.md#recover-backups-from-the-bundle) before submitting another. For resources on separate servers, use the
to recover databases, mail, or components on separate servers. [account bundle commands](development.md#recover-backups-from-the-bundle).
#### Include mailboxes on the same server #### Include mailboxes on the same server
+3 -3
View File
@@ -1073,9 +1073,9 @@ sudo /opt/coulobre/bin/coulobre-account-backup pack \
### Recover backups from the bundle ### Recover backups from the bundle
On a single-server installation, operators can restore one file or the entire On a single-server installation, operators can restore a website file, an
website from a completed account backup. See entire website, a database, or a mailbox from a completed account backup.
[restoring from the panel](deployment.md#restore-website-files-from-the-panel). See [restoring from the panel](deployment.md#restore-from-local-account-backups-in-the-panel).
Unpack to a new directory on a root-controlled path. The command verifies the Unpack to a new directory on a root-controlled path. The command verifies the
ZIP contents and checks the identity and integrity of each compressed ZIP contents and checks the identity and integrity of each compressed