feat: add backup and restore for Docker Compose#2
Open
shanzez wants to merge 3 commits into
Open
Conversation
Add backup.sh, restore.sh, and a guide for backing up and restoring a Docker Compose deployment. - backup.sh takes a cold snapshot: stops the stack, archives the CockroachDB and MinIO volumes plus config and secrets, then restarts - restore.sh replaces volumes and config from a backup, with a confirmation prompt and a stop-before-overwrite safeguard - skip the rebuildable search index and transient event log by default (--full includes them), matching the Helm chart's backup scope - document both in guides/backup-restore.md and link from the README Addresses the recurring need for a documented Compose backup path (upstream huly-selfhost #273, #223, #62). Signed-off-by: Exaviz <info@exaviz.com>
added 2 commits
June 30, 2026 19:25
Two fixes found by running this against a real deployment: - Resolve data volumes by mount destination as a fallback, not only by a hardcoded service name. Deployments that name the database service 'cockroachdb' (instead of 'cockroach') were silently skipped, producing a backup with no database. Now scans all project containers for the destination when the expected service name is absent. - Always restart the stack via an EXIT trap. With 'set -e', a failure while archiving (after the stack was stopped) exited without restarting, leaving the deployment down - unacceptable for a scheduled backup. The stack is now brought back up even on failure, and as soon as the volume archive finishes on success (minimizing downtime). Also make volume resolution safe under 'set -e' (a not-found lookup no longer aborts the script). Signed-off-by: Exaviz <info@exaviz.com>
Add an --offsite flag to backup.sh that uploads each completed backup to S3-compatible storage via rclone (Backblaze B2, DO Spaces, AWS S3, MinIO, etc.), so backups are not stranded on the same host as the deployment. - creds via a gitignored backup-offsite.env (example provided); env-var names match the Helm chart's backup CronJobs for consistency - upload runs in a throwaway rclone container, nothing extra to install - remote retention via bucket lifecycle policy (documented) - backups/ and backup-offsite.env added to .gitignore - documented in guides/backup-restore.md Validated: rclone upload of a full backup (db + files + config + manifest) to a MinIO target, bucket auto-created. Signed-off-by: Exaviz <info@exaviz.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1.
Adds a documented backup/restore path for Docker Compose deployments, which currently have none (the Helm chart already has scheduled backups).
What
backup.sh- cold, crash-consistent snapshot: resolves the real volume sources viadocker inspect(works with named volumes andVOLUME_*_PATHbind mounts), stops the stack, archives the CockroachDB and MinIO volumes plus config/secrets (.env,huly*.conf,nginx.conf,.huly.secret, etc.), restarts, and writes amanifest.txt. Optional--keep=Nretention and--full(include elastic/redpanda).restore.sh- replaces volumes and config from a backup, with a confirmation prompt and a stop-before-overwrite safeguard so a running container never has its volume rewritten underneath it.guides/backup-restore.md+ a short Backups section linking it from the README.Design notes
--fullincludes them.docker,docker compose, and a throwawayalpinecontainer.setup.sh/nginx.sh(4-space,[ ],#!/usr/bin/env bash).shellcheck-clean.Testing
Validated end-to-end on a Compose stack mirroring the real service/volume layout (cockroach + minio): seeded a DB row and a file, ran
backup.sh, destroyed both, ranrestore.sh, and confirmed both were fully restored. The restore safeguard (stop before overwrite) was verified.Contributed by Exaviz (exaviz.com).