Restore website files from local account backups #35

Merged
parkel merged 3 commits from feature/backup-recovery into main 2026-11-21 14:44:54 +01:00
6 changed files with 86 additions and 0 deletions
Showing only changes of commit 14aabb8da7 - Show all commits

No files matched your search

+1
View File
@@ -16,3 +16,4 @@ 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_WEBSITE_RESTORE=1
@@ -0,0 +1,11 @@
[Unit]
Description=Coulobre local website restore socket
[Socket]
ListenStream=/run/coulobre-account-restore.sock
SocketUser=root
SocketGroup=coulobre-restore-requests
SocketMode=0660
Accept=yes
MaxConnections=4
RemoveOnStop=true
@@ -0,0 +1,22 @@
[Unit]
Description=Coulobre local website restore request
CollectMode=inactive-or-failed
[Service]
Type=exec
User=root
WorkingDirectory=/opt/coulobre
StateDirectory=coulobre/account-restores
StateDirectoryMode=0700
ReadWritePaths=-/srv/coulobre/web
UMask=0077
ExecStart=/opt/coulobre/bin/coulobre-account-backup restore-website-request
StandardInput=socket
StandardOutput=socket
StandardError=journal
RuntimeMaxSec=30min
NoNewPrivileges=true
CapabilityBoundingSet=~CAP_SYS_RESOURCE
PrivateTmp=true
ProtectHome=true
ProtectSystem=strict
@@ -0,0 +1,6 @@
[Unit]
Requires=coulobre-account-restore.socket
After=coulobre-account-restore.socket
[Service]
SupplementaryGroups=coulobre-restore-requests
+42
View File
@@ -420,6 +420,48 @@ 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.
#### Restore website files from the panel
Enable this feature when the website and account backup archive are on the
same server. Install the restore socket and give the backup worker access to
it.
```sh
sudo groupadd --system coulobre-restore-requests
sudo install -m 0644 deploy/systemd/coulobre-account-restore.socket \
deploy/systemd/coulobre-account-restore@.service /etc/systemd/system/
sudo install -D -m 0644 deploy/systemd/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`.
```sh
panel_manage migrate --noinput
sudo systemctl restart coulobre-panel coulobre-worker coulobre-backup-worker
```
Select **Restore website** on a completed backup for the current account and
domain. Operators need the backup permissions listed above and **Can add
website restore job**. A backup that includes mail also requires permission
to view mailbox requests.
For one file, enter its path relative to the document root. Make sure the
parent directory exists. Select **Replace the existing file at this path**
only if an existing site-owned file should be overwritten. Choose **Entire
website** to restore all website files to an empty document root. When
replacing a file, its old and restored copies must fit within the website's
storage quota during staging. The **Website restores** section records the
source backup, operator, and result.
Restore request records under `/var/lib/coulobre/account-restores/` prevent
an interrupted worker from applying the same restore twice. Keep these
records while corresponding jobs could still be delivered. If the panel
cannot confirm a restore, check the destination before submitting another.
Use the [account bundle commands](development.md#recover-backups-from-the-bundle)
to recover databases, mail, or components on separate servers.
#### Include mailboxes on the same server
Complete the [Postfix and Dovecot setup](development.md#apply-a-mailbox-manifest)
+4
View File
@@ -1073,6 +1073,10 @@ sudo /opt/coulobre/bin/coulobre-account-backup pack \
### Recover backups from the bundle
On a single-server installation, operators can restore one file or the entire
website from a completed account backup. See
[restoring from the panel](deployment.md#restore-website-files-from-the-panel).
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
component before publishing the directory.