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
- Open Backups and press Back up now.
- 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.
- 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.
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
- Under Files, choose an Account and a Backup. The files saved in that set are listed, folder by folder; looking changes nothing.
- Press Restore these files and confirm.
- 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.
Get a database back
- Under Getting one back (one customer database, from one set), choose the Account, the Database and From the backup taken.
- 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.
- 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.
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.
- Under Copies off this machine, press Install restic if the panel asks; it installs from the distribution's archive and the panel follows it.
- 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.
- 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.
- 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.
- Press Save, then Copy now, or wait for the nightly run. The panel shows the last copy's size, file count and time.
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).