From 7ba861243333e219c13997a86f5ff0f38a624ae6 Mon Sep 17 00:00:00 2001 From: pushman <> Date: Jun 11 2025 15:01:09 +0000 Subject: Update postgres-13-image to rev 41 via SR 1284394 https://build.opensuse.org/request/show/1284394 by user pushman + anag_factory 🤖: sync package with devel:BCI:Tumbleweed from OBS --- diff --git a/.files b/.files index 729c3f8..c1cbd8f 100644 Binary files a/.files and b/.files differ diff --git a/.rev b/.rev index c8dac45..80b4f37 100644 --- a/.rev +++ b/.rev @@ -311,4 +311,20 @@ 🤖: sync package with devel:BCI:Tumbleweed from OBS 1273105 + + baecf9b045f3e1d23278967557648823 + unknown + + dimstar_suse + 🤖: sync package with devel:BCI:Tumbleweed from OBS + 1280171 + + + 03fa9c68546d8363b41816642cb7bf39 + unknown + + anag_factory + 🤖: sync package with devel:BCI:Tumbleweed from OBS + 1284394 + diff --git a/Dockerfile b/Dockerfile index 58e7211..ca937bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,7 +45,7 @@ LABEL org.openbuildservice.disturl="%DISTURL%" LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime#openSUSE_BCI" LABEL org.opensuse.release-stage="released" # endlabelprefix -LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/postgres-13-image/README.md" +LABEL io.artifacthub.package.readme-url="%SOURCEURL_WITH(README.md)%" ENV LANG="en_US.utf8" ENV PG_MAJOR="13" ENV PG_VERSION="%%pg_minor_version%%" diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index ae40666..5a62870 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -154,6 +154,29 @@ docker_verify_minimum_env() { EOWARN fi } +# similar to the above, but errors if there are any "old" databases detected (usually due to upgrades without pg_upgrade) +docker_error_old_databases() { + if [ -n "${OLD_DATABASES[0]:-}" ]; then + cat >&2 <<-EOE + Error: in 18+, these Docker images are configured to store database data in a + format which is compatible with "pg_ctlcluster" (specifically, using + major-version-specific directory names). This better reflects how + PostgreSQL itself works, and how upgrades are to be performed. + + See also https://github.com/docker-library/postgres/pull/1259 + + Counter to that, there appears to be PostgreSQL data in: + ${OLD_DATABASES[*]} + + This is usually the result of upgrading the Docker image without upgrading + the underlying database using "pg_upgrade" (which requires both versions). + + See https://github.com/docker-library/postgres/issues/37 for a (long) + discussion around this process, and suggestions for how to do so. + EOE + exit 1 + fi +} # usage: docker_process_init_files [file [file [...]]] # ie: docker_process_init_files /always-initdb.d/* @@ -230,9 +253,17 @@ docker_setup_env() { declare -g DATABASE_ALREADY_EXISTS : "${DATABASE_ALREADY_EXISTS:=}" + declare -ag OLD_DATABASES=() # look specifically for PG_VERSION, as it is expected in the DB dir if [ -s "$PGDATA/PG_VERSION" ]; then DATABASE_ALREADY_EXISTS='true' + elif [ "$PGDATA" = "/var/lib/postgresql/$PG_MAJOR/docker" ]; then + # https://github.com/docker-library/postgres/pull/1259 + for d in /var/lib/postgresql /var/lib/postgresql/data /var/lib/postgresql/*/docker; do + if [ -s "$d/PG_VERSION" ]; then + OLD_DATABASES+=( "$d" ) + fi + done fi } @@ -319,6 +350,7 @@ _main() { # only run initialization on an empty data directory if [ -z "$DATABASE_ALREADY_EXISTS" ]; then docker_verify_minimum_env + docker_error_old_databases # check dir permissions to reduce likelihood of half-initialized database ls /docker-entrypoint-initdb.d/ > /dev/null diff --git a/postgres-13-image.changes b/postgres-13-image.changes index 84c7b34..98d5248 100644 --- a/postgres-13-image.changes +++ b/postgres-13-image.changes @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Tue Jun 10 08:35:06 UTC 2025 - SUSE Update Bot + +- update docker-entrypoint script in preparation of postgresql 18 upgrade + +------------------------------------------------------------------- +Fri May 23 11:23:16 UTC 2025 - SUSE Update Bot + +- use SOURCEURL_WITH to generate proper artifacthub urls + +------------------------------------------------------------------- Mon Apr 28 10:47:42 UTC 2025 - SUSE Update Bot - zypper clean also the system repository from the container