You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(backup): make read-only quiesce work on MySQL/older-MariaDB containers (+ --db-check) (#2)
* fix(backup): surface real MariaDB error when read_only quiesce fails
db_exec captured stderr to /dev/null, so a failed `SET GLOBAL read_only=ON`
only logged "did not take effect" with no cause. Capture stderr into
_DB_LAST_ERR and log it in db_lock_mysql's fallback branch so the actual
MariaDB error (privilege, auth, etc.) is visible for diagnosis.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(backup): add --db-check diagnostic mode
Reports DB detection + whether the read-only quiesce engages (current user,
version, prior/after read_only, SET errors), then exits without imaging.
Briefly toggles read_only and restores it. Zero downtime; reusable for
diagnosing why a backup falls back to STOP_DOCKER.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(backup): fall back to mysql client in container exec
The container branch of db_exec hardcoded the `mariadb` client. MySQL and
older MariaDB images ship only `mysql`, so `docker exec ... mariadb` failed
with 'executable not found' and the read-only quiesce silently no-op'd —
causing a fallback to STOP_DOCKER (downtime). Now tries mariadb then mysql,
mirroring the native branch.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs: changelog + --db-check in README/AGENTS/llms.txt
Document the container mysql-client fallback fix and the new --db-check
diagnostic mode across CHANGELOG (1.10.0 Fixed/Added), README options,
AGENTS.md troubleshooting, and pi2s3.com/llms.txt.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Andrew Baker <andrew@andrewbaker.ninja>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,12 @@ All notable changes to pi2s3 are documented here.
12
12
-**Native (non-Docker) database detection** (`lib/containers.sh`) — `DB_CONTAINER="auto"` now detects a database running **natively on the host** (`mariadbd`/`mysqld`/`postgres` processes), not just in Docker. Native MySQL/MariaDB previously fell back to a stop-the-service downtime; it now uses the zero-downtime path (set `DB_ROOT_PASSWORD` — there is no container env to read it from). Native PostgreSQL with peer auth needs no password.
13
13
-**`DB_ENGINE` and `DB_PG_USER` config** (`config.env.example`) — `DB_ENGINE` (`auto` | `mysql` | `mariadb` | `postgres`) forces the engine for an explicit native install where auto-detection can't see a container. `DB_PG_USER` is the PostgreSQL superuser used for `CHECKPOINT`.
14
14
-**`AGENTS.md` + `pi2s3.com/llms.txt`** — agent-facing instructions so an AI assistant (e.g. Claude) pointed at the repo or the site can install pi2s3 and run a backup unattended ("backup my site with pi2s3").
15
+
-**`--db-check` diagnostic mode** (`pi-image-backup.sh`) — reports DB detection (engine, container/native), connecting user, version, and whether the read-only quiesce actually engages, then exits without imaging. Briefly toggles `read_only` and restores it (zero downtime). Use it to confirm a backup will be zero-downtime before relying on it.
16
+
17
+
### Fixed
18
+
19
+
-**Container DB client fell back to `mysql`** (`pi-image-backup.sh`) — `db_exec` hardcoded the `mariadb` client for the Docker path. MySQL images (and MariaDB before 10.5) ship only the `mysql` binary, so `docker exec … mariadb` failed with "executable not found", the read-only quiesce silently no-op'd, and the backup fell back to `STOP_DOCKER` — causing avoidable downtime. Now tries `mariadb` then `mysql`, mirroring the native branch. (Found in production: a MySQL 8.0 analytics container was auto-detected and the quiesce silently failed.)
20
+
-**Silent quiesce failures now logged** (`pi-image-backup.sh`) — `db_exec` captured stderr to `/dev/null`, so a failed quiesce gave no cause. It now captures stderr into `_DB_LAST_ERR` and `db_lock_mysql` logs the real MariaDB/MySQL error in its fallback branch.
0 commit comments