diff --git a/13/Dockerfile.c8s b/13/Dockerfile.c8s index 49a2f789..38a8eab8 100644 --- a/13/Dockerfile.c8s +++ b/13/Dockerfile.c8s @@ -44,7 +44,8 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions RUN yum -y module enable postgresql:13 && \ INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \ INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ - yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ + INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ + yum -y --setopt=tsflags=nodocs --setopt=install_weak_deps=false install $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \ yum -y reinstall tzdata && \ diff --git a/13/Dockerfile.c9s b/13/Dockerfile.c9s index a868fb13..075839d2 100644 --- a/13/Dockerfile.c9s +++ b/13/Dockerfile.c9s @@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions RUN { yum -y module enable postgresql:13 || :; } && \ INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \ INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ + INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \ diff --git a/13/Dockerfile.fedora b/13/Dockerfile.fedora index aa7f63a6..9588e620 100644 --- a/13/Dockerfile.fedora +++ b/13/Dockerfile.fedora @@ -47,6 +47,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \ INSTALL_PKGS+="findutils xz" && \ INSTALL_PKGS+=" pgaudit" && \ + INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \ dnf -y module enable postgresql:13 && \ dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ diff --git a/13/Dockerfile.rhel8 b/13/Dockerfile.rhel8 index 38e3b951..b6e39c72 100644 --- a/13/Dockerfile.rhel8 +++ b/13/Dockerfile.rhel8 @@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions RUN yum -y module enable postgresql:13 && \ INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \ INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ + INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \ diff --git a/13/Dockerfile.rhel9 b/13/Dockerfile.rhel9 index 063ec1f4..a53a917f 100644 --- a/13/Dockerfile.rhel9 +++ b/13/Dockerfile.rhel9 @@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions RUN { yum -y module enable postgresql:13 || :; } && \ INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \ INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ + INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \ diff --git a/13/root/usr/share/container-scripts/postgresql/common.sh b/13/root/usr/share/container-scripts/postgresql/common.sh index 9da493a2..9cc5dc96 100644 --- a/13/root/usr/share/container-scripts/postgresql/common.sh +++ b/13/root/usr/share/container-scripts/postgresql/common.sh @@ -297,7 +297,7 @@ function wait_for_postgresql_master() { run_pgupgrade () ( # Remove .pid file if the file persists after ugly shut down - if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then + if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null ; then rm -rf "$PGDATA/postmaster.pid" fi @@ -311,8 +311,8 @@ run_pgupgrade () old_collection=rh-postgresql$old_raw_version fi - old_pgengine=/opt/rh/$old_collection/root/usr/bin - new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin + old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin + new_pgengine=/usr/bin PGDATA_new="${PGDATA}-new" printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \ @@ -350,9 +350,9 @@ run_pgupgrade () # boot up data directory with old postgres once again to make sure # it was shut down properly, otherwise the upgrade process fails info_msg "Starting old postgresql once again for a clean shutdown..." - "${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''" + "${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h 127.0.0.1''" info_msg "Waiting for postgresql to be ready for shutdown again..." - "${old_pgengine}/pg_isready" + "${old_pgengine}/pg_isready" -h 127.0.0.1 info_msg "Shutting down old postgresql cleanly..." "${old_pgengine}/pg_ctl" stop diff --git a/src/root/usr/share/container-scripts/postgresql/common.sh b/src/root/usr/share/container-scripts/postgresql/common.sh index df39caed..74c57499 100644 --- a/src/root/usr/share/container-scripts/postgresql/common.sh +++ b/src/root/usr/share/container-scripts/postgresql/common.sh @@ -298,7 +298,7 @@ function wait_for_postgresql_master() { run_pgupgrade () ( # Remove .pid file if the file persists after ugly shut down - if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then + if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then rm -rf "$PGDATA/postmaster.pid" fi @@ -312,7 +312,7 @@ run_pgupgrade () old_collection=rh-postgresql$old_raw_version fi - old_pgengine=/opt/rh/$old_collection/root/usr/bin + old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin PGDATA_new="${PGDATA}-new" @@ -351,9 +351,9 @@ run_pgupgrade () # boot up data directory with old postgres once again to make sure # it was shut down properly, otherwise the upgrade process fails info_msg "Starting old postgresql once again for a clean shutdown..." - "${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''" + "${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h 127.0.0.1''" info_msg "Waiting for postgresql to be ready for shutdown again..." - "${old_pgengine}/pg_isready" + "${old_pgengine}/pg_isready" -h 127.0.0.1 info_msg "Shutting down old postgresql cleanly..." "${old_pgengine}/pg_ctl" stop