Backups, Restore and Clear
Three entries of the CONTROLLER section of the menu work with the backups of an installed controller. The CLI does not make the backups itself: it asks the backup module, the controller's container named backup, and follows what it does. If that module does not answer, the CLI says so and returns to the menu; docker ps and docker logs backup show why.
| Entry | Needs | Signs in |
|---|---|---|
| Run a backup | An installed controller | No |
| Restore backup | sudo, an installed controller | Only to download a backup from the cloud, or when modules have to change version or be installed |
| Clear controller | sudo, an installed controller, the backup module 1.11.0 or later | No |
The backups are stored on the controller in /opt/storage/backups. Reinstalling the controller with Install controller deletes that directory with the rest of /opt/storage.
Run a Backup
- The CLI lists the backup jobs configured in the backup module. With none, it says No backup jobs and returns to the menu.
- Choose a job and confirm Run the '...' backup now?
- The CLI shows each phase of the backup until it ends, then Backup complete or Backup finished with errors with the module's error.
The new backup is in /opt/storage/backups. When the controller has a device identity, which the install creates in /opt/rosepetal, the backup module also uploads a copy to the project's cloud storage.
Restore Backup
A restore makes the controller a replica of the one the backup was taken on: it puts the modules on the versions of the backup and then has the backup module restore the data.
- Where is the backup?
- Local file (.tar): a file picker opens in
/opt/storage/backups(or in the current directory if that does not exist). Choose a.tarmade by the backup module. - From the cloud (GCS): sign in, then choose the partner, the project, the device and one of its backups. Any device of the project can be chosen, so the backup of a lost controller can be restored on a new one. The CLI downloads the file into
/opt/storage/backupsand checks it against the SHA-256 recorded for the backup. When the backup comes from a device other than this machine, the confirmation says it is a clone: this machine's/opt/storageis overwritten and its own identity is kept.
- Local file (.tar): a file picker opens in
- The CLI reads the backup's manifest, compares its module versions with the controller's and shows a summary:
- whether
/opt/storageis restored (itsbackups/andcredentials/directories are kept) and the containers whose changes are replayed; - the modules set to the version of the backup, which of them need a download, and the modules of the backup that the controller lacks and are installed. A module retired from the catalog is not installed again;
device-agentandbackup, the controller's own modules, are never moved to an older version: when the controller has a newer one, it is kept;- the warnings recorded in the backup.
- whether
- Continue recreates the affected containers and overwrites
/opt/storage. When versions have to change, the CLI asks you to sign in (if you have not), downloads the images and restarts those modules at the backup's versions, as Upgrade modules does. - The CLI hands the file to the backup module and shows each phase of the restore until it ends, then Restore complete or Restore finished with errors.
A file downloaded from the cloud is deleted after a successful restore and kept after a failed one, so the restore can be retried without downloading it again.
Clear Controller
Clear controller takes the controller back to a fresh install without reinstalling it: its data is erased and every container is recreated from its image, but its enrollment, identity and modules stay.
- A first screen lists what is erased, what is kept and what cannot be recovered. The cursor starts on Cancel.
- Type the controller's name (its hostname) exactly. A different name stops here: nothing is done.
- The backup module then:
- takes a safety backup with the job
pre-clearand copies it off-site; - stops every service;
- erases the data in
/opt/storage(flows, databases, datasets, models, module settings) and all of/opt/data; - recreates every container from its image, which also discards the changes made inside the containers.
- takes a safety backup with the job
The clear runs in the backup module: closing the CLI does not stop it.
| Erased | Kept | Not even in the safety backup |
|---|---|---|
The data in /opt/storage, all of /opt/data, the changes made inside the containers | The enrollment, project, hostname, Tailscale and gateway of the controller; the module versions; the license and the Firebase credentials; the backups in /opt/storage/backups and in the cloud | What the backup job excludes (the first screen lists it) and /opt/data |
If the safety backup cannot be copied off-site, nothing is erased. The CLI then offers to clear anyway with a new safety backup kept only on this controller; the cursor starts on Cancel, because if the controller's disk is lost, that copy is lost with it.
To undo a clear, use Restore backup with the pre-clear backup; the closing screen gives its file name.
| Closing screen | Meaning |
|---|---|
| Controller cleared | Done. Controller cleared — with warnings lists what did not come back as expected, such as a service that failed to start |
| Nothing was cleared | The module stopped before erasing anything; its error and the safety backup, if one was made, are shown |
| Clear failed part-way | The controller may be partly cleared. Run Clear controller again, or restore the safety backup |
the backup module is busy | A backup, a restore or another clear is running. Wait for it to finish |
this controller's backup module is too old to clear it | Upgrade the backup module with Upgrade modules, then try again |