Backups
What ScalPanel backs up, when and for how long, where backups are stored and encrypted, what can be restored, and how to copy everything off the server.
ScalPanel backs up every account's websites, databases and mailboxes automatically. Customers browse, download and restore their own backups in the hosting panel. As the provider, you decide how long backups are kept and where off-site copies go.
What is backed up
| Part | What a backup holds | Runs on |
|---|---|---|
| Website | All of the website's files, except its tmp folder | The node |
| Database | A full dump of one database: MariaDB (with routines, triggers and events), PostgreSQL or MongoDB | The control plane |
| All mailboxes of one mail domain | The mail server |
Every running website, every ready database and every mail domain gets automatic backups, at times spread across the day so the server is not busy all at once. A package with backups turned off gets none.
Schedules
The package's Scheduled backups per day sets how often: 1 (daily, the default), 2, 3, 4, 6, 8, 12 or 24 (hourly). Other values are rounded down to one of these. Mail domains are backed up at most 4 times a day, as each backup reads every mailbox. A changed schedule applies from each part's next backup.
Customers can also start backups by hand, up to the package's daily limit (3 per website, database or mail domain by default).
These are not backed up: Sieve filters and autoresponders, which are rebuilt from the control plane's own data, and the panel's own settings, which belong to the control-plane database (see below).
Full and incremental
ScalPanel uses restic. Every backup is a complete snapshot: you can restore any one of them on its own, without the ones before it. The storage is incremental: a new snapshot stores only the data that changed since earlier snapshots in the same repository, and identical data is stored once.
There is no choice between full and incremental modes: every snapshot is both.
Full account backups
Customers can make a full account backup in the hosting panel, up to 3 a day. It backs up every website, database and mail domain of the account at once and saves a description of the account's settings: websites, domains, DNS zones, cron jobs, databases and their users, mail domains, mailboxes and forwarders. The description holds no passwords, keys or tokens.
It downloads as one .tar.gz file, built on the fly, with the files, the database dumps and the mailboxes in plain formats you can open anywhere.
A live account's parts are restored one by one from their own backups. A terminated account is restored in one step (see below).
Where backups are stored
Backups go to the backup store, a restic REST server that runs on your ScalPanel server.
- Each account has its own repository for websites and databases, and a separate one for mail, each with its own random key.
- The keys are encrypted with the server's keyring and handed to a node or mail server only for the task it runs.
- Nodes and mail servers can only add backups. They cannot delete or change existing ones, so a compromised node cannot erase history.
- Only the control plane can remove old backups.
Encryption
restic encrypts every backup with AES-256 and authenticates it with Poly1305. An account's backups cannot be read without that account's key. MariaDB dumps are streamed straight into the repository and never written to disk in plain text.
Retention
Retention is set per package, in layers like cPanel's daily, weekly and monthly backups:
- every backup of the last 24 hours;
- the newest backup of each day for the backup retention (14 days by default, at most 365);
- the newest backup of each week for weeks a weekly backup is kept (0 by default, at most 520);
- the newest backup of each month for months a monthly backup is kept (0 by default, at most 120).
For example, hourly backups with 7 days, 4 weeks and 12 months keep 24 hourly, 7 daily, 4 weekly and 12 monthly restore points. Only changed data takes space. Once a day, ScalPanel removes the rest and frees their space. The newest good backup of each live website, database and mail domain is always kept.
A deleted website's backups are kept until they expire, so its files can still be restored into another website.
When you terminate an account, its backups are kept for 7 days by default (Tweak settings → Keep backups of terminated accounts, 0 to 90 days), then removed. With 0 they are removed within about a minute, as before.
Restoring a terminated account
As an account is terminated, ScalPanel records a restore point: the newest backup of each of its websites, databases and mail domains, the description of its settings, and its owner's and mailboxes' password hashes, encrypted with the server's keyring. Nothing new is backed up, so the restore point is as recent as the last backups.
To restore it, open Accounts → Transfers → New transfer → Restore a terminated account, click Restore, choose the owner and the package, optionally Check compatibility, and start it. The account is made again with its websites, domains, DNS records, databases, mailboxes and their mail, forwarders, mailing lists and cron jobs. The owner and the mailboxes keep their passwords. Its domains must be free on this server.
Once a week, ScalPanel checks each repository's structure and reads a random 5 % of its data. A failed check raises a critical alert for you, not for the customer, and shows up in the security advisor.
Restore drills. After a repository passes its weekly check, ScalPanel also reads back, in full, the newest backup of one of its websites, databases or mail domains, picked at random, exactly as a restore would read it. Nothing is written anywhere, and the live website, database or mailbox is not touched. The drill checks that every block decrypts and authenticates, that it reads as many files and bytes as the backup recorded, and that a database dump is complete. A failed drill raises the same critical alert as a failed check. Parts larger than 20 GiB are skipped. Each check's message (in the alert, and in the security advisor) names the part drilled and what was read.
What can be restored
| From | Restore options |
|---|---|
| A website backup | The whole website or one file or folder, into a new folder or over the current files. Files not in the backup are kept. |
| A deleted website's backup | Into a new folder of another website of the same account |
| A database backup | Over the current database. A MariaDB backup can also go into a new database, leaving the current one untouched. |
| A mail backup | One mailbox, into a new folder named Restored-<date>-<time>. Nothing in the mailbox is overwritten. |
Every backup can also be downloaded: a website as .tar.gz, a database as .sql.gz and a mail domain as .tar.gz of its mailboxes. Customers can browse a website backup's files before restoring.
Restores run as the website's own user inside its own folder, and database restores use an account that can touch only that one database.
While an account is suspended, its customers cannot start or restore backups, but backups keep running and staff above the account can still download them. In the admin panel, an account's Email tab shows its mail backups. For website, database and full account backups, use Sign in as owner on the account and work in the hosting panel.
Off-site copies
Backups on the same server are lost with the server. Add off-site destinations under Backup → Off-site backups → Add destination. You can use up to 10 at once, each with its own schedule and retention:
- a ScalPanel backup node or any restic REST server (
https://, orhttp://on a private network only); - Amazon S3 or other S3-compatible storage, with endpoint, bucket, folder, region and keys;
- an SFTP server, with a private key and the server's pinned host key;
- an FTP server, always over TLS:
ftp://for explicit TLS,ftps://for implicit TLS; its certificate must be valid; - Google Drive, in a folder of the Google account you authorize (see below).
Every day at each destination's hour (UTC), or at once with Copy now, ScalPanel:
- copies every account's website, database and mail repositories to the destination, sending only new data after the first copy;
- dumps the control-plane database, which holds the repository keys, accounts and settings, into its own repository at the destination;
- removes copies older than the destination's retention (30 days by default, 1 to 3,650).
Copies keep their encryption, whatever the destination. The destination's password, key or token is stored encrypted and never shown again. If a run fails or only partly succeeds, you get an alert for that destination until its next successful run. Removing a destination stops the copies; the copies already there are not deleted.
A backup node of your own
A second server with enough disk can hold the copies, behind HTTPS with a Let's Encrypt certificate. Follow Adding servers → Backup node; it takes two steps.
Google Drive
Run rclone authorize "drive" on a computer with a browser (rclone is a single program), sign in with the Google account that should hold the copies, and paste the JSON it prints as the destination's token. Enter a folder name such as scalpanel-backups. The token lets ScalPanel read and write that account's Drive; use an account made for the backups. For many accounts or large copies, create your own OAuth client in Google Cloud and paste {"client_id": "...", "client_secret": "...", "token": {...}} instead, to avoid the shared client's limits.
Warning: Keep a copy of the keyring file, /etc/scalpanel/secrets/keyring, off the server and apart from the off-site copies. Without it, the copies cannot be opened. With it and the destination's credentials, a new server can be rebuilt.
Recovering a lost server
You need the lost server's keyring file and an off-site destination it copied to.
- Install ScalPanel on a new server, as for any installation.
- Write the destination into a file, with the same fields as Add destination, for example
/root/destination.json:json {"kind": "rest", "url": "https://backup.example.com", "username": "scalpanel", "secret": "the destination's password"}S3, SFTP, FTP and Google Drive destinations take their own fields (region,bucket,prefix,host_key). - Run, as root:
bash sudo scalpanelctl recover --from /root/destination.json --keyring /root/keyring --restore-accountsIt asks you to typeRECOVER, then:- finds the newest control-plane copy the keyring opens (
--snapshot <id>picks an older one); - saves this new server's own database in
/var/lib/scalpanel/backups, then restores the copy and checks that every secret in it decrypts with the keyring; - gives the restored settings this server's database password and address;
- enrolls this server's node in place of the lost one, so the websites stay where they were;
- copies every account's backups back from the destination;
- sets up the websites, databases, DNS zones and mail domains again;
- with
--restore-accounts, restores every website, database and mail domain from its newest backup and waits for them.
- finds the newest control-plane copy the keyring opens (
- Delete
/root/destination.jsonand/root/keyring.
Sign in with the lost server's users and passwords. Without --restore-accounts, bring the accounts back later, all at once or a few at a time: sudo scalpanelctl recover-accounts [account-id...]. Nodes and mail servers on other servers are linked again with scalpanelctl link add.
The updater also keeps the last three database dumps it makes before each update in /var/lib/scalpanel/backups on the server.
What ScalPanel does not offer
- A time of day chosen per account (the times are spread automatically).
- Rebuilding a deleted website (its domains and settings) from a backup.
- Restoring a terminated account after its backups were removed.