A backup strategy for self-hosted apps (3-2-1)
A practical backup plan for self-hosted apps: the 3-2-1 rule, what to back up, consistent database copies, encryption, restore tests, and what Keenrig does.
Self-hosting moves one job from a vendor to you: keeping your data when things go wrong. Disks fail, providers lose servers, updates corrupt databases, and people delete the wrong thing. A backup strategy is the plan that turns each of those into an inconvenience instead of a loss.
The 3-2-1 rule
- 3 copies of your data: the live one and two backups.
- 2 different kinds of storage, so one failure mode cannot take both — for example the server’s disk and an object storage bucket.
- 1 copy off-site, away from the server and ideally from the provider, so a lost account, a fire or a ransomware attack does not reach it.
Many people add one more rule: at least one copy that cannot be changed or deleted for a while (object lock, or a backup host that pulls instead of being pushed to). If an attacker gets root on your server, they also get every credential stored on it — including the ones to your backup bucket.
What to back up
- App data: the volumes or directories where each app writes.
- Databases, captured consistently (see below).
- Secrets and keys: encryption keys apps generate, environment files, the platform’s own keys. Data encrypted with a key you no longer have is noise.
- Configuration: which apps, which versions, which domains — enough to rebuild the server, not only refill it.
You usually do not need to back up container images or the operating system; you can pull and install those again, as long as you know which versions you were running.
Consistent copies
Copying the files of a database that is writing at the same moment can produce a backup that looks fine and will not open. Use the database’s own tool — pg_dump for Postgres, mysqldump for MySQL and MariaDB, sqlite3 with .backup or VACUUM INTO for SQLite — or stop the app for the length of the copy.
Encrypt, then ship
A backup holds everything an attacker would want, so encrypt it before it leaves the server, with a passphrase that is stored somewhere other than the server — a password manager, or a sealed note. Tools such as restic and Borg do encryption and deduplication for you; rclone moves files to almost any storage provider.
Retention
Keep more than the latest copy. A problem you notice two weeks late needs a backup from three weeks ago. A common pattern is 7 daily, 4 weekly and 6 monthly copies; adjust to how fast your data changes and what storage costs you.
Where to keep the off-site copy
Any S3-compatible object storage works for the off-site copy, and it is usually the cheapest durable option per gigabyte. Common choices among self-hosters are Backblaze B2, Cloudflare R2, Wasabi, AWS S3 and the storage products of the VPS providers themselves; compare their current storage and egress prices, since restoring means downloading everything at once.
- Use a different provider from the one running your server, so one account problem cannot take both.
- Create a key that can only write to one bucket, not one that can list and delete everything in your account.
- Turn on versioning or object lock if the provider offers it, so a compromised server cannot erase older backups.
- Write down, outside the server, which bucket, which region and which passphrase. In a real disaster you will be reading that note, not the server.
Test the restore
A backup you have never restored is a hope, not a backup. At least every few months, restore onto a blank machine — a cheap VPS by the hour is enough — and check that the apps start, users can sign in and recent data is there. Time it: that number is how long you will be down on a bad day.
What Keenrig does today
Keenrig keeps every app’s data in directories under one root on the server, so one backup can capture everything. Backups run as commands on the server as of 10 November 2026:
- A backup command takes a snapshot of the whole server — the platform database, its keys and each app’s data — and uploads it to a target you configure: a folder on the server, a mounted NAS, or your own S3-compatible bucket.
- Every snapshot is encrypted (AES-256-GCM, with a key derived from your passphrase using argon2id). There is no way to turn encryption off, because the snapshot contains the server’s master key.
- A list command shows the complete snapshots on the target.
- A restore command works on a blank server, even before Keenrig is running. It can restore everything, or only the apps you name, and it refuses to overwrite a directory that already holds data.
- The Backup page in the admin panel prints these commands ready to copy for your server.
Mapping that to 3-2-1: the live data is copy one; a snapshot to a local folder or NAS is copy two; a snapshot to an S3 bucket at a different provider is copy three and your off-site copy. Keep the passphrase off the server.
Limits, today
- No built-in schedule yet. Scheduled backups are in progress; until then you run the command yourself or from your own cron job or systemd timer.
- Managed backup storage in Keenrig Cloud has not launched; the targets are storage you own.
- If an app uses a separate managed database add-on, that database’s dump is not included in the command yet.
- Keenrig does not alert you when a backup fails. Check the command’s output or have your timer report errors.
curl -fsSL https://get.keenrig.com | sudo sh