Backup & Restore
Back up and restore OpenBee data, including the database, configuration, and state files
Overview
The openbee backup and openbee restore commands let you create and restore complete snapshots of your OpenBee installation. A backup archive includes:
- openbee.db — the main database
- config.yaml — your configuration file
- ~/.openbee/ — runtime state (logs, PID file, etc.)
Backups can optionally be encrypted with a password using AES-256-GCM.
Cross-platform limitation: Backup archives created on Windows cannot be restored on Linux or macOS, and vice versa. Always restore a backup on the same operating system family it was created on.
Backup
Syntax
openbee backup [output-dir] [flags]Arguments
| Argument | Description | Default |
|---|---|---|
output-dir | Directory where the backup archive will be written | . (current directory) |
Flags
| Flag | Description | Default |
|---|---|---|
-c, --config <path> | Path to the config file | config.yaml |
--password <password> | Encrypt the backup archive with this password | (none — no encryption) |
Output file naming
- Unencrypted:
openbee-backup-YYYYMMDD-HHMMSS.tar.gz - Encrypted:
openbee-backup-YYYYMMDD-HHMMSS.tar.gz.enc
Examples
# Back up to the current directory
openbee backup
# Back up to a specific directory
openbee backup /path/to/backups
# Back up with encryption
openbee backup --password "my-secure-password" /path/to/backups
# Use a custom config file
openbee backup -c /etc/openbee/config.yaml /path/to/backupsEncrypted backup archives are written with 0600 permissions (owner read/write only). Store your password securely — without it, the backup cannot be decrypted.
Restore
Syntax
openbee restore <backup-file> [flags]Arguments
| Argument | Description |
|---|---|
backup-file | Path to the backup archive (.tar.gz or .tar.gz.enc) — required |
Flags
| Flag | Description | Default |
|---|---|---|
-c, --config <path> | Path to the config file | config.yaml |
--password <password> | Password to decrypt an encrypted backup | (required for .tar.gz.enc files) |
--force | Overwrite existing data if the database already exists | false |
Behavior
- If the OpenBee daemon is running, it is automatically stopped before the restore begins.
- All files extracted from the archive are verified against SHA256 checksums stored in the archive's manifest. If any checksum fails, the restore is aborted.
- If the backup was created with a different version of OpenBee, a warning is printed but the restore continues.
Examples
# Restore from an unencrypted backup
openbee restore /path/to/backups/openbee-backup-20260330-143000.tar.gz
# Restore from an encrypted backup
openbee restore --password "my-secure-password" /path/to/backups/openbee-backup-20260330-143000.tar.gz.enc
# Force overwrite existing data
openbee restore --force /path/to/backups/openbee-backup-20260330-143000.tar.gz
# Use a custom config file path
openbee restore -c /etc/openbee/config.yaml /path/to/backup.tar.gzWithout --force, the restore command will fail if a database file already exists at the configured path. Use --force to intentionally overwrite existing data.
Recommended Backup Workflow
A simple approach for regular backups is to run the backup command on a schedule and keep a rolling set of archives:
# Create a daily backup in a dedicated directory
openbee backup ~/openbee-backups
# List available backups
ls -lh ~/openbee-backups/To migrate OpenBee to a new machine:
- Create a backup on the old machine:
openbee backup --password "secret" ~/openbee-backups - Transfer the archive to the new machine.
- Install OpenBee on the new machine.
- Restore the backup:
openbee restore --password "secret" ~/openbee-backups/openbee-backup-YYYYMMDD-HHMMSS.tar.gz.enc