diff --git a/docs/deployment.md b/docs/deployment.md index 109c781..b9fa8a0 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -312,6 +312,13 @@ SFTP sessions before transferring the hosting account to another customer. Connect to the web node's SSH hostname and port, which may differ from the hostname that a reverse proxy uses for web traffic. +## Back up hosted website files + +Use the web node commands to archive a website's document root and +restore the entire tree or a selected file. The archive stays on the +web node at the path supplied by the operator. +[Website backup and restore](development.md#back-up-and-restore-hosted-website-files) + ## Provision local databases from the panel Enable the [database provisioning socket](development.md#enable-local-database-provisioning) diff --git a/docs/development.md b/docs/development.md index 38fff1c..b4134e3 100644 --- a/docs/development.md +++ b/docs/development.md @@ -777,6 +777,48 @@ sudo /opt/coulobre/bin/coulobre-web-node set-sftp-keys \ sftp coulobre-1@web-node.example.org ``` +## Back up and restore hosted website files + +Apply the site's deployment manifest on the web node. Use that manifest +to create a native website backup in a root-controlled directory. + +```sh +sudo install -d -m 0700 /var/backups/coulobre +sudo /opt/coulobre/bin/coulobre-web-node backup-site \ + coulobre-web-plan-1.json /var/backups/coulobre/site.tar.gz +``` + +The root-only archive contains the account and domain identity plus +directories and regular files from the document root. The backup report +counts symbolic links and other non-regular entries as skipped. +Use a new archive filename for each backup. Pause SFTP uploads and +application writes for a consistent copy. The backup detects changes +while reading entries and requires site-owned files with Unix mode +permissions on the document root's filesystem. + +To recover one file, select its path relative to the document root. +Its parent directory must already exist. To overwrite an existing +site-owned file at that path, add `--replace`. + +```sh +sudo /opt/coulobre/bin/coulobre-web-node restore-site \ + coulobre-web-plan-1.json /var/backups/coulobre/site.tar.gz \ + --file assets/site.css --replace +``` + +To restore the entire archive, run the command with an empty document +root for the same account and domain. + +```sh +sudo /opt/coulobre/bin/coulobre-web-node restore-site \ + coulobre-web-plan-1.json /var/backups/coulobre/site.tar.gz +``` + +Use a root-owned archive with mode `0600`. The node validates the +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. + ## Run an isolated PHP test site Open a completed preview for the account's current domain and select **Download