fix(postgres): use POSTGRES_DB in health checks

This commit is contained in:
Christian 2026-03-03 22:37:48 +01:00
parent dd02701b21
commit 91f709f4fe
5 changed files with 24 additions and 4 deletions

20
RELEASE_NOTES_v2.2.41.md Normal file
View File

@ -0,0 +1,20 @@
# Release Notes v2.2.41
Dato: 3. marts 2026
## Fix: Postgres healthcheck støj i logs
- Opdateret healthcheck til at bruge korrekt database-navn (`POSTGRES_DB`) i stedet for default database.
- Løser gentagne loglinjer af typen: `FATAL: database "bmc_hub" does not exist` på installationer hvor databasen hedder noget andet (fx `hubdb_v2`).
## Ændrede filer
- `docker-compose.prod.yml`
- `docker-compose.yml`
- `updateto.sh`
- `VERSION`
## Tekniske noter
- Healthcheck er ændret fra:
- `pg_isready -U <user>`
- Til:
- `pg_isready -U <user> -d <db>`
- `updateto.sh` bruger nu også `-d "$POSTGRES_DB"` i venteløkke for postgres.

View File

@ -1 +1 @@
2.2.40 2.2.41

View File

@ -20,7 +20,7 @@ services:
- "${POSTGRES_BIND_ADDR:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432" - "${POSTGRES_BIND_ADDR:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432"
restart: always restart: always
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5

View File

@ -16,7 +16,7 @@ services:
- "${POSTGRES_PORT:-5433}:5432" - "${POSTGRES_PORT:-5433}:5432"
restart: unless-stopped restart: unless-stopped
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-bmc_hub}"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-bmc_hub} -d ${POSTGRES_DB:-bmc_hub}"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5

View File

@ -131,7 +131,7 @@ if [ "${RUN_MIGRATIONS:-false}" = "true" ]; then
fi fi
for i in {1..30}; do for i in {1..30}; do
if podman exec bmc-hub-postgres-prod pg_isready -U "$POSTGRES_USER" >/dev/null 2>&1; then if podman exec bmc-hub-postgres-prod pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" >/dev/null 2>&1; then
break break
fi fi
echo "⏳ Venter på postgres... ($i/30)" echo "⏳ Venter på postgres... ($i/30)"