Backups for Self-Hosting: Protecting Your Own Data Yourself
You have to provide yourself what a ready-made service used to do for you. This article covers what to include, where to keep it, and how to check that you can restore.
Ren

Procura
What you gave up
- A mechanism that automatically copies data to several locations
- A setup that recovers from hardware failures without users noticing
- A mechanism that lets you restore for a set period after a mistaken deletion
- None of these exist unless you provide them yourself

Procura
What to include

Procura
- The contents of the database (it holds settings and user information)
- Where uploaded files are stored
- Configuration files
- If there are encryption keys, those too (you can't restore without them)

Procura
Where to keep it
What you keep on the same server doesn't count as a backup. Losing the whole server is exactly the situation you want to be ready for. It starts to work only once you also build a mechanism that sends it automatically to somewhere else.

Wilson
- Don't keep it only on the same server
- Sending it to storage at a different provider lets you withstand an account-level accident too
- Narrow the permissions on the storage (in some cases you can make it impossible to delete)
- Keep several generations (if you only overwrite the latest one, a broken state overwrites it)
Check that you can restore
What's really hard about backups isn't taking them but restoring them. You thought you had them, but they were empty; the compression was corrupted; a necessary file was left out of what was included. You can't tell any of these until you try a restore. On the day you set up the backup, actually restore it once to a different location. A backup that skips this is little different from having none.
- Temporarily set up a server for verification
- Restore there and check that the data is complete
- Also measure how long recovery takes
- Write the procedure down, and keep a copy outside the server too
Make it possible to notice that it's working

Procura
- Set up a notification for failures (staying quiet on success is fine)
- Once a month, look at the date of the latest backup by eye
- Check that the file size isn't extremely small
- Also monitor free space at the storage location

Procura

Ren
This article is translated from the Japanese original. If the two differ, the Japanese version is the one we keep up to date.