Skip to content

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.

EntryNeedsSigns in
Run a backupAn installed controllerNo
Restore backupsudo, an installed controllerOnly to download a backup from the cloud, or when modules have to change version or be installed
Clear controllersudo, an installed controller, the backup module 1.11.0 or laterNo

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 ​

  1. The CLI lists the backup jobs configured in the backup module. With none, it says No backup jobs and returns to the menu.
  2. Choose a job and confirm Run the '...' backup now?
  3. 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.

  1. 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 .tar made 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/backups and 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/storage is overwritten and its own identity is kept.
  2. The CLI reads the backup's manifest, compares its module versions with the controller's and shows a summary:
    • whether /opt/storage is restored (its backups/ and credentials/ 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-agent and backup, 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.
  3. 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.
  4. 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.

  1. A first screen lists what is erased, what is kept and what cannot be recovered. The cursor starts on Cancel.
  2. Type the controller's name (its hostname) exactly. A different name stops here: nothing is done.
  3. The backup module then:
    1. takes a safety backup with the job pre-clear and copies it off-site;
    2. stops every service;
    3. erases the data in /opt/storage (flows, databases, datasets, models, module settings) and all of /opt/data;
    4. recreates every container from its image, which also discards the changes made inside the containers.

The clear runs in the backup module: closing the CLI does not stop it.

ErasedKeptNot even in the safety backup
The data in /opt/storage, all of /opt/data, the changes made inside the containersThe 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 cloudWhat 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 screenMeaning
Controller clearedDone. Controller cleared — with warnings lists what did not come back as expected, such as a service that failed to start
Nothing was clearedThe module stopped before erasing anything; its error and the safety backup, if one was made, are shown
Clear failed part-wayThe controller may be partly cleared. Run Clear controller again, or restore the safety backup
the backup module is busyA backup, a restore or another clear is running. Wait for it to finish
this controller's backup module is too old to clear itUpgrade the backup module with Upgrade modules, then try again