From 66bfd4f6955beb0d76a6cb2703ab47b60ce6a33e Mon Sep 17 00:00:00 2001 From: S'Bussiso Dube <80188685+Sbussiso@users.noreply.github.com> Date: Mon, 14 Sep 2026 02:27:09 -0700 Subject: [PATCH] Match pg_dump to the server major, or the nightly backup fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Rust port replaced the image's PGDG-sourced postgresql-client-18 with Debian's default postgresql-client, which is 15. The cluster is 18, and pg_dump refuses to dump a newer server outright: pg_dump: error: aborting because of server version mismatch detail: server version: 18.6; pg_dump version: 15.19 So the deploy went green and the backup would have failed at 09:47 UTC — the same shape as the scale-to-zero break this repo already had once, where `flyctl ssh console` could not wake a stopped machine. The Python Dockerfile had solved this deliberately: add the PGDG apt repo, install postgresql-client-18, purge gnupg afterwards. The port carried over the *importance* of having pg_dump and dropped the *solution*. Restored verbatim. Caught by running the real thing rather than trusting `command -v pg_dump` — the binary was present and on PATH, and still useless. Verified in the rebuilt image: pg_dump (PostgreSQL) 18.6. Co-Authored-By: Claude Opus 5 --- Dockerfile | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0146083..749eedf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,17 +26,33 @@ FROM debian:bookworm-slim # postgresql-client is NOT optional here, unlike the sync service. # .github/workflows/backup.yml runs `flyctl ssh console -C "bash # /app/scripts/backup_db.sh"` nightly, and that script needs pg_dump and -# psql on PATH. Dropping them would leave a green deploy and a backup job -# that fails at 09:47 UTC — the failure mode this repo has already had -# once, when scale-to-zero broke the same job. +# psql on PATH. +# +# AND THE MAJOR VERSION MUST MATCH THE SERVER. Debian bookworm ships +# postgresql-client 15; the cluster is 18. pg_dump refuses to dump a +# newer server outright: +# +# pg_dump: error: aborting because of server version mismatch +# detail: server version: 18.6; pg_dump version: 15.19 +# +# So this pulls client 18 from PGDG, exactly as the Python image did — +# that Dockerfile went to the same trouble and the port initially dropped +# it, which produced a green deploy and a broken backup. gnupg is purged +# after adding the key so it doesn't linger in the runtime image. # # ca-certificates for outbound TLS; bash because backup_db.sh is bash, # not sh. RUN apt-get update \ && apt-get install -y --no-install-recommends \ - ca-certificates \ - postgresql-client \ - bash \ + ca-certificates curl gnupg bash \ + && install -d /usr/share/postgresql-common/pgdg \ + && curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \ + -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \ + && echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" \ + > /etc/apt/sources.list.d/pgdg.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends postgresql-client-18 \ + && apt-get purge -y gnupg && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* # Unprivileged. The Python image ran as root; nothing here needs it.