diff --git a/README.md b/README.md index f02644a..119d6fc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ ng_backup, and applies to any Nextcloud app that writes to an SMB share.) **Status: release candidate for 1.0.0 (1.0.0-rc.1, app version 0.9.7).** Tested thoroughly, usable alongside your current backup, but not yet a drop-in replacement for it. See "Known limitations" below, `PLAN.md` for the design and -`docs/HOWTO.md` for a step-by-step guide from setup to a tested restore. +`docs/HOWTO.md` for a step-by-step guide from setup to a tested restore. Server lost? See +`docs/DISASTER-RECOVERY.md`. License: AGPL-3.0-or-later. Developed and sponsored by [Ensembia](https://www.ensembia.com). Need help restoring a backup after a crash? Ensembia offers paid restore assistance: diff --git a/docs/DISASTER-RECOVERY.md b/docs/DISASTER-RECOVERY.md new file mode 100644 index 0000000..ba7ddf8 --- /dev/null +++ b/docs/DISASTER-RECOVERY.md @@ -0,0 +1,88 @@ +# Disaster recovery: your server is gone + +Your Nextcloud server is lost. You have a new, empty server. These are the steps to get your +Nextcloud back from an NG Backup location. Do them in this order. + +## What you need + +- [ ] The **recovery kit** file (`ng_backup-kit.json`) and **one passphrase** of it. +- [ ] The **connection details of the backup location**: host, user, password or keys, bucket, folder. +- [ ] A new server with the **same Nextcloud major version** as the old one (for example 34), + a database (PostgreSQL, MySQL/MariaDB or SQLite; it may differ from the old one) and room for + the whole backup plus a margin. +- [ ] A list of the apps that are **not in the app store** (your own builds, apps copied in by + hand). Keep their packages somewhere safe beforehand. + +No kit? If the location still holds its `config` file, the key is there too, but this version +can only import it from a kit. Keep the kit off the server, next to the passphrase. + +## Steps + +**1. Install a fresh Nextcloud** of the same major version. Create an admin account. Do not add +users or files. + +**2. Do not start background jobs yet.** Set the mode to cron but do not run cron yet: + + occ background:cron + +This keeps the new server quiet (no mail syncs, no notifications, no backups) until it is ready. + +**3. Install NG Backup** (the same version or newer) and enable it. + +**4. Import the backup key.** You type the passphrase yourself: + + occ backup:key:import /path/to/ng_backup-kit.json + +**5. Add the backup location** with the same details as before. This can take a while on a large +backup (the index is read first) and shows nothing until it is done. + + occ backup:target:add offsite sftp -a password::password -o host=... -o user=... -o password=... -o root=... --path=... + +If it says "No backup key yet", go back to step 4: do **not** run `backup:key:init`, that makes a +new key that cannot read your backups. + +**6. List the restore points** and pick one, normally the newest: + + occ backup:list offsite + +**7. Install the apps the old server had.** Run the restore; before it changes anything it checks +the apps and stops with what is missing: + + occ backup:restore:full offsite + +- "install these apps first: …": install each from the app store (`occ app:install `), or + enable it if it is part of Nextcloud but switched off (`occ app:enable `, for example + `admin_audit`). Apps that are not in the app store: copy them into `custom_apps` and enable them. +- "Table … does not exist here": an app that was removed or switched off long ago left tables + behind. Install that app (for example `deck`, `onlyoffice`), then run the restore again. + +Repeat until the restore starts. + +**8. Let the restore run.** It restores the database, then the data directory, and takes hours for +a large backup. If it stops halfway, fix the cause and run the same command again with `--force`. + +**9. After the restore** + +- Check `config/config.php`: `trusted_domains`, `overwrite.cli.url`, and the cache (Redis) host + must match the new server. The database settings and data directory are kept from the new + installation. +- `occ upgrade` (apps on the new server may be newer than in the backup), then + `occ maintenance:repair`. +- Log in, open some files, a calendar and a contact. +- Start background jobs (cron). + +**10. Point your domain at the new server** and check that clients reconnect. + +**11. Make a backup of the new server** to the same location (`occ backup:run offsite`). The old +server must stay off: two servers must never write to the same location. + +## Never + +- Never let the old server write to the location again if it comes back. Switch its backups off + first. +- Never give your passphrase to anyone. Nobody helping you needs it. + +## Help + +Stuck? [Ensembia](https://www.ensembia.com), the developer of NG Backup, offers paid help with +restoring a backup after a crash. diff --git a/docs/HOWTO.md b/docs/HOWTO.md index 3c97856..afccaec 100644 --- a/docs/HOWTO.md +++ b/docs/HOWTO.md @@ -136,6 +136,8 @@ occ backup:user:restore offsite users// --mode=as-backup ## 7. Disaster recovery: restore the whole server +Server lost? Follow the step-by-step [DISASTER-RECOVERY.md](DISASTER-RECOVERY.md). + Use a fresh Nextcloud installation of the same major version, with NG Backup installed and the same location available. For a test, use a **copy** of the location: two servers writing to one location break each other's catalog.