mirror of
https://github.com/nightly-labs/openbot.git
synced 2026-11-26 02:29:31 +08:00
* Add backup, verify and restore commands for Docker instances openbot-instance backup stops the container, writes /data to a compressed archive with a manifest and checksums, and starts the container again. verify unpacks a backup as the data user and checks the databases, the keyring and the counts. restore puts a backup back and keeps the instance stopped. backups shows the state for a monitor. A systemd timer makes a daily backup. scripts/instance-backup-e2e.ts runs the commands in Docker in Docker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Do not follow agent links during a restore The restore made its folders at fixed names in /data and checked them before the container stopped. An agent could put a link there, and root then moved the old data to the link target. The restore now makes each folder with mktemp after the stop. Verification accepts only a number as the schema version, because agents can change the database. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the new backup and report backups that stopped Retention now never deletes the backup that was just made, also when the clock went back, and --verify checks that backup. backups shows a run that ended without a result as stopped and exits with 1. A restore sets its restart trap before the stop, and the script stops when Docker does not answer instead of reading the container as stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Delete old backups only after the new one is verified With --verify, retention now runs after the verification succeeds, so a failed verification keeps all older backups. When a restore has too little free space, the message and the docs tell the operator to move the old data off the disk first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Share the step status code of backup and verify backup and verify_locked now call one run_step function, which records the start, keeps the errors, and writes the result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Take the instance lock in up, down, restart and upgrade These commands could start or stop the container while a backup copied the database or a restore moved files. They now wait for the same lock as updates, backups and restores. lock_instance checks the name first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Record the image version when the container was removed After `down`, the container is gone, and a backup recorded no OpenBot version, so a restore could not refuse an older image. The backup now takes the version and image from the compose configuration. A restore of a backup with no version shows a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>