fix: discover DB containers by their configured image, not the docker ps name #2

Open
mrouissi wants to merge 1 commit from fix/discover-by-configured-image into master
Owner

What happened

From 15.10. on, the nightly backup found no Postgres databases ("No Postgres DB containers discovered"). supabase-db, supabase-stage-db and both billing DBs went two nights without a backup; Kill Bill was not affected. Monitoring raised "Backup KRITISCH veraltet" on 17.10.

Cause: the Postgres image also carried a second name (public.ecr.aws/supabase/postgres, pulled by the CI migration check). A docker image prune in the app deploy on 15.10. then removed the name supabase/postgres. The containers kept running, but docker ps showed only the image ID, so the name-based discovery matched nothing.

Already done on bnet006 (17.10.)

  • Image tagged supabase/postgres:15.8.1.085 again.
  • Backup run by hand: all 6 DBs fresh at 19:08, metrics refreshed.
  • This script deployed to /usr/local/bin/backup_postgres_db.sh (old version kept as .bak-2026-10-17). This PR brings the repo in line with the server.

Change

  • Discovery reads the image each container was created with (.Config.Image via docker inspect), which a removed tag cannot change.
  • The image patterns accept a registry prefix.

Checked on bnet006: discovers supabase-db, supabase-stage-db, both billing DBs and both Kill Bill DBs.

## What happened From 15.10. on, the nightly backup found no Postgres databases ("No Postgres DB containers discovered"). supabase-db, supabase-stage-db and both billing DBs went two nights without a backup; Kill Bill was not affected. Monitoring raised "Backup KRITISCH veraltet" on 17.10. Cause: the Postgres image also carried a second name (public.ecr.aws/supabase/postgres, pulled by the CI migration check). A docker image prune in the app deploy on 15.10. then removed the name supabase/postgres. The containers kept running, but docker ps showed only the image ID, so the name-based discovery matched nothing. ## Already done on bnet006 (17.10.) - Image tagged supabase/postgres:15.8.1.085 again. - Backup run by hand: all 6 DBs fresh at 19:08, metrics refreshed. - This script deployed to /usr/local/bin/backup_postgres_db.sh (old version kept as .bak-2026-10-17). This PR brings the repo in line with the server. ## Change - Discovery reads the image each container was created with (.Config.Image via docker inspect), which a removed tag cannot change. - The image patterns accept a registry prefix. Checked on bnet006: discovers supabase-db, supabase-stage-db, both billing DBs and both Kill Bill DBs.
On 2026-10-15 a docker image prune removed the supabase/postgres tag (the same
image also carried a public.ecr.aws name). docker ps then showed only the image
ID, discovery found zero Postgres DBs and supabase-db, supabase-stage-db and both
billing DBs had no backup for two nights. Discovery now reads .Config.Image via
docker inspect, which a missing tag cannot change, and accepts a registry prefix.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/discover-by-configured-image:fix/discover-by-configured-image
git switch fix/discover-by-configured-image

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff fix/discover-by-configured-image
git switch fix/discover-by-configured-image
git rebase master
git switch master
git merge --ff-only fix/discover-by-configured-image
git switch fix/discover-by-configured-image
git rebase master
git switch master
git merge --no-ff fix/discover-by-configured-image
git switch master
git merge --squash fix/discover-by-configured-image
git switch master
git merge --ff-only fix/discover-by-configured-image
git switch master
git merge fix/discover-by-configured-image
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Scripts/dbs-backup!2
No description provided.