Skip to content

Backup and restore

Raahi can export its complete configuration as JSON and import that file into another instance. Use this for backups, migrations, or configuration stored in version control.

Terminal window
curl -fsS http://127.0.0.1:9080/api/v1/export \
-H "Authorization: Bearer $RAAHI_TOKEN" \
-o raahi-export.json

The default export omits private keys and other secret values.

An admin can include secrets:

Terminal window
curl -fsS 'http://127.0.0.1:9080/api/v1/export?include_secrets=true' \
-H "Authorization: Bearer $RAAHI_TOKEN" \
-o raahi-export-secrets.json
chmod 600 raahi-export-secrets.json

This file may contain TLS private keys, ACME account credentials, Cloudflare and EAB credentials, consumer secrets, and other sensitive values.

Terminal window
curl -X POST http://127.0.0.1:9080/api/v1/import \
-H "Authorization: Bearer $RAAHI_TOKEN" \
-H 'content-type: application/json' \
--data-binary @raahi-export-secrets.json

Import replaces the current routing configuration and assigns new database IDs where needed. Raahi commits the complete import in one transaction. If any part fails, it keeps the previous configuration.

You can also use SQLite’s backup command or stop Raahi and copy the database. Do not copy only the main database file while Raahi is writing to it. Data may still be present in SQLite write-ahead log files.