fix(release): snapshot SQLite before archiving active WAL databases
This commit is contained in:
+5
-4
@@ -289,8 +289,8 @@ backup_database() {
|
||||
fi
|
||||
|
||||
if [ "$provider" = "sqlite" ]; then
|
||||
# SQLite lives in the jobtracker_data volume. Tar it from a throwaway container
|
||||
# so the host needs no sqlite tooling and no knowledge of the volume layout.
|
||||
# Snapshot SQLite through its backup API before archiving the read-only data
|
||||
# volume. A raw tar can span a WAL checkpoint and omit committed transactions.
|
||||
#
|
||||
# docker compose prefixes volume names with the project name, which defaults to
|
||||
# the directory name. Naming the bare volume here would silently CREATE an empty
|
||||
@@ -307,11 +307,12 @@ backup_database() {
|
||||
echo "Backing up SQLite data volume '${volume}' to ${target}"
|
||||
# The archive path is built inside the container: passing /backup/... as an argument
|
||||
# gets rewritten by MSYS path translation when the script is run from Git Bash.
|
||||
if ! docker run --rm \
|
||||
if ! docker run --rm -i --network none \
|
||||
-v "$volume":/data:ro \
|
||||
-v "$BACKUP_DIR":/backup \
|
||||
-e ARCHIVE_NAME="$(basename "$target")" \
|
||||
alpine:3 sh -c 'tar czf "/backup/$ARCHIVE_NAME" -C /data .'; then
|
||||
python:3.12.10-slim-bookworm sh -c 'umask 077; exec python3 - /data "/backup/$ARCHIVE_NAME"' \
|
||||
< scripts/archive-sqlite-volume.py; then
|
||||
echo "SQLite volume backup FAILED. Aborting deploy."
|
||||
rm -f "$target"
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user