Backups
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
Backups (/backups) is the account-level control tower for protecting every
site, Docker app/stack, and whole server across your fleet. You add
destinations once (they hold the storage credentials), attach jobs to
individual servers, and watch every run land as a snapshot you can restore
from. The section is owner-only and available on all plans: the Free
plan backs up to a local disk, Plus and up unlock your own offsite object storage, and
MZPanel Cloud Backup (encrypted storage we provide, $3 per 100 GB) works on every plan.
Add a destination and back up a server, step by step
Section titled “Add a destination and back up a server, step by step”-
Go to the Destinations tab and add where backups will live:
- Add object storage — S3, Cloudflare R2, Backblaze B2 (all native S3-compatible), or any rclone remote (Google Drive, Dropbox, OneDrive, WebDAV/Nextcloud, SFTP, …). (Plus and up.)
- Add local — a directory on one server’s own disk. (All plans.)
- Add peer — another of your servers (the holder) lends its spare disk
and your other servers back up to it over SFTP. (Pro and up.) The holder
must be online and run agent 0.2.143 or newer; servers on an older agent are shown disabled with “Needs agent
0.2.143 or newer — update the agent first”. Until the holder qualifies,
creating a peer is refused (
502 peer_provision_failed, or400 unsupported_kindon an older control plane), so use object storage for an offsite copy meanwhile. The holder itself backs up to its own disk with a Local destination.
Saving an object destination tests it from an online server. rclone would create a missing bucket on the first backup, so the test checks that the bucket (or top folder) exists without creating it: a misspelled name shows The bucket or folder … does not exist on the card, with Fix name (edit it; saving tests again) and Create bucket (creates it on purpose). The bucket check needs agent 0.2.180 or newer on the testing server; an older agent answers Update the agent (
409 agent_update_required) instead of reporting a misspelled bucket as connected. -
Pick the destination’s encryption mode: Basic (plain archives, maximally portable) or Advanced (each archive is
gpg-encrypted with a per-server password the box generates automatically — download and keep it). -
Back on the Overview tab, open a server card and click New job. Choose what to back up (site, Docker app/stack, or the whole server — one or many targets), the kind (full, database, or files), a schedule, one or more destinations, and a retention (keep N copies or days).
-
Save. The job runs on its schedule, or hit Run now to fire it immediately — each run appears under Snapshots as it completes.
MZPanel Cloud Backup (storage we provide)
Section titled “MZPanel Cloud Backup (storage we provide)”If you do not want to set up a bucket, buy Cloud Backup storage: encrypted offsite backups in premium data centers, $3 per 100 GB per month, on every plan (Free included).
Billing → Add-ons → Cloud Backup +100 GB → Add opens one short setup:
- Confirm that you hold the keys (below).
- Your vault. No vault yet: create one — a master password and a Recovery Kit you must save (the setup does not continue until you confirm). Already have a vault: re-enter its master password, to prove you still remember it.
- Cloud Backup is bought and turned on. Every server gets a daily “Cloud Backup” job (every site, Docker app and stack; keeps 3 copies). Servers you add later get one too. Change or delete these jobs like any other — a deleted one is not re-created.
Your existing jobs are not changed: Backups → Destinations lists them with an Add Cloud button. Buying more space later is a plain Add in Billing.
Only you hold the keys. Every Cloud Backup archive is encrypted on your server with that server’s own key before it is uploaded. Nobody else can read it — not MZPanel, not the data center. After a server’s first backup, its key is saved in your vault automatically the next time you open Backups with the vault unlocked (only the vault can open it). The panel shows red until every server’s key is in the vault, and you get an email after 24 hours and 72 hours if one is still missing. If you lose both your vault master password and your Recovery Kit, nobody can recover your backups for you.
Restore anywhere. Restoring onto the same server works as usual. To restore onto another server (for example after losing one), pick the target in the restore drawer and unlock the vault: the original server’s key goes with the restore and is removed from the target right after.
Protected from the server itself. A server can add backups to its own folder but can never delete them, so a hacked server or ransomware cannot wipe its Cloud Backups. Old copies are removed by MZPanel according to each job’s retention.
Space. The panel shows used vs. bought space (measured hourly). Retention counts: keeping 7 copies of a 10 GB site uses about 70 GB. When the space is full, new backups to Cloud Backup pause (your other destinations keep working) until you add 100 GB or lower retention. Restores always work.
When the storage is removed (you remove the add-on, or the wallet cannot renew it), your Cloud Backups turn read-only for 14 days: you can still restore them. You get emails when this starts, 3 days and 1 day before the end. After 14 days they are permanently deleted. Add the storage again before then to keep everything.
Not available in the on-box fallback (it needs MZPanel to issue each run’s access), and the Cloud Backup destination cannot be edited or deleted from its card.
What else you can do
Section titled “What else you can do”- Overview tab — a backup coverage card per server (backed-up / scheduled / no-backup), a fleet 3-2-1 nudge, Docker app/stack coverage, and a Recent failures log with per-row error snippets and a Clear failures button.
- Server drawer (open a coverage card) — list, run, pause/resume, edit, duplicate, and delete that server’s jobs; see its recent snapshots; and Download backup key for Advanced-mode servers.
- Back up one site now — on a site card’s ⋮ menu (or Back up in the site’s Manage drawer) pick Files, Database or both and a destination, then Back up now. No saved job is needed; with no destination yet the archive goes to the server’s disk and a Local disk destination is created. The card shows a spinner, then a check (or the error); the archive appears under Snapshots and restores like any other. The last 5 one-off archives per site are kept. On a server’s Sites tab, select several sites and click Back up for a full backup of each. Docker apps and stacks have the same Back up now in their drawer. Only the server owner can start one; a client on a shared site lists and restores its backups from the site.
- Snapshots tab — the fleet-wide history, filterable by status, kind, target
type, and server. Restore (single or bulk), Check existence (re-verify
each archive is still at its destination), Refresh from servers (reconcile
the history with each destination’s
manifest.json), and delete a snapshot (removes the remote archive too). - Restore a snapshot with a chosen scope (full / database only / files only), optionally to a different server (a migration — both must be online), or remapped to a different domain (re-provisions the site shell, rewrites the URL). A deleted site is recreated (user, database, PHP pool, vhost, SSL) before files and database are replayed.
How it works
Section titled “How it works”Backups are orchestrated by the control plane (/v1/backups/* and
/v1/servers/:id/backup-jobs/*) but run on the box. Destinations, jobs, and
snapshot history live in Postgres; the actual archives live only at their
destination. Each action dispatches a backup.v2-* job to the target server’s
agent, which runs it natively:
| Action | Job dispatched | Agent runs |
|---|---|---|
| Run a job | backup.v2-run | backup v2 run … → .tar.gz per target + updates manifest.json |
| List / reconcile | backup.v2-list | backup v2 list (reads manifest.json) |
| Check existence | backup.v2-verify | backup v2 verify (which archives are still present) |
| Restore | backup.v2-restore | backup v2 restore --scope … [--target-site …] |
| Delete | backup.v2-delete | backup v2 delete (removes the archive) |
| Reveal key | backup.v2-reveal | returns the per-server Advanced passphrase |
Object-store credentials are sealed in your browser before they ever reach the control plane — the server stores only ciphertext, and only the agent unseals them at run time. Object destinations use rclone, so all clouds share one code path. Retention is enforced as keep-N per job: older archives are pruned right after each run. The control plane’s scheduler fires jobs on time, the box takes over when it can’t be reached (see Offline-safe), and a daily existence check flips any vanished archive to Missing in the history.
CLI & automation
Section titled “CLI & automation”Backups are an account-level concern, so scheduling lives in the dashboard — but
the archives run on the box, and you can trigger a local backup directly with
mz over SSH (the same engine the panel drives). An on-box AI (e.g. Claude Code) runs
the same commands:
mz backup full example.com # files + database → local tarmz backup db example.com # database only → local tarmz backup all # every site on the box → local tarThese write a local archive on the server; offsite destinations, schedules, retention, and restore are managed from /backups in the dashboard. See The mz CLI and the command catalog.
Plan limits
Section titled “Plan limits”| Plan | Destinations | Jobs | Object storage |
|---|---|---|---|
| Free | 1 | 2 | No (local only) |
| Plus | 3 | 10 | Yes |
| Pro | 10 | 50 | Yes |
| Max | 100 | 500 | Yes |
Offline-safe: the on-box fallback
Section titled “Offline-safe: the on-box fallback”Jobs are scheduled by the control plane, but every server also keeps a copy of its jobs (with the same sealed destination credentials). If the box has not heard from the control plane for 30 minutes, a 15-minute timer on the box runs overdue jobs by itself and journals them. When the agent reconnects it sends the journal first, so the snapshots appear in the history and the job’s next run moves past the slot the box already served. Google Drive destinations can’t be used by the box alone (their access token is minted by the control plane), so a fallback run reports them as failed. The fallback is on every plan and needs agent 0.2.133 or later.
Automate it
Section titled “Automate it”The API and MCP are on every plan; the plan limits above still apply. MCP tool names (REST routes in brackets):
- Destinations:
backup_destinations_list(GET /v1/backups/destinations),backup_destinations_test(answersstatusconnected,errororbucket_missing; forbucket_missingfix the name withbackup_destinations_update, or re-run the test withcreate: trueto create the bucket),backup_destinations_check. Creating or editing a destination (backup_destinations_create/_update) needs level full plus the opt-in scopewebhooks:admin; the credential must be sealed in the browser, so people usually add destinations in the dashboard. - Jobs:
backup_jobs_list,backup_jobs_create,backup_jobs_update,backup_jobs_toggle,backup_jobs_run,backup_jobs_cancel(/v1/servers/{id}/backup-jobs/*); deleting a job needsdata:delete. A job’sinclude_image: truemakes its app archives carry the app image. - One-off backup of one site, Docker app or stack:
backups_run_once(POST /v1/servers/{id}/backups/run-once, body{targetKind: "site"|"app"|"stack", target, destinationId?, kind?, includeImage?}).targetis the site domain or the app/stack name;kind(full/files/database) is for sites only;includeImage: true(apps only) also saves the app image into the archive. It is async: the answer hassnapshot_idand, when the server’s backup lock was free,job_id+stream_url; pollbackup_snapshots_listfor the outcome. A domain that is not a site on that server answers404 not_found. - Snapshots:
backup_snapshots_list(GET /v1/backups/snapshots),backup_snapshots_verify,backup_snapshots_refresh. Restoring (backup_snapshots_restore) needs the opt-in scopebackups:restore; deleting needsdata:delete.
A typical agent sequence: backup_destinations_list to pick a destination id,
backup_jobs_create on the server, backup_jobs_run, then backup_snapshots_list to
confirm the snapshot landed.
Google Drive through rclone: use your own client ID
Section titled “Google Drive through rclone: use your own client ID”An rclone Google Drive remote made with a plain rclone config create <name> drive has an
empty client_id, so it uses the OAuth client rclone shares with every rclone user.
Google throttles that client hard: uploads run well under 1 MB/s (we measured ~0.1–0.5 MB/s
on a server whose network does 20–30 MB/s), so an archive of about 1 GB takes longer than
the 2-hour per-target limit and the run fails. The dashboard flags such a remote with
a yellow Slow note on its card and in the edit drawer.
The fix is your own OAuth client (free, about five minutes):
-
Open the Google Cloud console, create a project (or pick one) and enable the Google Drive API (APIs & Services → Library).
-
OAuth consent screen (Google Auth Platform → Branding / Audience): user type External, fill in the app name and your email, and add yourself as a test user.
-
Publish the app (Audience → Publish app, status In production). This step matters: while the app is in Testing, Google expires its refresh tokens after 7 days, and backups then fail with an auth error. You don’t need Google’s verification for your own account: at the consent prompt, choose Advanced → Go to … (unsafe).
-
Credentials → Create credentials → OAuth client ID, application type Desktop app. Copy the client ID and client secret.
-
On a machine with a browser, create the remote with them:
Terminal window rclone config create mz-drive drive \client_id=YOUR_CLIENT_ID.apps.googleusercontent.com \client_secret=YOUR_CLIENT_SECRET scope=drive -
In Backups → Destinations, edit the Drive destination (or add a new one) and paste the printed
[mz-drive]block. It now containsclient_id, and the Slow note goes away.
Uploads then run at your normal network speed. The block is sealed in your browser like any other rclone config; the control plane never sees the client secret or the token. Destinations saved before this check was added show no note either way: re-paste the block to have it checked.
Gotchas & troubleshooting
Section titled “Gotchas & troubleshooting”- Local destinations belong to one server. Only that server can back up to its local disk. A cross-server restore needs an object destination: a local archive lives on the origin server’s disk and can’t be pulled onto another box.
- Advanced encryption: don’t lose the key. In Advanced mode the passphrase lives only on the box. Download backup key from the server drawer and store it safely — an encrypted archive cannot be restored without it if the server is lost. Basic-mode archives have no such risk (they’re plain).
- “Missing” means the archive is gone, not that the run failed. The daily (or
manual Check existence) sweep marks a completed snapshot Missing when
its file has vanished from the destination — usually pruned by keep-N retention
or deleted out-of-band. Use Refresh from servers to re-sync the history
with the destination’s
manifest.json. - Restore overwrites the target. A database-only restore replaces the live database; a full restore replaces files and database. There’s no undo once it succeeds — restore to a different domain first if you want to compare.
- A failed site restore leaves the site as it was. The files are staged first,
visitors see a “being restored” page (HTTP 503 with
Retry-After) while it runs, and the current database is saved before the import. If the import or the file swap fails, the database and files are rolled back and the page is removed. Docker app and stack restores have no rollback yet: back them up before restoring over them. - An app built from source restores elsewhere only with its image. An app built on
its server from git or an upload has an image no registry serves. Turn on Include
the app image (job form, or the app’s Back up now) so the archive carries it
(
docker save, gzipped); the snapshot then shows app image and its size, and a restore onto a server without the image loads it first. The archive grows by the image size, and a run on a server without enough free disk fails withimage_no_space. It needs agent 0.2.180 or newer: turning it on (job or Back up now) on an older agent answers409 agent_update_required; a job that already had it keeps running there, and each app snapshot without the image says so in its log. Restoring a built app from an archive without its image onto a server that lacks it fails withimage_missingbefore anything is changed. Apps from a registry image (nginx:1.27, …) restore anywhere without it. - Everything live needs the agent online. Running, restoring, verifying, and deleting remote archives all reach through the agent. Clearing failed rows and deleting a snapshot with no archive are offline-safe (pure database deletes).
Related
Section titled “Related”- Cron jobs — the box-side scheduler that backs backup timers.
- Site overview — per-site health, disk, and database size.
- The mz CLI · Command catalog · API reference