Skip to main content

Backups & recovery

AppHaven is built durability-first: the platform assumes that something (a bad migration, an overeager script, a hardware fault) will eventually go wrong, and treats getting your data back as a core feature. Your production deployment is backed up automatically, with no schedule to wire up. The one choice you make is how long restore points are kept.

What is protected​

Two layers run side by side:

Restore points: everything, consistently. A restore point captures all of a deployment's persistent data, both its volumes and its managed database storage, in a single atomic snapshot. Atomic means the volumes and the database are captured at the same instant, so a restored point is internally consistent: no database that's newer than the files it refers to. Restore points are taken at three moments:

Restore pointTaken
DailyEvery night.
Before deployRight before each new version of production starts, so there is always a point to return to from just before a deploy.
Before restoreRight before production is replaced by a restore.

Continuous database capture: every change, as it happens. For the managed database, AppHaven additionally records its change stream continuously, from the daily restore point before last up to the present moment. That window covers at least the last full day, and up to two days just before the next daily point.

The window starts afresh at two moments:

  • When production is restored. The restored database begins a new history of its own, so the window starts at the restore. The database as it was before the restore stays available through the Before restore point.
  • When the database changes more than its change history has room for. The history has a size limit of its own (see below). When the changes since the daily restore point before last no longer fit, AppHaven starts a complete new record instead of keeping one with a gap. Your app keeps running and writing as usual; only the window starts over.

The Backups section shows since when database changes are kept. It shows Restore points only while a new record does not yet reach back to the daily restore point before last, or when the database has not changed since that point.

The change stream is deliberately stored outside your app's environment, separate from the database itself. A bug that mangles the database, a compromised app, or a deploy gone wrong cannot reach back and damage the record needed to recover from it.

Choosing how long backups are kept​

Open your app's Backups section in the console to set the retention window: how far back your restore points reach. You can keep 7, 14, or 30 days. A longer window gives you more room to recover from a problem you only notice later, and uses more of your storage budget for history. New apps start at 7 days.

The retention window also decides how long the builds of your production versions are kept, so you can run an older version from anywhere in the same window. See App versions.

The Backups section​

The Backups section shows what is protected at a glance: since when database changes are kept and how much storage your restore points use. You set how long restore points are kept under Settings > Backups. Below that are your restore points, newest first and grouped per day, with each Before deploy point naming the deploy it precedes. The tabs narrow the list to the points taken before a deploy or the daily ones.

What you can recover, and to when​

WhatRecoverable to
Managed databaseAny restore point within your retention window
Persistent volume filesAny restore point within your retention window
Application codeAny production version that ran within your retention window, exactly as it was built; beyond that, any commit in your Git history
ConfigurationCurrent manifest in your repository; current Variables & Secrets in the console

Restoring​

You restore from the console yourself: go back to before a deploy, run an older version, or rewind the database, either in place or as a private restore preview next to production. Restoring your app walks through each option.

To bring the database back to a specific moment between two restore points, within the window its changes are kept, contact AppHaven support with the app and the moment you need. "The database as it was yesterday at 14:05" is exactly the right shape of request.

How backups relate to your storage size​

Restore points and the database change history live inside your deployment's storage size: the single number you pick covers your live data and the history kept to protect it. Restore points only store what changed since the previous one, so a point taken before a deploy costs little unless your app rewrites a lot of data. A longer retention window keeps more history, so it uses more of that budget. The database change stream counts too, up to a limit of its own: each managed database's change history can use a quarter of your storage size, or 2 GB if that is more. At the smallest storage size of 5 GB that is 2 GB per managed database, so two databases can use most of the storage for their change history. Once a history reaches its limit it starts afresh instead of growing further, and its window of kept changes starts over. The deployment page shows how much of the budget is in use, split into database, files, and backups.

Choose a storage size with room for your data, its restore points, and the change history of each managed database up to its limit. They all share the one budget, so when it is full, your app's own writes fail as well. Watch the split on the deployment page and increase the storage before it runs out.

The builds of your app versions are kept separately and are not part of this budget; see App versions.

Scope: your production deployment​

Backups protect your production deployment, the one running your production branch. Preview deployments are disposable: each is rebuilt from its branch every time you deploy, so they carry no separate backups, and nothing you try on a branch can consume or contaminate your production history. The same goes for restore previews: each is a copy made from production's restore points, which stay protected on production.

Two lifecycle rules follow from data belonging to the deployment:

  • Stopping a deployment keeps its data and backups. Deploy again and everything is still there.
  • Deleting a deployment removes its data and backups. Delete is the one operation that lets go of your data. If you might want it later, stop instead, or take an export first (Application portability covers how).

Where to go next​