Every night
Asphalt OS backs up its server every night at 2:00 AM Eastern: the whole database, with the records of every company on the server, every uploaded file (photos, receipts, recordings and documents), and the server's settings file with the master key. Each database backup is restored into a scratch copy and counted before it is kept, so a backup that would not restore is never called good.
- Every backup file is encrypted before it touches the disk, to a public key that can only encrypt. The private key that opens the backups is kept by Asphalt OS in a password manager, never on the server: it is pasted in only for a restore, and held in memory for the seconds it takes. A stolen or ransomed server gives up nothing from its backups, and the encrypted files are safe to copy anywhere. Without the public key no backup is written at all.
- The uploaded files are copied in full once a week and, the nights between, only the files that arrived since that full copy. Each night's copy of the files is checked file by file against the files on the disk before it is kept.
- Each part of a backup is written only when there is room for it, so a backup never fills the disk the live data is on; when there is not enough room, it says how much space is missing.
- Backups are kept on the server for 30 days, then the oldest are removed.
- Asphalt OS keeps working while the backup runs. A photo uploaded or a mail attachment that arrives meanwhile is in the next night's backup, and a problem with the uploaded files never costs that night's backup of the database: it is kept, and the backup service shows what went wrong.
- An encrypted copy of each nightly backup is kept in Amazon S3, outside the server, in the same Amazon Web Services account and region, with S3 keeping earlier versions. The server copies a backup there only once it has passed its check, and only the encrypted files: nothing readable leaves the server. The copies there are not removed yet: how long they are kept is still to be set.
- A nightly backup that stopped makes the backup service unhealthy, and the server's own health check reports that, and how old the newest backup is on the server and in S3, to Amazon's monitoring.
Restoring
A restore brings back the whole server. Every company on it goes back to the moment of that backup, together, and anything any company entered since then is lost. So a restore of the whole server is for a server that is lost or broken. To undo one company's mistake (a mass delete, a bad import), Asphalt OS puts that company alone back to a backup while every other company carries on: what has gone out since (a message sent, a person taken off, a link turned off, a STOP) stays as it is, everyone at that company signs in again, and the company stays suspended until we have checked it with its owner.
Asphalt OS can:
- Check a backup without any key: that it is a proper encrypted file, untouched.
- Restore a database backup, for the whole server. It asks us to type RESTORE and paste the private key from the password manager (used in memory for the seconds it takes), restores into a scratch copy first, and keeps the old database under another name. If the restore stops before it swaps the databases (a wrong key, a damaged file, a check that failed), nothing was changed and Asphalt OS starts again by itself.
- Put uploaded files back. Files already there are kept.
- Bring the settings file back from a backup, so a whole new server can be rebuilt from the copy in S3.
An update refuses to run without a backup less than 24 hours old, and takes one more itself, with Asphalt OS stopped, right before it changes the database. If the update fails there, nothing is lost: either the previous version comes back by itself, or that backup is restored, which puts the whole server back to the moment just before the update.
The master key on the server locks every uploaded file, every saved service key, every stored Social Security number and every phone's notification sign-up. It travels with the backup set (the settings file in each set is encrypted like the rest), and a database backup refuses to be restored under a different key. Asphalt OS can replace it while it is still there (if it may have been seen): everything is locked again under the new key at once, nothing else changes, and your history log says so. If it is truly lost, the files uploaded before are unreadable for ever, everyone sets two-factor up again, the service keys are entered again on Connections, and each person enters their Social Security number again.
If a backup fails, it is tried again the next night, and the server takes one by itself when it starts and the newest is older than a day. Asphalt OS can take one by hand in the meantime.