Skip to content

Commit

Permalink
align all versions
Browse files Browse the repository at this point in the history
  • Loading branch information
eifrach committed Apr 18, 2024
1 parent f451ff9 commit 3404821
Show file tree
Hide file tree
Showing 27 changed files with 113 additions and 31 deletions.
1 change: 1 addition & 0 deletions 10/Dockerfile.c8s
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
# to make sure of that.
RUN yum -y module enable postgresql:10 && \
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
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" && \
Expand Down
1 change: 1 addition & 0 deletions 10/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
# to make sure of that.
RUN yum -y module enable postgresql:10 && \
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
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" && \
Expand Down
19 changes: 14 additions & 5 deletions 10/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -311,8 +311,17 @@ 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
# Backward compatibility for RHEL/CentOS 7
source /etc/os-release

if [[ $VERSION_ID -lt 8 ]]; then
old_pgengine=/opt/rh/$old_collection/root/usr/bin
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
else
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
new_pgengine=/usr/bin
fi

PGDATA_new="${PGDATA}-new"

printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
Expand Down Expand Up @@ -350,9 +359,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

Expand Down
1 change: 1 addition & 0 deletions 12/Dockerfile.c8s
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
# to make sure of that.
RUN yum -y module enable postgresql:12 && \
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
Expand Down
1 change: 1 addition & 0 deletions 12/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
# safe in the future. This should *never* change, the last test is there
# to make sure of that.
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \
INSTALL_PKGS+="procps-ng util-linux postgresql-upgrade" && \
INSTALL_PKGS+="findutils xz" && \
INSTALL_PKGS+=" pgaudit" && \
dnf -y module enable postgresql:12 && \
Expand Down
1 change: 1 addition & 0 deletions 12/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
# to make sure of that.
RUN yum -y module enable postgresql:12 && \
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
Expand Down
19 changes: 14 additions & 5 deletions 12/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -311,8 +311,17 @@ 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
# Backward compatibility for RHEL/CentOS 7
source /etc/os-release

if [[ $VERSION_ID -lt 8 ]]; then
old_pgengine=/opt/rh/$old_collection/root/usr/bin
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
else
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
new_pgengine=/usr/bin
fi

PGDATA_new="${PGDATA}-new"

printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
Expand Down Expand Up @@ -350,9 +359,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

Expand Down
2 changes: 1 addition & 1 deletion 13/Dockerfile.c8s
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ 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 --setopt=install_weak_deps=false install $INSTALL_PKGS && \
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
yum -y reinstall tzdata && \
Expand Down
1 change: 1 addition & 0 deletions 13/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-cont
INSTALL_PKGS+="findutils xz" && \
INSTALL_PKGS+=" pgaudit" && \
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
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 && \
Expand Down
15 changes: 12 additions & 3 deletions 13/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] && ! pg_isready > /dev/null ; then
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then
rm -rf "$PGDATA/postmaster.pid"
fi

Expand All @@ -311,8 +311,17 @@ run_pgupgrade ()
old_collection=rh-postgresql$old_raw_version
fi

old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
new_pgengine=/usr/bin
# Backward compatibility for RHEL/CentOS 7
source /etc/os-release

if [[ $VERSION_ID -lt 8 ]]; then
old_pgengine=/opt/rh/$old_collection/root/usr/bin
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
else
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
new_pgengine=/usr/bin
fi

PGDATA_new="${PGDATA}-new"

printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
Expand Down
1 change: 1 addition & 0 deletions 14/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -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:14 && \
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
Expand Down
19 changes: 14 additions & 5 deletions 14/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -311,8 +311,17 @@ 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
# Backward compatibility for RHEL/CentOS 7
source /etc/os-release

if [[ $VERSION_ID -lt 8 ]]; then
old_pgengine=/opt/rh/$old_collection/root/usr/bin
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
else
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
new_pgengine=/usr/bin
fi

PGDATA_new="${PGDATA}-new"

printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
Expand Down Expand Up @@ -350,9 +359,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

Expand Down
1 change: 1 addition & 0 deletions 15/Dockerfile.c8s
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN yum -y module enable postgresql:15 && \
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" && \
Expand Down
1 change: 1 addition & 0 deletions 15/Dockerfile.c9s
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN { yum -y module enable postgresql:15 || :; } && \
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" && \
Expand Down
1 change: 1 addition & 0 deletions 15/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -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:15 && \
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
Expand Down
1 change: 1 addition & 0 deletions 15/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN yum -y module enable postgresql:15 && \
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" && \
Expand Down
1 change: 1 addition & 0 deletions 15/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN { yum -y module enable postgresql:15 || :; } && \
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" && \
Expand Down
19 changes: 14 additions & 5 deletions 15/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -311,8 +311,17 @@ 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
# Backward compatibility for RHEL/CentOS 7
source /etc/os-release

if [[ $VERSION_ID -lt 8 ]]; then
old_pgengine=/opt/rh/$old_collection/root/usr/bin
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
else
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
new_pgengine=/usr/bin
fi

PGDATA_new="${PGDATA}-new"

printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
Expand Down Expand Up @@ -350,9 +359,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

Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.c8s
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN yum -y module enable postgresql:16 && \
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" && \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.c9s
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN { yum -y module enable postgresql:16 || :; } && \
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" && \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql16-server postgresql16-contrib nss_wrapper " && \
INSTALL_PKGS+="findutils xz" && \
INSTALL_PKGS+=" postgresql16-pgaudit" && \
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN yum -y module enable postgresql:16 && \
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" && \
Expand Down
1 change: 1 addition & 0 deletions 16/Dockerfile.rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
RUN { yum -y module enable postgresql:16 || :; } && \
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" && \
Expand Down
19 changes: 14 additions & 5 deletions 16/root/usr/share/container-scripts/postgresql/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -311,8 +311,17 @@ 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
# Backward compatibility for RHEL/CentOS 7
source /etc/os-release

if [[ $VERSION_ID -lt 8 ]]; then
old_pgengine=/opt/rh/$old_collection/root/usr/bin
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
else
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
new_pgengine=/usr/bin
fi

PGDATA_new="${PGDATA}-new"

printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
Expand Down Expand Up @@ -350,9 +359,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

Expand Down
1 change: 1 addition & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ RUN {{ spec.environment_setup }}
INSTALL_PKGS="$INSTALL_PKGS rh-postgresql{{ spec.short }}-pgaudit" && \
{% elif spec.prod == 'rhel8' or spec.prod == 'rhel9' or spec.prod == 'c9s' or spec.prod == 'c8s' %}
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
{% endif %}
{% endif %}
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
Expand Down
1 change: 1 addition & 0 deletions src/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
# to make sure of that.
{% if spec.version == "16" %}
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql16-server postgresql16-contrib nss_wrapper " && \
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
{% else %}
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \
{% endif %}
Expand Down
Loading

0 comments on commit 3404821

Please sign in to comment.