All chapters

Backups and restore

A cpleks backup set holds the panel's own database, a dump of every customer database, and an archive of every hosting account's files, each checked after it is written. Sets are kept on the server; a copy to somewhere else is what survives losing the machine. The Backups screen is for administrators.

Take a backup

  1. Open Backups and press Back up now.
  2. Each database is written out and read back, and each account's home is archived with an index of what went in. On a server with real data this takes a few minutes.
  3. The set appears under What is kept with when it was taken, its size, the number of files, how many of its parts were read back (ALL 5 in the Verified column when every one was), and how long it took.

The last seven sets are kept, and the oldest is removed automatically. If the disk is too full for a set, nothing is taken and the screen says so.

The Backups screen: the warning that these backups are on the same server, the Back up now button, and two sets under What is kept, each verified ALL 5.
The Backups screen of the test machine, with two sets.

Nightly backups start when you choose a copy destination (below). Until then there is no schedule, and a set is taken only when somebody presses Back up now. The screen says the same.

Get files back

  1. Under Files, choose an Account and a Backup. The files saved in that set are listed, folder by folder; looking changes nothing.
  2. Press Restore these files and confirm.
  3. Everything the set holds for that account is written into a new folder in its home, named restored- and the set's name. The live site is not touched: you move back what you want with the file manager. If that folder already exists from an earlier restore, the restore is refused rather than merged.
The Files section of the Backups screen with account #1 (example.com) and the newest set chosen: the folders the set holds for u1 (.cplex, app, blog, mail, public_html and shop), a Restore these files button, and the sentence saying a restore goes into a new folder named restored- and the set's name.
What one set holds for an account, before anything is restored. Looking changes nothing; the button asks for confirmation first.

Get a database back

  1. Under Getting one back (one customer database, from one set), choose the Account, the Database and From the backup taken.
  2. Press Restore this database and read the confirmation: every table in the backup replaces the site's current copy, and whatever changed since is gone.
  3. Press Restore and reset the password. The panel keeps no database passwords, so a restore makes a new one and shows it once, with the database name and user name. Copy it into the site's configuration.

The dump goes back in as the site's own database account, never as the server's administrator, so a tampered backup can reach that site's database and nothing else.

Prove they work

Rehearsed restore puts the newest set back somewhere harmless: it opens the panel's own database, loads every MariaDB or MySQL database into a scratch copy, extracts every account's files, and then removes all of it. Nothing live is touched. It runs once a week by itself, early on Sunday morning by the server's clock; Rehearse now runs it at once. Each part is reported as CAME BACK, as DID NOT with the reason, or as NOT LOADED, and one sentence under the list says what was and was not rehearsed.

A PostgreSQL database is the one part it does not load. Its dump is in every set and is checked to be whole, and the rehearsal reports it as NOT LOADED: there is no scoped way yet to load a PostgreSQL dump as the site's own account rather than as the database server's administrator. That is not a failure, so it is not drawn in red and raises no alert; it is not a restore either, so a set with a PostgreSQL database is marked PARTLY REHEARSED rather than EVERYTHING CAME BACK. A PostgreSQL dump that is not whole is a failure, and is reported as DID NOT. For the same reason a PostgreSQL database cannot yet be restored from the Backups screen; the panel refuses it with that sentence rather than restoring it as the administrator. MariaDB and MySQL databases restore as described above.

The Rehearsed restore card after one run, marked PARTLY REHEARSED: the panel database, u1_main, u1_shop and the files of u1 CAME BACK, and the PostgreSQL database u1_blog is NOT LOADED, with a sentence saying why.
A rehearsal on the test machine. Nothing failed; the PostgreSQL line is the limit described above.

Copies off this machine

A set on the same disk protects you from a deleted database or a bad upgrade, not from losing the server. The off-machine copy uses restic, which encrypts every copy.

  1. Under Copies off this machine, press Install restic if the panel asks; it installs from the distribution's archive and the panel follows it.
  2. Press Choose where and pick S3 bucket (AWS, or any S3-compatible store), Backblaze B2, or SFTP host. A folder on this machine is there for trying the pipeline and is not off the box.
  3. Fill in the bucket or host, the access key, and a Repository password: restic encrypts every copy with it, so keep it somewhere that is not this machine.
  4. Give the key write and read only, never delete. The panel never deletes from the destination, so whoever breaks into this server cannot reach the copies.
  5. Press Save, then Copy now, or wait for the nightly run. The panel shows the last copy's size, file count and time.
The Copies off this machine card, ON THIS MACHINE ONLY, with the destinations offered: Nowhere yet, S3 bucket, Backblaze B2, SFTP host and A folder on this machine.
Choosing where copies go. On the test machine nothing has been saved, so backups stay on the machine.

Restore onto a new server

The panel prints the steps for its own destination under How to get this back, on a machine that is not this one. In short: install cpleks on the new machine, bring the newest set back with restic, put it under /var/lib/cplex/backups/, put its panel.db in place as the panel's database, and press Repair this server: it recreates the accounts and every configuration file. Then restore each account's files and databases from the Backups screen.

What is not here

  • A whole backup set cannot be downloaded through the browser: a set holds every customer's data.
  • A database cannot be uploaded from your computer; it comes back from a set.
  • Restoring a PostgreSQL database from the panel (above).