Backup and restore
As a system administrator, open System → System Settings → Backup on a single gateway. Manual and scheduled backups run online. An in-place restore temporarily closes gateway listeners and interrupts console and client connections.
Choose storage and set a schedule
In the object storage settings, enter the S3-compatible HTTPS endpoint, region, bucket, and credentials. Enter the endpoint as a scheme, host, and optional port. Set an object prefix if needed. Loopback IP addresses can use path-style HTTP. Select Test connection before saving. The database holds the backup settings and archive catalog. Completed archives are stored in object storage. In Docker, /app/backups holds temporary job files and restore checkpoints.
Choose an IANA time zone from the searchable list in the schedule editor. Search by zone ID or a common city name shown in the list. Scheduled Backup runs daily at 00:00 in Asia/Shanghai by default and keeps 7 days of backups. Retention can be set to 1 through 365 days. If a job is active at the scheduled time, the backup runs once the gateway is idle that same day. Service startup and schedule changes take effect at the next scheduled time. When daylight saving time skips a scheduled time, the backup runs at the first valid time that day. When a clock change repeats the time, the first occurrence applies.
Common S3 endpoints
Use the signing region expected by the storage service. For self-hosted services with a private CA, add that CA to the gateway's trust store. Virtual-hosted addressing requires DNS and a matching TLS certificate for the bucket hostname.
| Storage service | S3 endpoint and signing region | Addressing style |
|---|---|---|
| Aliyun OSS | For example, https://oss-cn-chengdu.aliyuncs.com with region oss-cn-chengdu | Standard regional endpoints use virtual-hosted addressing automatically |
| AWS S3 general purpose buckets | https://s3.<region>.amazonaws.com and the bucket's region | Choose based on the bucket name and certificate |
| Cloudflare R2 | https://<account-id>.r2.cloudflarestorage.com with region auto | Path-style |
| Backblaze B2 | S3 endpoint and region shown in the console, with an S3-compatible Application Key | Path-style or virtual-hosted |
| Tencent Cloud COS | Regional endpoint with S3 signing, the actual region, and a bucket name ending in -<APPID> | Virtual-hosted |
| MinIO, Ceph RGW, Garage | Self-hosted S3 API root URL and the configured signing region | Match the deployment |
Test connection writes a temporary object, reads it back for verification, and deletes it. Archives over 8 MiB use multipart upload. Grant the credentials permission to write, complete, and abort multipart uploads.
Create and download an archive
Select Manual Backup to submit a job. Check Backup Records, then download the completed .tar.gz. Each archive contains the configured SQLite, MySQL, or PostgreSQL database's schema and data as a logical dump at database.sql. The same .tar.gz includes an integrity manifest. Managed certificates, keys, and runtime settings are in the database dump. Files in logs/ are disposable operational logs. Back up startup configuration and explicitly configured external inputs separately. Keep the root private key offline.
Downloads verify archive size and SHA-256. Retry an incomplete download if the transfer fails. The archive uses gzip compression. Restrict access to archives because the database contains sensitive data, including managed keys. Existing S3 archives use the storage settings and credentials recorded at creation. Plan credential rotation around the retention period for those archives. Data and log paths
Delete a backup
In Backup Records, select Delete and confirm. The server uses the storage settings and credentials recorded for the archive to send a single-object delete request to its original bucket. It removes the backup record once the object is deleted or confirmed missing. If the storage request fails, the record remains available for retry after access or connectivity is restored. Wait for any active backup or restore job to finish before deleting.
Scheduled retention also removes expired archives and their records. When the bucket has versioning enabled, older object versions may remain until the bucket lifecycle rule expires them. Backup delete endpoint
Restore by replacing current data
- Select Restore on a completed record and review the overwrite scope. Confirm with the administrator's two-factor code or the current password if two-factor authentication is off.
- Restore requires an archive from the same database engine and with the current schema. It replaces the database and removes application records created after the backup. It reverts the backup policy and retains the current archive records. Use the software version that created an older archive to restore it.
- Restoration revokes all existing login sessions. When the gateway returns, sign in with the administrator credentials from the backup. Reopen the backup page and check the latest restore result, client connections, and mappings. Accounts, two-factor authentication settings, devices, and grants return to the backup point. Recovery codes used or invalidated after that point may become valid again. Review and reapply subsequent suspensions and revocations before reopening public endpoints. Controlled recovery after a security incident
Restore from object storage on a new host
Prepare an empty database of the same engine, a separate working directory, and read-only S3 credentials. With the archive object key, run server restore-from-s3 --database sqlite --data-path ./data --s3-config ./s3-readonly.json --object-key 'backup/archive.tar.gz' --work-dir ./restore-work. For MySQL and PostgreSQL, use mysql or postgres and point TUNNEL_DATABASE_URL at the isolated empty database. Use --sha256, --size, or --version-id when you have a trusted digest, archive size, or fixed object version. The source archive remains in object storage. Record the returned recovery_id. The imported database is sealed. Using the same database settings, run secure-recovery enter --confirm-isolation, verify the materials, and complete controlled recovery. Command reference · Controlled recovery
Database tools
For native installations, make the required tools available on the server process's PATH. Containers use their own installed tools.
| Database | Backup and restore tools |
|---|---|
| SQLite | sqlite3 |
| MySQL | mysqldump and mysql, with mariadb-dump and mariadb as fallbacks |
| PostgreSQL | pg_dump and psql |
When using MariaDB native tools, the MySQL REQUIRED, VERIFY_CA, and VERIFY_IDENTITY modes verify the database server certificate. Use a certificate from a trusted CA and a database host name covered by that certificate. Management API