Skip to content

Commit

Permalink
Add backup/restore docs (#31483)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 3cd61353c04c33c3a9230115f50e26a9a97dd62b
  • Loading branch information
nipunn1313 authored and Convex, Inc. committed Nov 12, 2024
1 parent 2ad0ef4 commit efc23ce
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 66 deletions.
11 changes: 6 additions & 5 deletions docs/dashboard/deployments/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ The
shows the values configured in your `auth.config.js` for user
[authentication](/docs/auth.mdx) implementation.

## Snapshot Export
## Backup & Restore

The
[snapshot export page](https://dashboard.convex.dev/deployment/settings/snapshots)
lets you [export a snapshot](/docs/database/import-export/export.mdx) of the
data stored in your deployment's database
[backup & restore page](https://dashboard.convex.dev/deployment/settings/backups)
lets you [backup](/docs/database/backup-restore.mdx) the data stored in your
deployment's database and file storage. On this page, you can schedule periodic
backups.

![deployment settings export page](/screenshots/deployment_settings_snapshot_export.png)
![deployment settings export page](/screenshots/backups.png)

## Integrations

Expand Down
101 changes: 101 additions & 0 deletions docs/database/backup-restore.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: "Backup & Restore"
sidebar_position: 85
---

Convex supports Backup & Restore of data via the
[dashboard](https://dashboard.convex.dev/deployment/settings/backups).

![Backups Page](/screenshots/backups.png)

# Backups

A backup is a consistent snapshot of your table data and file storage made at
the time of your request.

Take a backup by pressing the "Backup Now" button. This may take a few seconds
or a few minutes, depending on how much data is in your deployment.

Backups are stored for 7 days. You can download or delete backups via this page.

Deployment configuration and other data (code, environment variables, scheduled
functions, etc.) will not be included.

### Periodic Backups

Schedule a periodic daily backup by checking the "Backup automatically" box. You
can select what time of day to have the backup occur.

<ProFeatureUpsell feature="Periodic backups" verb="require" />

### Restoring from backup

Restore from a backup by selecting restore from the submenu of an individual.
You can restore from backups in the same deployment or from other deployments on
the same team by using the deployment selector on the backups page. Restores may
take a few seconds to a few minutes depending on how much data is in your
backup.

Note that restoring is a destructive operation that wipes your existing data and
replaces it with that from the backup. It's recommended that you generate an
additional backup before doing a restore.

# Downloading a backup

You can download your manual and periodic backups from the dashboard via the
download button in the menu.

Alternatively, you can generate an export in the same format with the
[command line](/docs/cli.md#export-data-to-a-file):

```sh
npx convex export --path ~/Downloads
```

The backup comes as a generated a ZIP file with all documents in all Convex
tables in your deployment.

The ZIP file's name has the format `snapshot_{ts}.zip` where `ts` is a UNIX
timestamp of the snapshot in nanoseconds. The export ZIP file contains documents
for each table at `<table_name>/documents.jsonl`, with one document per line.

Exported ZIP files also contain data from [file storage](/file-storage) in a
`_storage` folder, with metadata like IDs and checksums in
`_storage/documents.jsonl` and each file as `_storage/<id>`.

### Using the downloaded backup.

Downloaded ZIP files can be imported into the same deployment or a different
deployment with the
[CLI](/docs/database/import-export/import.mdx#import-data-from-a-snapshot-zip-file).

## FAQ

### Are there any limitations?

Each backup is accessible for up to 7 days.

On the Starter plan, only one backup is stored per deployment. Paid plan
deployments can have many backups with standard usage based pricing.

### How are they priced?

Backups uses database bandwidth to read all documents, and file bandwidth to
include user files. The generation and storage of the backup itself is billed
with the same bandwidth and storage pricing as user file storage. You can
observe this bandwidth and storage cost in the
[usage dashboard](https://dashboard.convex.dev/team/settings/usage). Check the
[limits docs](/production/state/limits#database) for pricing details.

### What does the backup not contain?

The backup only contains the documents for your tables and files in file
storage. In particular it lacks:

1. Your deployment's code and configuration. Convex functions, crons.ts,
auth.config.js, schema.ts, etc. are configured in your source code.
2. Pending scheduled functions. You can access pending scheduled functions in
the [`_scheduled_functions`](/docs/database/advanced/system-tables.mdx)
system table.
3. Environment variables. Environment variables can be copied from Settings in
the Convex dashboard.
63 changes: 2 additions & 61 deletions docs/database/import-export/export.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description: "Export your data out of Convex"
sidebar_position: 168
---

You can export your data from Convex using Snapshot export, which you can find
in the settings page of your project in the dashboard.
You can export your data from Convex by
[taking a backup](/database/backup-restore) and downloading it as a zip file.

Alternatively, you can export the same data with the
[command line](/docs/cli.md#export-data-to-a-file):
Expand All @@ -16,62 +16,3 @@ npx convex export --path ~/Downloads
```

<BetaAdmonition feature="Snapshot export" verb="is" />

When you request an export, Convex will generate a ZIP file with all documents
in all Convex tables in your deployment. This may take a few seconds or a few
minutes, depending on how much data is in your deployment. You can download the
ZIP file by clicking on the link in the Latest Snapshot table.

Each export is a consistent snapshot of your data at the time of your request.
The ZIP file's name has the format `snapshot_{ts}.zip` where `ts` is a UNIX
timestamp of the snapshot in nanoseconds. The export ZIP file contains documents
for each table at `<table_name>/documents.jsonl`, with one document per line.

Exported ZIP files also optionally contain data from
[file storage](/file-storage) in a `_storage` folder, with metadata like IDs and
checksums in `_storage/documents.jsonl` and each file as `_storage/<id>`.

![Latest Export View](/screenshots/deployment_settings_snapshot_export.png)

### Using the snapshot

Exported ZIP files can be imported into the same deployment or a different
deployment with the
[CLI](/docs/database/import-export/import.mdx#import-data-from-a-snapshot-zip-file).

```bash
npx convex import path/to/snapshot.zip
```

### What the snapshot doesn't contain

The snapshot ZIP file only contains the documents for your tables. In particular
it lacks:

1. Your deployment's code and configuration. Convex functions, crons.ts,
auth.config.js, schema.ts, etc. are configured in your source code.
2. Pending scheduled functions. You can access pending scheduled functions in
the [`_scheduled_functions`](/docs/database/advanced/system-tables.mdx)
system table.
3. Environment variables. Environment variables can be copied from Settings in
the Convex dashboard.

## FAQ

### Can I use snapshot export as an automated backup?

Right now, you can only access one export at a time, so this is not an automated
backup system. You are welcome to download your tables routinely, and feel free
to chime in [on Discord](https://convex.dev/community) if you would like to see
better support for backups.

### Are there any limitations?

Each export is accessible for up to 14 days (if no more exports are requested).
There is no limit to how many exports you can request.

Snapshot export uses database bandwidth to read all documents, and file
bandwidth if the export includes file storage. You can observe this bandwidth in
the [usage dashboard](https://dashboard.convex.dev/team/settings/usage) as
function name `_cli/export`. Check the
[limits docs](/production/state/limits#database) for pricing details.
Binary file added static/screenshots/backups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit efc23ce

Please sign in to comment.