Backup & restore
OtoDock ships two small scripts, backup.sh and restore.sh. They need only Docker and the
running stack, so they work for every install method. On a Docker install, download them next
to your compose file, and again after each upgrade:
curl -fsSLO https://raw.githubusercontent.com/OtoDock/oto-dock/main/scripts/backup.sh
curl -fsSLO https://raw.githubusercontent.com/OtoDock/oto-dock/main/scripts/restore.sh
chmod +x backup.sh restore.sh
On a source install they are already there, at scripts/backup.sh and
scripts/restore.sh.
Taking a backup
A backup is one command, safe to run while OtoDock is live:
./backup.sh
It writes one folder under backups/ with everything a restore needs: the database, your
.env, the agents' files, the SSH keys and the connected accounts' sign-in tokens. Keep that
folder as private as .env itself, and copy it off the server, so losing the server doesn't
lose it. Installed community tools and skills are not in it: reinstall them from the catalog.
Scheduling and keeping backups
Run it from cron or a systemd timer, from the install folder:
# every night at 03:15
15 3 * * * cd /srv/otodock && ./backup.sh >> backup.log 2>&1
Each run removes old backups and keeps the newest 14. Only the newest 3 keep the agents' files.
OTODOCK_BACKUP_RETAIN changes the 14, and OTODOCK_BACKUP_DIR names another folder, ideally on
another disk.
Restoring
Stop the OtoDock server (leave PostgreSQL running), restore, then start it again:
docker compose stop otodock-proxy # native: sudo systemctl stop otodock-proxy
./restore.sh ./backups/otodock-<version>-<date>-<time>
docker compose up -d # native: sudo systemctl start otodock-proxy
The script asks you to type yes, then replaces the database, the agents' files, the SSH
keys and the sign-in tokens with the backup's. OtoDock brings the database up to date at
its next start. If the script refuses, it says why and what to do.
Moving to a new server
- In an install folder on the new server, put the old install's
docker-compose.ymlanddocker-compose.phone.yml, and the backup'senvfile as.env. Change the ports andDASHBOARD_PUBLIC_URLif they differ. If you lost the old server, download the two compose files fromhttps://raw.githubusercontent.com/OtoDock/oto-dock/v<version>/, with the version in the backup folder's name. - On Ubuntu 24.04 or newer, download
scripts/setup-apparmor-userns.shfrom the same address and run it withsudo. - Run
docker compose up -d, thendocker compose stop otodock-proxy. - Copy the backup folder over and run
./restore.shon it. - Run
docker compose up -d.
The connected accounts come back with it, since the backup's keys came along in .env.
Next steps
- Upgrading →: the upgrade script takes its own backup first.
- Configuration →: settings and where data lives.