Postgres backups and recovery on xhostd
xhostd backs up each Postgres database nightly and takes a snapshot before every deploy. See retention per plan and what a database restore does not cover.
xhostd saves a copy of your app's Postgres database every night and again before every deploy. If something goes wrong, you can go back to one of those copies.
Each copy is a snapshot, also called a recovery point: your data as it was at one moment. xhostd takes them for every channel that runs code. A channel is one running copy of your app.
Who this is for
Your app stores data that your users care about. For example:
- a booking app where a bad change could erase appointments
- an online shop whose orders you can't lose
- a bot that records daily stats in a table
Read this before a risky change, so that you know what you can go back to.
How it works
- Nightly snapshots. Once a day, xhostd saves each project's database and its files. A static site has no database, so it has nothing to save.
- Pre-deploy snapshots. Before each deploy, xhostd saves the database as it stood right before the deploy changed anything.
- Each pre-deploy snapshot names its deploy. To undo the data changes of one deploy, choose the snapshot marked with that deploy, not the newest one.
- A restore replaces the data. The channel's data becomes the snapshot's data.
How long xhostd keeps snapshots
| Plan | Nightly snapshots | Pre-deploy snapshots |
|---|---|---|
| Basic (free) and Starter (accounts that an AI coding agent created) | 24 hours | Last 1 |
| Builder, Indie, Studio, Pro | 7 days | Last 3 |
xhostd always keeps a project's newest nightly snapshot, however old it is. The pricing page states the current figures for each plan.
What a snapshot doesn't cover
- It isn't continuous. You go back to a snapshot, not to any moment between two snapshots, so a restore loses the writes made after its snapshot.
- It doesn't restore your code. A database restore changes data only, and rolling back code doesn't restore data.
- It doesn't always include matching files. The console shows whether a snapshot's files match its database.
- It doesn't replace your own copy. A snapshot lives on xhostd and expires with your plan's window. Download a copy of important data, and keep it somewhere that you control.
Restore safely
- You can always restore production yourself in the console. An agent can restore it only while you allow agent access.
- A restore replaces the data, and it saves no copy of what it replaces.
- xhostd can pause database restores. If xhostd refuses a restore, contact support.
Before a risky change, test it in a preview channel, which has its own database. Read Preview and staging environments on xhostd. After a restore, open the app and check its data.
Next step
When you need to review recovery points, restore data, or export a copy, read Data and recovery.
Technical notes
- Restore window. You can restore a snapshot for at least 12 days. An older pre-deploy snapshot can still appear in the list, marked as one that you can't restore.
- Agent access. The project owner turns agent access on in the console, on the project's Access page, or on the Account & billing page for every project that follows the account default. Otherwise, xhostd refuses the agent, and that refusal is the safeguard working. Read Manage agent permissions.