Self-hosting / Back up and restore the configuration
Back up and restore the configuration
Export monitors, notification channels, maintenance windows, status pages and announcements to a JSON file, and restore them on the same instance or another one.
Since v1.6.4, an admin can export the configuration of an instance to a JSON file and restore it on the same instance or on another one. Use it to keep a copy before a big change, to move to a new server, or to copy the same monitors to another instance.
Backup and restore is for admins only.
What a backup contains
| Included | Not included |
|---|---|
| Monitors | Check history |
| Notification channels | Incidents |
| Maintenance windows | Uptime rollups |
| Status pages, with their custom domain | Users |
| Announcements | Settings |
A backup holds the configuration, not the data. To keep everything, history and incidents included, back up the PostgreSQL database with pg_dump:
pg_dump -h <host> -U <user> -d <database> -F c -f uptime-kotlin.dumpDownload a backup
Open your profile menu at the bottom of the sidebar, choose Settings, then Backup.
- In the download card, choose how secrets are exported: see Secrets.
- Download the file. It is named
uptime-kotlin-backup-YYYY-MM-DD.json.
Restore a backup
In the same Backup tab:
- Drop the JSON file in the restore card.
- Choose what to do when an item already exists: see Conflicts.
- Read the preview report. Nothing has been written yet.
- Confirm to restore.
Each item is checked with the same rules as when you create it by hand:
- valid items are restored together, in a single transaction;
- invalid items are listed in the report and skipped;
- if a write fails, nothing is kept.
Links between items, such as a monitor and its notification channels, are kept: they point to the new items on the target instance.
The report
Each item of the report can carry one of these codes:
| Code | Meaning |
|---|---|
ALREADY_EXISTS |
An item with the same name already exists on this instance. |
UNKNOWN_REFERENCE |
The item points to another item that is not in the file. |
INVALID |
The item does not pass validation and is skipped. |
Conflicts
An item already exists when one with the same name is found, or the same slug for status pages. Two options:
- Skip: the existing item is kept, and the restored items are linked to it.
- Rename: a copy is created with a suffix, for example
API (2).
Secrets
Stored secrets, such as database passwords and webhook tokens, are exported in one of two ways:
- Encrypted, the default: the file can only be restored on an instance that uses the same
ENCRYPTION_MASTER_KEY. Webhook URLs (Slack, Discord, Teams, Webhook), and the headers, request bodies and credentials of HTTP monitors, stay in clear in the file even in this mode. - Plain text: secrets are written in clear in the file. Use it to move to an instance with another master key.
A backup always contains some secrets in clear, and a plain-text one all of them. Keep the file somewhere safe and delete it once the restore is done.
Good to know
- Push monitors get a new URL after a restore: update the services that call them. The report says which monitors are concerned.
- A backup made with a newer version of Uptime Kotlin cannot be restored on an older one. Upgrade the target instance first.
- Restore is disabled in demo mode.
API
The same features are available through the API, with an admin account.
| Method | Endpoint | Parameters |
|---|---|---|
GET |
/api/backup |
secrets=encrypted (default) or secrets=plain |
POST |
/api/backup/restore |
dry_run=true (default) or dry_run=false, on_conflict=skip or rename |
With dry_run=true, the API only returns the report and writes nothing. Send dry_run=false to restore.
