backupctl backs up OTOBO Docker installations (Docker Compose V2) and arbitrary directories with
restic into an S3 storage. Backups are encrypted, deduplicated and compressed,
so after the first run only changed data is uploaded.
- Bash 5,
restic0.16 or newer,yq(the jq based Python variant from the Ubuntu/Debian package) - Docker, OTOBO runs in Docker containers
apt install -y yq resticbackupctl must run as root.
install -m 755 backupctl /usr/local/sbin/backupctl
install -d -m 700 /etc/backupctl
install -m 600 backupctl.example.yml /etc/backupctl/backupctl.yml # then edit it
install -m 644 systemd/backupctl.service systemd/backupctl.timer /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now backupctl.timerThe configuration is read from /etc/backupctl/backupctl.yml, another file can be given with
backupctl --config PATH <command>. See backupctl.example.yml for a commented example.
| Setting | Description |
|---|---|
storage.endpoint |
S3 endpoint, without scheme https is used |
storage.bucket |
S3 bucket |
storage.host |
Optional, defaults to hostname -f. Part of the repository path, set it after renaming a server or when restoring on a new server |
retention.keep_* |
Versions kept by forget: keep_last, keep_hourly, keep_daily, keep_weekly, keep_monthly, keep_yearly. Applies to all profiles |
credentials.encryption_secret |
Password of the restic repository. Without it no backup can be restored, store it safely outside the server |
credentials.s3_username, s3_password |
S3 access key and secret |
Each server gets its own repository: s3:<endpoint>/<bucket>/<host>.
| Type | Settings | Backs up |
|---|---|---|
otobo |
container (web container, e.g. otobo-web-1) |
Database, Kernel/Config.pm, Kernel/Config/Files, Custom, var |
dir |
path |
the directory |
For otobo profiles the database credentials are read from Kernel/Config.pm. Only MySQL/MariaDB
with an unencrypted password is supported. The dump runs in the web container with the OTOBO
database user, so no database root password is needed. The OTOBO home on the host is determined
from the volume mounted at /opt/otobo.
The password is passed via environment, never on a command line. The database is streamed into
restic, no dump is written to disk.
Each otobo backup creates a backup run of two snapshots (database and files) that belong
together. If one part fails, the whole run is removed again. Only if single files can't be read, the
run is kept and the backup is reported as failed.
Articles stored in the file system outside of var/ (setting
Ticket::Article::Backend::MIMEBase::ArticleDataDir) are backed up as well. The directory
must be on a volume or bind mount, otherwise it is skipped and the backup is reported as failed.
On restore the articles are written to the article directory of the restored configuration.
Add a dir profile for the directory with docker-compose.yml and .env
(usually /opt/otobo-docker).
| Command | Description |
|---|---|
backupctl profiles |
List the configured profiles |
backupctl backup PROFILE... | --all |
Create backups |
backupctl snapshots PROFILE |
List the backups of a profile, for otobo one line per run |
backupctl forget PROFILE... | --all [--keep N] [--dry-run] |
Remove old backups according to retention, or keep the last N |
backupctl restore PROFILE [SNAPSHOT] [options] |
Restore a backup, see below |
backupctl prune [-y] |
Remove all backups of this server |
Run backupctl <command> --help for all options. All commands exit with 1 if something failed.
The systemd timer runs backup --all and then forget --all every night between 02:00 and 03:00.
Old versions are only removed if all backups succeeded.
systemctl list-timers backupctl.timer # next run
journalctl -u backupctl.service # output of the last runs
systemctl start backupctl.service # run nowWithout SNAPSHOT the latest backup is restored. SNAPSHOT can be a snapshot ID or, for otobo
profiles, a run (run-…) as shown by backupctl snapshots. Restoring asks for confirmation,
-y skips it. Without a terminal and without -y it always aborts.
Existing files and tables are overwritten, files and tables that are not part of the backup are kept.
- Stop the OTOBO daemon and make sure nobody uses OTOBO. The web and database containers must
keep running, the restore uses them:
cd /opt/otobo-docker && docker compose stop daemon
- Restore files and database, then the configuration is rebuilt and the cache deleted:
backupctl snapshots otobo backupctl restore otobo # latest run backupctl restore otobo run-20261126T020012Z # specific run
--files-onlyor--database-onlyrestore only one part. - Start the daemon again:
docker compose start daemon
The files are restored into the current OTOBO home, also when the backup was made on another
server or from another path. To restore on a new server, install OTOBO there, configure the same
storage and credentials and set storage.host to the name of the old server.
To look into a backup without changing anything, write it into a directory:
backupctl restore otobo --target /root/restore # files, database dump and ArticleDataDir/backupctl restore otobo_docker_compose # into the original location
backupctl restore otobo_docker_compose --target /root/restoreWith --target the files end up below DIR/<original path>.