diff --git a/12/Dockerfile.rhel8 b/12/Dockerfile.rhel8 index c37c48e5..8942022f 100644 --- a/12/Dockerfile.rhel8 +++ b/12/Dockerfile.rhel8 @@ -43,7 +43,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 yum -y module enable postgresql:12 && \ - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs 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 && \ diff --git a/12/root/usr/bin/run-postgresql-slave b/12/root/usr/bin/run-postgresql-slave index 586bf5d7..99e0b074 100755 --- a/12/root/usr/bin/run-postgresql-slave +++ b/12/root/usr/bin/run-postgresql-slave @@ -31,7 +31,7 @@ generate_passwd_file generate_postgresql_config wait_for_postgresql_master -export MASTER_FQDN=$(postgresql_master_addr) +export MASTER_FQDN=${POSTGRESQL_MASTER_IP} initialize_replica unset_env_vars diff --git a/12/root/usr/share/container-scripts/postgresql/common.sh b/12/root/usr/share/container-scripts/postgresql/common.sh index 0486c735..88eb838d 100644 --- a/12/root/usr/share/container-scripts/postgresql/common.sh +++ b/12/root/usr/share/container-scripts/postgresql/common.sh @@ -91,22 +91,6 @@ function unset_env_vars() { unset POSTGRESQL_{DATABASE,USER,PASSWORD,ADMIN_PASSWORD} } -# postgresql_master_addr lookups the 'postgresql-master' DNS and get list of the available -# endpoints. Each endpoint is a PostgreSQL container with the 'master' PostgreSQL running. -function postgresql_master_addr() { - local service_name=${POSTGRESQL_MASTER_SERVICE_NAME:-postgresql-master} - local endpoints=$(dig ${service_name} A +search | grep ";${service_name}" | cut -d ';' -f 2 2>/dev/null) - # FIXME: This is for debugging (docker run) - if [ -v POSTGRESQL_MASTER_IP ]; then - endpoints=${POSTGRESQL_MASTER_IP:-} - fi - if [ -z "$endpoints" ]; then - >&2 echo "Failed to resolve PostgreSQL master IP address" - exit 3 - fi - echo -n "$(echo $endpoints | cut -d ' ' -f 1)" -} - # Converts the version in format x.y or x.y.z to a number. version2number () { @@ -290,12 +274,11 @@ function set_pgdata () function wait_for_postgresql_master() { while true; do - master_fqdn=$(postgresql_master_addr) - echo "Waiting for PostgreSQL master (${master_fqdn}) to accept connections ..." + echo "Waiting for PostgreSQL master (${POSTGRESQL_MASTER_IP}) to accept connections ..." if [ -v POSTGRESQL_ADMIN_PASSWORD ]; then - PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${master_fqdn}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${POSTGRESQL_MASTER_IP}" -c "SELECT 1;" && return 0 else - PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${master_fqdn}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${POSTGRESQL_MASTER_IP}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 fi sleep 1 done diff --git a/13/Dockerfile.c9s b/13/Dockerfile.c9s index 4b870a53..165cd357 100644 --- a/13/Dockerfile.c9s +++ b/13/Dockerfile.c9s @@ -42,7 +42,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 { yum -y module enable postgresql:13 || :; } && \ - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs 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 && \ diff --git a/13/Dockerfile.rhel8 b/13/Dockerfile.rhel8 index c736efdc..49ecc667 100644 --- a/13/Dockerfile.rhel8 +++ b/13/Dockerfile.rhel8 @@ -43,7 +43,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 yum -y module enable postgresql:13 && \ - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs 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 && \ diff --git a/13/root/usr/bin/run-postgresql-slave b/13/root/usr/bin/run-postgresql-slave index 586bf5d7..99e0b074 100755 --- a/13/root/usr/bin/run-postgresql-slave +++ b/13/root/usr/bin/run-postgresql-slave @@ -31,7 +31,7 @@ generate_passwd_file generate_postgresql_config wait_for_postgresql_master -export MASTER_FQDN=$(postgresql_master_addr) +export MASTER_FQDN=${POSTGRESQL_MASTER_IP} initialize_replica unset_env_vars diff --git a/13/root/usr/share/container-scripts/postgresql/common.sh b/13/root/usr/share/container-scripts/postgresql/common.sh index 369fd133..53cc9258 100644 --- a/13/root/usr/share/container-scripts/postgresql/common.sh +++ b/13/root/usr/share/container-scripts/postgresql/common.sh @@ -91,22 +91,6 @@ function unset_env_vars() { unset POSTGRESQL_{DATABASE,USER,PASSWORD,ADMIN_PASSWORD} } -# postgresql_master_addr lookups the 'postgresql-master' DNS and get list of the available -# endpoints. Each endpoint is a PostgreSQL container with the 'master' PostgreSQL running. -function postgresql_master_addr() { - local service_name=${POSTGRESQL_MASTER_SERVICE_NAME:-postgresql-master} - local endpoints=$(dig ${service_name} A +search | grep ";${service_name}" | cut -d ';' -f 2 2>/dev/null) - # FIXME: This is for debugging (docker run) - if [ -v POSTGRESQL_MASTER_IP ]; then - endpoints=${POSTGRESQL_MASTER_IP:-} - fi - if [ -z "$endpoints" ]; then - >&2 echo "Failed to resolve PostgreSQL master IP address" - exit 3 - fi - echo -n "$(echo $endpoints | cut -d ' ' -f 1)" -} - # Converts the version in format x.y or x.y.z to a number. version2number () { @@ -290,12 +274,11 @@ function set_pgdata () function wait_for_postgresql_master() { while true; do - master_fqdn=$(postgresql_master_addr) - echo "Waiting for PostgreSQL master (${master_fqdn}) to accept connections ..." + echo "Waiting for PostgreSQL master (${POSTGRESQL_MASTER_IP}) to accept connections ..." if [ -v POSTGRESQL_ADMIN_PASSWORD ]; then - PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${master_fqdn}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${POSTGRESQL_MASTER_IP}" -c "SELECT 1;" && return 0 else - PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${master_fqdn}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${POSTGRESQL_MASTER_IP}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 fi sleep 1 done diff --git a/15/Dockerfile.c9s b/15/Dockerfile.c9s index e78d45b8..f174a569 100644 --- a/15/Dockerfile.c9s +++ b/15/Dockerfile.c9s @@ -42,7 +42,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 { yum -y module enable postgresql:15 || :; } && \ - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs 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 && \ diff --git a/15/Dockerfile.fedora b/15/Dockerfile.fedora index 5940bee6..3706c19b 100644 --- a/15/Dockerfile.fedora +++ b/15/Dockerfile.fedora @@ -44,7 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions # This image must forever use UID 26 for postgres user so our volumes are # 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 postgresql15-server postgresql15-contrib nss_wrapper postgresql15-upgrade procps-ng util-linux" && \ +RUN INSTALL_PKGS="rsync tar gettext postgresql15-server postgresql15-contrib nss_wrapper postgresql15-upgrade procps-ng util-linux" && \ INSTALL_PKGS+=" findutils xz" && \ INSTALL_PKGS+=" postgresql15-pgaudit" && \ dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ diff --git a/15/Dockerfile.rhel8 b/15/Dockerfile.rhel8 index 302ee20f..80df6705 100644 --- a/15/Dockerfile.rhel8 +++ b/15/Dockerfile.rhel8 @@ -43,7 +43,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 yum -y module enable postgresql:15 && \ - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs 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 && \ diff --git a/15/root/usr/bin/run-postgresql-slave b/15/root/usr/bin/run-postgresql-slave index 586bf5d7..99e0b074 100755 --- a/15/root/usr/bin/run-postgresql-slave +++ b/15/root/usr/bin/run-postgresql-slave @@ -31,7 +31,7 @@ generate_passwd_file generate_postgresql_config wait_for_postgresql_master -export MASTER_FQDN=$(postgresql_master_addr) +export MASTER_FQDN=${POSTGRESQL_MASTER_IP} initialize_replica unset_env_vars diff --git a/15/root/usr/share/container-scripts/postgresql/common.sh b/15/root/usr/share/container-scripts/postgresql/common.sh index 76a2eb0f..5394d44a 100644 --- a/15/root/usr/share/container-scripts/postgresql/common.sh +++ b/15/root/usr/share/container-scripts/postgresql/common.sh @@ -91,22 +91,6 @@ function unset_env_vars() { unset POSTGRESQL_{DATABASE,USER,PASSWORD,ADMIN_PASSWORD} } -# postgresql_master_addr lookups the 'postgresql-master' DNS and get list of the available -# endpoints. Each endpoint is a PostgreSQL container with the 'master' PostgreSQL running. -function postgresql_master_addr() { - local service_name=${POSTGRESQL_MASTER_SERVICE_NAME:-postgresql-master} - local endpoints=$(dig ${service_name} A +search | grep ";${service_name}" | cut -d ';' -f 2 2>/dev/null) - # FIXME: This is for debugging (docker run) - if [ -v POSTGRESQL_MASTER_IP ]; then - endpoints=${POSTGRESQL_MASTER_IP:-} - fi - if [ -z "$endpoints" ]; then - >&2 echo "Failed to resolve PostgreSQL master IP address" - exit 3 - fi - echo -n "$(echo $endpoints | cut -d ' ' -f 1)" -} - # Converts the version in format x.y or x.y.z to a number. version2number () { @@ -290,12 +274,11 @@ function set_pgdata () function wait_for_postgresql_master() { while true; do - master_fqdn=$(postgresql_master_addr) - echo "Waiting for PostgreSQL master (${master_fqdn}) to accept connections ..." + echo "Waiting for PostgreSQL master (${POSTGRESQL_MASTER_IP}) to accept connections ..." if [ -v POSTGRESQL_ADMIN_PASSWORD ]; then - PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${master_fqdn}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${POSTGRESQL_MASTER_IP}" -c "SELECT 1;" && return 0 else - PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${master_fqdn}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${POSTGRESQL_MASTER_IP}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 fi sleep 1 done diff --git a/16/Dockerfile.c10s b/16/Dockerfile.c10s index 388dcdb8..0b3a80f3 100644 --- a/16/Dockerfile.c10s +++ b/16/Dockerfile.c10s @@ -41,7 +41,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions # This image must forever use UID 26 for postgres user so our volumes are # safe in the future. This should *never* change, the last test is there # to make sure of that. -RUN INSTALL_PKGS="rsync tar gettext-envsubst bind-utils nss_wrapper-libs glibc-locale-source xz" && \ +RUN INSTALL_PKGS="rsync tar gettext-envsubst nss_wrapper-libs glibc-locale-source xz" && \ PSQL_PKGS="postgresql16-server postgresql16-contrib postgresql16-upgrade" && \ INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS $PSQL_PKGS && \ diff --git a/16/Dockerfile.c9s b/16/Dockerfile.c9s index 9eaa70c3..127f64a5 100644 --- a/16/Dockerfile.c9s +++ b/16/Dockerfile.c9s @@ -42,7 +42,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 { yum -y module enable postgresql:16 || :; } && \ - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs 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 && \ diff --git a/16/Dockerfile.fedora b/16/Dockerfile.fedora index 15ba45d1..1edab58b 100644 --- a/16/Dockerfile.fedora +++ b/16/Dockerfile.fedora @@ -44,7 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions # This image must forever use UID 26 for postgres user so our volumes are # 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 " && \ +RUN INSTALL_PKGS="rsync tar gettext postgresql-server postgresql-contrib nss_wrapper " && \ INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \ INSTALL_PKGS+=" findutils xz" && \ INSTALL_PKGS+=" pgaudit" && \ diff --git a/16/Dockerfile.rhel10 b/16/Dockerfile.rhel10 index 9ec4cf1a..4c3fac4a 100644 --- a/16/Dockerfile.rhel10 +++ b/16/Dockerfile.rhel10 @@ -41,7 +41,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions # This image must forever use UID 26 for postgres user so our volumes are # safe in the future. This should *never* change, the last test is there # to make sure of that. -RUN INSTALL_PKGS="rsync tar gettext-envsubst bind-utils nss_wrapper-libs glibc-locale-source xz" && \ +RUN INSTALL_PKGS="rsync tar gettext-envsubst nss_wrapper-libs glibc-locale-source xz" && \ PSQL_PKGS="postgresql16-server postgresql16-contrib" && \ INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ diff --git a/16/Dockerfile.rhel8 b/16/Dockerfile.rhel8 index caeb622d..88aae963 100644 --- a/16/Dockerfile.rhel8 +++ b/16/Dockerfile.rhel8 @@ -43,7 +43,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 yum -y module enable postgresql:16 && \ - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs postgresql-server postgresql-contrib" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs 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 && \ diff --git a/16/root/usr/bin/run-postgresql-slave b/16/root/usr/bin/run-postgresql-slave index 586bf5d7..99e0b074 100755 --- a/16/root/usr/bin/run-postgresql-slave +++ b/16/root/usr/bin/run-postgresql-slave @@ -31,7 +31,7 @@ generate_passwd_file generate_postgresql_config wait_for_postgresql_master -export MASTER_FQDN=$(postgresql_master_addr) +export MASTER_FQDN=${POSTGRESQL_MASTER_IP} initialize_replica unset_env_vars diff --git a/16/root/usr/share/container-scripts/postgresql/common.sh b/16/root/usr/share/container-scripts/postgresql/common.sh index fdb4410e..7aca18ed 100644 --- a/16/root/usr/share/container-scripts/postgresql/common.sh +++ b/16/root/usr/share/container-scripts/postgresql/common.sh @@ -91,22 +91,6 @@ function unset_env_vars() { unset POSTGRESQL_{DATABASE,USER,PASSWORD,ADMIN_PASSWORD} } -# postgresql_master_addr lookups the 'postgresql-master' DNS and get list of the available -# endpoints. Each endpoint is a PostgreSQL container with the 'master' PostgreSQL running. -function postgresql_master_addr() { - local service_name=${POSTGRESQL_MASTER_SERVICE_NAME:-postgresql-master} - local endpoints=$(dig ${service_name} A +search | grep ";${service_name}" | cut -d ';' -f 2 2>/dev/null) - # FIXME: This is for debugging (docker run) - if [ -v POSTGRESQL_MASTER_IP ]; then - endpoints=${POSTGRESQL_MASTER_IP:-} - fi - if [ -z "$endpoints" ]; then - >&2 echo "Failed to resolve PostgreSQL master IP address" - exit 3 - fi - echo -n "$(echo $endpoints | cut -d ' ' -f 1)" -} - # Converts the version in format x.y or x.y.z to a number. version2number () { @@ -290,12 +274,11 @@ function set_pgdata () function wait_for_postgresql_master() { while true; do - master_fqdn=$(postgresql_master_addr) - echo "Waiting for PostgreSQL master (${master_fqdn}) to accept connections ..." + echo "Waiting for PostgreSQL master (${POSTGRESQL_MASTER_IP}) to accept connections ..." if [ -v POSTGRESQL_ADMIN_PASSWORD ]; then - PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${master_fqdn}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${POSTGRESQL_MASTER_IP}" -c "SELECT 1;" && return 0 else - PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${master_fqdn}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${POSTGRESQL_MASTER_IP}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 fi sleep 1 done diff --git a/src/Dockerfile b/src/Dockerfile index d06f414a..a14c383c 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -54,7 +54,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions {{ spec.repo_enable_reason }} {% endif %} {% if spec.prod == "c10s" or spec.prod == "rhel10" %} -RUN INSTALL_PKGS="rsync tar gettext-envsubst bind-utils nss_wrapper-libs glibc-locale-source xz" && \ +RUN INSTALL_PKGS="rsync tar gettext-envsubst nss_wrapper-libs glibc-locale-source xz" && \ PSQL_PKGS="{{ spec.pkgs }}" && \ {% elif spec.prod == "rhel9" and spec.version == "13" %} \ RUN INSTALL_PKGS="rsync tar gettext bind9.18-utils nss_wrapper-libs {{ spec.pkgs }}" && \ @@ -63,7 +63,7 @@ RUN {{ spec.environment_setup }} INSTALL_PKGS="rsync tar gettext bind9.18-utils nss_wrapper-libs {{ spec.pkgs }}" && \ {% else %} RUN {{ spec.environment_setup }} - INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper-libs {{ spec.pkgs }}" && \ + INSTALL_PKGS="rsync tar gettext nss_wrapper-libs {{ spec.pkgs }}" && \ {% endif %} {% if spec.version not in ["9.6", "10", "11"] %} INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ diff --git a/src/Dockerfile.fedora b/src/Dockerfile.fedora index 5078ddd8..8a1b9381 100644 --- a/src/Dockerfile.fedora +++ b/src/Dockerfile.fedora @@ -49,10 +49,10 @@ 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. {% if spec.version == "16" %} -RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \ +RUN INSTALL_PKGS="rsync tar gettext postgresql-server postgresql-contrib nss_wrapper " && \ INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \ {% else %} -RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql{{ spec.short }}-server postgresql{{ spec.short }}-contrib nss_wrapper postgresql{{ spec.short }}-upgrade procps-ng util-linux" && \ +RUN INSTALL_PKGS="rsync tar gettext postgresql{{ spec.short }}-server postgresql{{ spec.short }}-contrib nss_wrapper postgresql{{ spec.short }}-upgrade procps-ng util-linux" && \ {% endif %} INSTALL_PKGS+=" findutils xz" && \ {% if spec.version == "16" %} diff --git a/src/root/usr/bin/run-postgresql-slave b/src/root/usr/bin/run-postgresql-slave index 6a70d831..b342458f 100755 --- a/src/root/usr/bin/run-postgresql-slave +++ b/src/root/usr/bin/run-postgresql-slave @@ -37,7 +37,7 @@ generate_passwd_file generate_postgresql_config wait_for_postgresql_master -export MASTER_FQDN=$(postgresql_master_addr) +export MASTER_FQDN=${POSTGRESQL_MASTER_IP} initialize_replica unset_env_vars diff --git a/src/root/usr/share/container-scripts/postgresql/common.sh b/src/root/usr/share/container-scripts/postgresql/common.sh index bdad9f9b..e233111c 100644 --- a/src/root/usr/share/container-scripts/postgresql/common.sh +++ b/src/root/usr/share/container-scripts/postgresql/common.sh @@ -92,22 +92,6 @@ function unset_env_vars() { unset POSTGRESQL_{DATABASE,USER,PASSWORD,ADMIN_PASSWORD} } -# postgresql_master_addr lookups the 'postgresql-master' DNS and get list of the available -# endpoints. Each endpoint is a PostgreSQL container with the 'master' PostgreSQL running. -function postgresql_master_addr() { - local service_name=${POSTGRESQL_MASTER_SERVICE_NAME:-postgresql-master} - local endpoints=$(dig ${service_name} A +search | grep ";${service_name}" | cut -d ';' -f 2 2>/dev/null) - # FIXME: This is for debugging (docker run) - if [ -v POSTGRESQL_MASTER_IP ]; then - endpoints=${POSTGRESQL_MASTER_IP:-} - fi - if [ -z "$endpoints" ]; then - >&2 echo "Failed to resolve PostgreSQL master IP address" - exit 3 - fi - echo -n "$(echo $endpoints | cut -d ' ' -f 1)" -} - # Converts the version in format x.y or x.y.z to a number. version2number () { @@ -291,12 +275,11 @@ function set_pgdata () function wait_for_postgresql_master() { while true; do - master_fqdn=$(postgresql_master_addr) - echo "Waiting for PostgreSQL master (${master_fqdn}) to accept connections ..." + echo "Waiting for PostgreSQL master (${POSTGRESQL_MASTER_IP}) to accept connections ..." if [ -v POSTGRESQL_ADMIN_PASSWORD ]; then - PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${master_fqdn}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_ADMIN_PASSWORD} psql "postgresql://postgres@${POSTGRESQL_MASTER_IP}" -c "SELECT 1;" && return 0 else - PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${master_fqdn}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 + PGPASSWORD=${POSTGRESQL_PASSWORD} psql "postgresql://${POSTGRESQL_USER}@${POSTGRESQL_MASTER_IP}/${POSTGRESQL_DATABASE}" -c "SELECT 1;" && return 0 fi sleep 1 done diff --git a/test/test-lib-postgresql.sh b/test/test-lib-postgresql.sh index 8d0132fb..84f2af0f 100644 --- a/test/test-lib-postgresql.sh +++ b/test/test-lib-postgresql.sh @@ -59,7 +59,7 @@ function test_postgresql_imagestream() { TEMPLATES="postgresql-ephemeral-template.json postgresql-persistent-template.json" for template in $TEMPLATES; do - ct_os_test_image_stream_template "${THISDIR}/imagestreams/postgresql-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" postgresql "-p POSTGRESQL_VERSION=${VERSION}${tag}" + ct_os_test_image_stream_template "${THISDIR}/imagestreams/postgresql-${OS//[0-9]/}.json" "${THISDIR}/examples/${template}" postgresql "-p POSTGRESQL_VERSION=${VERSION}${tag}" done }