Compare commits
2 Commits
c949f2c5cf
...
v1.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f1b602d3 | ||
|
|
b9a8b391f0 |
29
CHANGELOG.md
29
CHANGELOG.md
@@ -1,3 +1,32 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [1.8.0] - 2026-07-11
|
||||||
|
|
||||||
|
Swarm-aware backups and replayable restores.
|
||||||
|
|
||||||
|
- Backup: swarm task containers are never stopped or started manually
|
||||||
|
anymore; they are skipped visibly and backed up hot, while the sql dump
|
||||||
|
stays the consistent database backup.
|
||||||
|
- Backup: a container that vanishes between listing and inspect no longer
|
||||||
|
aborts the run; a failing inspect on a container that still exists keeps
|
||||||
|
failing loudly.
|
||||||
|
- Backup: pg_dump runs with the no-owner and no-privileges flags so dumps
|
||||||
|
are replayable by the owning app user.
|
||||||
|
- Restore: the mariadb empty mode drops all tables in one client session
|
||||||
|
with FOREIGN_KEY_CHECKS disabled; FK-linked parent tables no longer abort
|
||||||
|
the replay with ERROR 1451.
|
||||||
|
- Restore: the postgres empty mode drops only current-user-owned objects,
|
||||||
|
and the replay skips superuser-only dump lines without ever touching
|
||||||
|
COPY data blocks.
|
||||||
|
- Restore: the replay streams the dump through a temp file instead of
|
||||||
|
buffering it in memory; multi-GB dumps no longer OOM the restore.
|
||||||
|
- Tooling: the e2e runner reaches the DinD daemon via docker exec instead
|
||||||
|
of a host-published unencrypted API port.
|
||||||
|
- Tooling: new end-to-end test reproducing the swarm stop flake, plus unit
|
||||||
|
tests for the restore filters and the swarm probes; the suite is 36 unit,
|
||||||
|
9 integration and 30 e2e tests.
|
||||||
|
- Tooling: Dependabot with auto-merge for minor and patch updates.
|
||||||
|
|
||||||
## [1.7.1] - 2026-05-26
|
## [1.7.1] - 2026-05-26
|
||||||
|
|
||||||
* 🔌 MariaDB SQL backups now connect over TCP loopback so the dump always matches the same wildcard-host grant the application uses — no more surprise `ERROR 1045 Access denied` when a localhost-bound auth row preempts.
|
* 🔌 MariaDB SQL backups now connect over TCP loopback so the dump always matches the same wildcard-host grant the application uses — no more surprise `ERROR 1045 Access denied` when a localhost-bound auth row preempts.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "backup-docker-to-local"
|
name = "backup-docker-to-local"
|
||||||
version = "1.7.1"
|
version = "1.8.0"
|
||||||
description = "Backup Docker volumes to local with rsync and optional DB dumps."
|
description = "Backup Docker volumes to local with rsync and optional DB dumps."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
|
|||||||
@@ -29,13 +29,20 @@ def is_swarm_task(container: str) -> bool:
|
|||||||
manually: the orchestrator replaces the stopped task and a later
|
manually: the orchestrator replaces the stopped task and a later
|
||||||
`docker start` fails on the detached overlay network. A container that
|
`docker start` fails on the detached overlay network. A container that
|
||||||
vanished between listing and inspect (--rm one-shots, task-history GC)
|
vanished between listing and inspect (--rm one-shots, task-history GC)
|
||||||
counts as not stoppable instead of aborting the whole backup run."""
|
counts as not stoppable instead of aborting the whole backup run; if the
|
||||||
|
container still exists the inspect failure re-raises, so a broken daemon
|
||||||
|
keeps failing the run loudly instead of silently skipping the stop."""
|
||||||
try:
|
try:
|
||||||
out = execute_shell_command(
|
out = execute_shell_command(
|
||||||
"docker inspect --format "
|
"docker inspect --format "
|
||||||
f"'{{{{index .Config.Labels \"com.docker.swarm.task.id\"}}}}' {container}"
|
f"'{{{{index .Config.Labels \"com.docker.swarm.task.id\"}}}}' {container}"
|
||||||
)
|
)
|
||||||
except BackupException:
|
except BackupException:
|
||||||
|
still_listed = execute_shell_command(
|
||||||
|
f"docker ps -a --filter name=^{container}$ --format '{{{{.Names}}}}'"
|
||||||
|
)
|
||||||
|
if still_listed and still_listed[0].strip():
|
||||||
|
raise
|
||||||
return True
|
return True
|
||||||
return bool(out and out[0].strip())
|
return bool(out and out[0].strip())
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class TestIsSwarmTask(unittest.TestCase):
|
|||||||
@patch.object(
|
@patch.object(
|
||||||
docker_mod,
|
docker_mod,
|
||||||
"execute_shell_command",
|
"execute_shell_command",
|
||||||
side_effect=BackupException("gone"),
|
side_effect=[BackupException("gone"), []],
|
||||||
)
|
)
|
||||||
def test_vanished_container_counts_as_not_stoppable(self, _mock) -> None:
|
def test_vanished_container_counts_as_not_stoppable(self, _mock) -> None:
|
||||||
# A container removed between listing and inspect must not abort the
|
# A container removed between listing and inspect must not abort the
|
||||||
@@ -29,6 +29,18 @@ class TestIsSwarmTask(unittest.TestCase):
|
|||||||
# stop/start and image-inspect path.
|
# stop/start and image-inspect path.
|
||||||
self.assertTrue(docker_mod.is_swarm_task("gone-container"))
|
self.assertTrue(docker_mod.is_swarm_task("gone-container"))
|
||||||
|
|
||||||
|
@patch.object(
|
||||||
|
docker_mod,
|
||||||
|
"execute_shell_command",
|
||||||
|
side_effect=[BackupException("daemon hiccup"), ["still-here"]],
|
||||||
|
)
|
||||||
|
def test_inspect_failure_on_existing_container_still_fails(self, _mock) -> None:
|
||||||
|
# If the container still exists, an inspect failure must keep failing
|
||||||
|
# the run: silently skipping the stop would back up a hot volume and
|
||||||
|
# report green without the stop guarantee.
|
||||||
|
with self.assertRaises(BackupException):
|
||||||
|
docker_mod.is_swarm_task("still-here")
|
||||||
|
|
||||||
|
|
||||||
class TestFilterStoppable(unittest.TestCase):
|
class TestFilterStoppable(unittest.TestCase):
|
||||||
@patch.object(docker_mod, "is_swarm_task", side_effect=[False, True, False])
|
@patch.object(docker_mod, "is_swarm_task", side_effect=[False, True, False])
|
||||||
|
|||||||
Reference in New Issue
Block a user