diff --git a/docs/deployment.md b/docs/deployment.md index d774dcb..5d97103 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -416,3 +416,7 @@ mailbox requests and the **Can add mailbox provisioning** permission. The initial password stays in the root-only credentials file on the mail node. To locate that file, download the manifest and use the node's `apply` command. Reapplying the manifest preserves the password and prints the file path. + +Back up mail on the node that hosts the mailbox. The archive can be used to +recover messages and folders into a newly provisioned mailbox with the same +address. [Mailbox backup and restore](development.md#back-up-and-restore-a-mailbox) diff --git a/docs/development.md b/docs/development.md index 00d5c1e..5c2a768 100644 --- a/docs/development.md +++ b/docs/development.md @@ -487,6 +487,39 @@ installation needs attention. Exit code `1` indicates an invalid manifest or an invocation error such as running the check without root privileges. +### Back up and restore a mailbox + +Download the mailbox manifest from the panel and run the backup on the node +that hosts the mailbox. Use a new archive name in a root-controlled directory. + +```sh +sudo install -d -m 0700 /var/backups/coulobre +sudo /opt/coulobre/bin/coulobre-mail-node backup-mailbox \ + coulobre-mailbox-1.json /var/backups/coulobre/mailbox-1.tar.gz +``` + +Coulobre uses Dovecot to copy the managed mailbox into temporary Maildir +storage before creating the archive. Allow space for that copy on the mail +volume. The archive contains messages, folders, IMAP flags, and subscriptions. +Mailbox passwords and node configuration stay on the node. If Dovecot reports +an incomplete sync, retry when the mailbox is idle. +[Dovecot backup command](https://doc.dovecot.org/2.4.4/core/man/doveadm-backup.1.html) + +To recover mail, apply the original mailbox manifest on the destination node. +Use a newly provisioned mailbox that has received no delivery or client +access and has no existing `Maildir`. Keep delivery and client access paused +for that mailbox until recovery completes. Keep Postfix and Dovecot running +for the local configuration checks. Transfer the archive if needed and +ensure it is owned by root with mode `0600`. + +```sh +sudo /opt/coulobre/bin/coulobre-mail-node restore-mailbox \ + coulobre-mailbox-1.json /var/backups/coulobre/mailbox-1.tar.gz +``` + +The node checks the address and validates the archive before publishing the +restored Maildir. Sign in with the destination mailbox's credentials. + ### Enable local mailbox provisioning On a mail node with the same Postfix and Dovecot setup, install Coulobre in a