diff --git a/docs/deployment.md b/docs/deployment.md index d774dcb..46784e4 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -354,6 +354,12 @@ Use the MariaDB node commands to create a compressed SQL dump for an individual managed database and restore it to an empty database with the same identity. [Database backup and restore](development.md#back-up-and-restore-a-managed-database) +## Back up an account's website and databases + +Download the account backup manifest from the panel. Use it to create one +ZIP on a single server or bundle native archives from separate nodes. +[Account backup and recovery](development.md#back-up-a-hosting-account) + ## Publish local DNS zones from the panel Enable the [DNS publishing socket](development.md#enable-local-dns-publishing) diff --git a/docs/development.md b/docs/development.md index 00d5c1e..dbe748e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -857,6 +857,62 @@ entire archive before publishing restored files. Restored files belong to the site account, with the Apache read access recorded in the backup. The website can be recovered while its web services are stopped. +## Back up a hosting account + +Open the account as an operator and select **Download backup manifest**. The +manifest lists the primary website and all database requests for the account. +Provision those resources before running the backup. The ZIP archive contains +the native website archive and a compressed SQL dump for each listed database. +Back up mail, DNS, and panel settings separately. + +On a server hosting both the website and its databases, run the account backup +command as root. Add `--socket PATH` when MariaDB uses a custom socket. + +```sh +sudo install -d -m 0700 /var/backups/coulobre +sudo /opt/coulobre/bin/coulobre-account-backup create \ + coulobre-account-1-backup.json /var/backups/coulobre/account-1.zip +``` + +Use a new archive filename. Allow space for the component archives and the +finished ZIP while it is assembled. The website and databases are captured +in sequence. Pause application writes, SFTP uploads, and schema changes across +the components if they need to represent a single point in time. + +### Bundle backups from separate nodes + +Use the [website backup command](#back-up-and-restore-hosted-website-files) +on the web node and the [database backup command](#back-up-and-restore-a-managed-database) +on each database node. Transfer the resulting files to a root-controlled +directory with mode `0600` on every archive. Name the website archive +`website.tar.gz` and each SQL dump `database-.sql.gz`, for example +`database-cms.sql.gz`. Assemble the ZIP with the same account manifest. + +```sh +sudo /opt/coulobre/bin/coulobre-account-backup pack \ + coulobre-account-1-backup.json /var/backups/coulobre/components \ + /var/backups/coulobre/account-1.zip +``` + +### Recover backups from the bundle + +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. + +```sh +sudo /opt/coulobre/bin/coulobre-account-backup unpack \ + /var/backups/coulobre/account-1.zip /var/backups/coulobre/account-1-recovery +``` + +Use the recovered `website.json` and `website.tar.gz` with `restore-site`. +Use each `database-.json` and `database-.sql.gz` pair with +`restore-database`. Transfer the relevant pairs when the destination uses +separate nodes. For a full recovery, prepare an empty document root and empty +managed databases with the original manifests and restore all components before +resuming application traffic. To recover one website file, use the website pair +with the existing `restore-site --file` option. + ## Run an isolated PHP test site Open a completed preview for the account's current domain and select **Download