diff --git a/percona-distribution-postgresql-11/Dockerfile b/percona-distribution-postgresql-11/Dockerfile index 4ab83c232..9ed428fd5 100644 --- a/percona-distribution-postgresql-11/Dockerfile +++ b/percona-distribution-postgresql-11/Dockerfile @@ -5,10 +5,17 @@ LABEL org.opencontainers.image.authors="info@percona.com" RUN microdnf -y update; \ microdnf -y install glibc-langpack-en -ENV PPG_VERSION 11.17-3 +ENV PPG_VERSION 11.22-1 ENV OS_VER el8 ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + # check repository package signature in secure way RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ @@ -23,7 +30,7 @@ RUN set -ex; \ rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ #percona-release setup -y ppg11; \ - percona-release enable ppg-11.17 testing; + percona-release enable ppg-11.22 testing; RUN set -ex; \ microdnf -y update; \ @@ -60,7 +67,7 @@ RUN set -ex; \ percona-postgresql-common \ percona-pg_stat_monitor11 \ percona-pg_repack11 \ - percona-pgaudit \ + percona-pgaudit11 \ percona-pgaudit11_set_user \ percona-wal2json11; \ microdnf clean all; \ @@ -89,6 +96,12 @@ RUN set -eux; \ COPY entrypoint.sh /entrypoint.sh +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + VOLUME ["/data/db"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/percona-distribution-postgresql-11/entrypoint.sh b/percona-distribution-postgresql-11/entrypoint.sh index 3c99a9beb..229937a6a 100755 --- a/percona-distribution-postgresql-11/entrypoint.sh +++ b/percona-distribution-postgresql-11/entrypoint.sh @@ -326,6 +326,8 @@ _main() { echo fi fi + # PERCONA_TELEMETRY_DISABLE is handled at the very beginning of call-home.sh + ./call-home.sh -f "PRODUCT_FAMILY_POSTGRESQL" -v "11.22" -d "DOCKER" ${CALL_HOME_OPTIONAL_PARAMS} &> /dev/null || : exec "$@" } diff --git a/percona-distribution-postgresql-12/Dockerfile b/percona-distribution-postgresql-12/Dockerfile index 63c52d385..6447369f1 100644 --- a/percona-distribution-postgresql-12/Dockerfile +++ b/percona-distribution-postgresql-12/Dockerfile @@ -5,10 +5,17 @@ LABEL org.opencontainers.image.authors="info@percona.com" RUN microdnf -y update; \ microdnf -y install glibc-langpack-en -ENV PPG_VERSION 12.12-3 +ENV PPG_VERSION 12.17-1 ENV OS_VER el8 ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + # check repository package signature in secure way RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ @@ -23,7 +30,7 @@ RUN set -ex; \ rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ #percona-release setup -y ppg12; \ - percona-release enable ppg-12.12 testing; + percona-release enable ppg-12.17 testing; RUN set -ex; \ microdnf -y update; \ @@ -60,7 +67,7 @@ RUN set -ex; \ percona-postgresql-common \ percona-pg_stat_monitor12 \ percona-pg_repack12 \ - percona-pgaudit \ + percona-pgaudit12 \ percona-pgaudit12_set_user \ percona-wal2json12; \ microdnf clean all; \ @@ -89,6 +96,12 @@ RUN set -eux; \ COPY entrypoint.sh /entrypoint.sh +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + VOLUME ["/data/db"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/percona-distribution-postgresql-12/entrypoint.sh b/percona-distribution-postgresql-12/entrypoint.sh index 9ec0d7b83..a5410d7f6 100755 --- a/percona-distribution-postgresql-12/entrypoint.sh +++ b/percona-distribution-postgresql-12/entrypoint.sh @@ -326,6 +326,8 @@ _main() { echo fi fi + # PERCONA_TELEMETRY_DISABLE is handled at the very beginning of call-home.sh + ./call-home.sh -f "PRODUCT_FAMILY_POSTGRESQL" -v "12.17" -d "DOCKER" ${CALL_HOME_OPTIONAL_PARAMS} &> /dev/null || : exec "$@" } diff --git a/percona-distribution-postgresql-13/Dockerfile b/percona-distribution-postgresql-13/Dockerfile index 635af85d5..19242a06c 100644 --- a/percona-distribution-postgresql-13/Dockerfile +++ b/percona-distribution-postgresql-13/Dockerfile @@ -5,10 +5,17 @@ LABEL org.opencontainers.image.authors="info@percona.com" RUN microdnf -y update; \ microdnf -y install glibc-langpack-en -ENV PPG_VERSION 13.8-3 +ENV PPG_VERSION 13.13-1 ENV OS_VER el8 ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + # check repository package signature in secure way RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ @@ -23,7 +30,7 @@ RUN set -ex; \ rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ #percona-release setup -y ppg13; \ - percona-release enable ppg-13.8 testing; + percona-release enable ppg-13.13 testing; RUN set -ex; \ microdnf -y update; \ @@ -60,7 +67,7 @@ RUN set -ex; \ percona-postgresql-common \ percona-pg_stat_monitor13 \ percona-pg_repack13 \ - percona-pgaudit \ + percona-pgaudit13 \ percona-pgaudit13_set_user \ percona-wal2json13; \ microdnf clean all; \ @@ -89,6 +96,12 @@ RUN set -eux; \ COPY entrypoint.sh /entrypoint.sh +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + VOLUME ["/data/db"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/percona-distribution-postgresql-13/entrypoint.sh b/percona-distribution-postgresql-13/entrypoint.sh index 6b631e5c2..5a1fdb2af 100755 --- a/percona-distribution-postgresql-13/entrypoint.sh +++ b/percona-distribution-postgresql-13/entrypoint.sh @@ -326,6 +326,8 @@ _main() { echo fi fi + # PERCONA_TELEMETRY_DISABLE is handled at the very beginning of call-home.sh + ./call-home.sh -f "PRODUCT_FAMILY_POSTGRESQL" -v "13.13" -d "DOCKER" ${CALL_HOME_OPTIONAL_PARAMS} &> /dev/null || : exec "$@" } diff --git a/percona-distribution-postgresql-14/Dockerfile b/percona-distribution-postgresql-14/Dockerfile index 52ae63746..948b526a2 100644 --- a/percona-distribution-postgresql-14/Dockerfile +++ b/percona-distribution-postgresql-14/Dockerfile @@ -5,10 +5,17 @@ LABEL org.opencontainers.image.authors="info@percona.com" RUN microdnf -y update; \ microdnf -y install glibc-langpack-en -ENV PPG_VERSION 14.5-3 +ENV PPG_VERSION 14.10-1 ENV OS_VER el8 ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + # check repository package signature in secure way RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ @@ -23,7 +30,7 @@ RUN set -ex; \ rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ #percona-release setup -y ppg14; \ - percona-release enable ppg-14.5 testing; + percona-release enable ppg-14.10 testing; RUN set -ex; \ microdnf -y update; \ @@ -60,7 +67,7 @@ RUN set -ex; \ percona-postgresql-common \ percona-pg_stat_monitor14 \ percona-pg_repack14 \ - percona-pgaudit \ + percona-pgaudit14 \ percona-pgaudit14_set_user \ percona-wal2json14; \ microdnf clean all; \ @@ -89,6 +96,12 @@ RUN set -eux; \ COPY entrypoint.sh /entrypoint.sh +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + VOLUME ["/data/db"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/percona-distribution-postgresql-14/entrypoint.sh b/percona-distribution-postgresql-14/entrypoint.sh index e57838123..f42de1969 100755 --- a/percona-distribution-postgresql-14/entrypoint.sh +++ b/percona-distribution-postgresql-14/entrypoint.sh @@ -326,6 +326,8 @@ _main() { echo fi fi + # PERCONA_TELEMETRY_DISABLE is handled at the very beginning of call-home.sh + ./call-home.sh -f "PRODUCT_FAMILY_POSTGRESQL" -v "14.10" -d "DOCKER" ${CALL_HOME_OPTIONAL_PARAMS} &> /dev/null || : exec "$@" } diff --git a/percona-distribution-postgresql-15/Dockerfile b/percona-distribution-postgresql-15/Dockerfile index 92181345a..7175a2462 100644 --- a/percona-distribution-postgresql-15/Dockerfile +++ b/percona-distribution-postgresql-15/Dockerfile @@ -1,14 +1,21 @@ -FROM redhat/ubi8-minimal +FROM oraclelinux:9 LABEL org.opencontainers.image.authors="info@percona.com" -RUN microdnf -y update; \ - microdnf -y install glibc-langpack-en +RUN dnf -y update; \ + dnf -y install glibc-langpack-en -ENV PPG_VERSION 15.0-1 -ENV OS_VER el8 +ENV PPG_VERSION 15.5-1 +ENV OS_VER el9 ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + # check repository package signature in secure way RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ @@ -16,18 +23,18 @@ RUN set -ex; \ gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ - microdnf install -y findutils; \ + dnf install -y findutils; \ curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ rpmkeys --checksig /tmp/percona-release.rpm; \ rpm -i /tmp/percona-release.rpm; \ rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ #percona-release setup -y ppg15; \ - percona-release enable ppg-15.0 testing; + percona-release enable ppg-15.5 testing; RUN set -ex; \ - microdnf -y update; \ - microdnf -y install \ + dnf -y update; \ + dnf -y install \ bind-utils \ gettext \ hostname \ @@ -36,34 +43,28 @@ RUN set -ex; \ bzip2 \ lz4 \ procps-ng; \ - microdnf -y install \ + dnf -y install \ nss_wrapper \ shadow-utils \ libpq \ libedit; \ - microdnf clean all + dnf clean all # the numeric UID is needed for OpenShift RUN useradd -u 1001 -r -g 0 -s /sbin/nologin \ -c "Default Application User" postgres RUN set -ex; \ - export GNUPGHOME="$(mktemp -d)"; \ - curl -Lf -o /tmp/perl-JSON.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/perl-JSON-2.97.001-2.el8.noarch.rpm; \ - rpmkeys --checksig /tmp/perl-JSON.rpm; \ - rpm -i /tmp/perl-JSON.rpm - -RUN set -ex; \ - microdnf install -y \ + dnf install -y \ percona-postgresql15-server-${FULL_PERCONA_VERSION} \ percona-postgresql15-contrib-${FULL_PERCONA_VERSION} \ percona-postgresql-common \ percona-pg_stat_monitor15 \ percona-pg_repack15 \ - percona-pgaudit \ + percona-pgaudit15 \ percona-pgaudit15_set_user \ percona-wal2json15; \ - microdnf clean all; \ + dnf clean all; \ rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db /docker-entrypoint-initdb.d; \ chown -R 1001:0 /data/db docker-entrypoint-initdb.d @@ -89,6 +90,12 @@ RUN set -eux; \ COPY entrypoint.sh /entrypoint.sh +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + VOLUME ["/data/db"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/percona-distribution-postgresql-15/Dockerfile-ol8 b/percona-distribution-postgresql-15/Dockerfile-ol8 new file mode 100644 index 000000000..1a652d55f --- /dev/null +++ b/percona-distribution-postgresql-15/Dockerfile-ol8 @@ -0,0 +1,113 @@ +FROM redhat/ubi8-minimal + +LABEL org.opencontainers.image.authors="info@percona.com" + +RUN microdnf -y update; \ + microdnf -y install glibc-langpack-en + +ENV PPG_VERSION 15.5-1 +ENV OS_VER el8 +ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" + +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + microdnf install -y findutils; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ + #percona-release setup -y ppg15; \ + percona-release enable ppg-15.5 testing; + +RUN set -ex; \ + microdnf -y update; \ + microdnf -y install \ + bind-utils \ + gettext \ + hostname \ + perl \ + tar \ + bzip2 \ + lz4 \ + procps-ng; \ + microdnf -y install \ + nss_wrapper \ + shadow-utils \ + libpq \ + libedit; \ + microdnf clean all + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -s /sbin/nologin \ + -c "Default Application User" postgres + +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + curl -Lf -o /tmp/perl-JSON.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/perl-JSON-2.97.001-2.el8.noarch.rpm; \ + rpmkeys --checksig /tmp/perl-JSON.rpm; \ + rpm -i /tmp/perl-JSON.rpm + +RUN set -ex; \ + microdnf install -y \ + percona-postgresql15-server-${FULL_PERCONA_VERSION} \ + percona-postgresql15-contrib-${FULL_PERCONA_VERSION} \ + percona-postgresql-common \ + percona-pg_stat_monitor15 \ + percona-pg_repack15 \ + percona-pgaudit15 \ + percona-pgaudit15_set_user \ + percona-wal2json15; \ + microdnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db /docker-entrypoint-initdb.d; \ + chown -R 1001:0 /data/db docker-entrypoint-initdb.d + +RUN set -ex; \ + sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/pgsql-15/share/postgresql.conf.sample; \ + grep -F "listen_addresses = '*'" /usr/pgsql-15/share/postgresql.conf.sample + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-postgresql15/COPYRIGHT /licenses/COPYRIGHT.PostgreSQL + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +COPY entrypoint.sh /entrypoint.sh + +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + +VOLUME ["/data/db"] + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 5432 + +USER 1001 + +CMD ["postgres"] diff --git a/percona-distribution-postgresql-15/Dockerfile-ol9 b/percona-distribution-postgresql-15/Dockerfile-ol9 index 28d1a8fe7..f502528c0 100644 --- a/percona-distribution-postgresql-15/Dockerfile-ol9 +++ b/percona-distribution-postgresql-15/Dockerfile-ol9 @@ -5,10 +5,17 @@ LABEL org.opencontainers.image.authors="info@percona.com" RUN dnf -y update; \ dnf -y install glibc-langpack-en -ENV PPG_VERSION 15.0-1 +ENV PPG_VERSION 15.5-1 ENV OS_VER el9 ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + # check repository package signature in secure way RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ @@ -23,7 +30,7 @@ RUN set -ex; \ rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ #percona-release setup -y ppg15; \ - percona-release enable ppg-15.0 testing; + percona-release enable ppg-15.5 testing; RUN set -ex; \ dnf -y update; \ @@ -54,7 +61,7 @@ RUN set -ex; \ percona-postgresql-common \ percona-pg_stat_monitor15 \ percona-pg_repack15 \ - percona-pgaudit \ + percona-pgaudit15 \ percona-pgaudit15_set_user \ percona-wal2json15; \ dnf clean all; \ @@ -83,6 +90,12 @@ RUN set -eux; \ COPY entrypoint.sh /entrypoint.sh +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + VOLUME ["/data/db"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/percona-distribution-postgresql-15/entrypoint.sh b/percona-distribution-postgresql-15/entrypoint.sh index 9cc91641e..e45d5f883 100755 --- a/percona-distribution-postgresql-15/entrypoint.sh +++ b/percona-distribution-postgresql-15/entrypoint.sh @@ -326,6 +326,8 @@ _main() { echo fi fi + # PERCONA_TELEMETRY_DISABLE is handled at the very beginning of call-home.sh + ./call-home.sh -f "PRODUCT_FAMILY_POSTGRESQL" -v "15.5" -d "DOCKER" ${CALL_HOME_OPTIONAL_PARAMS} &> /dev/null || : exec "$@" } diff --git a/percona-distribution-postgresql-16/Dockerfile b/percona-distribution-postgresql-16/Dockerfile new file mode 100644 index 000000000..a5c076eb6 --- /dev/null +++ b/percona-distribution-postgresql-16/Dockerfile @@ -0,0 +1,107 @@ +FROM oraclelinux:9 + +LABEL org.opencontainers.image.authors="info@percona.com" + +RUN dnf -y update; \ + dnf -y install glibc-langpack-en + +ENV PPG_VERSION 16.1-2 +ENV OS_VER el9 +ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" + +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + dnf install -y findutils; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ + #percona-release setup -y ppg16; \ + percona-release enable ppg-16.1 testing; + +RUN set -ex; \ + dnf -y update; \ + dnf -y install \ + bind-utils \ + gettext \ + hostname \ + perl \ + tar \ + bzip2 \ + lz4 \ + procps-ng; \ + dnf -y install \ + nss_wrapper \ + shadow-utils \ + libpq \ + libedit; \ + dnf clean all + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -s /sbin/nologin \ + -c "Default Application User" postgres + +RUN set -ex; \ + dnf install -y \ + percona-postgresql16-server-${FULL_PERCONA_VERSION} \ + percona-postgresql16-contrib-${FULL_PERCONA_VERSION} \ + percona-postgresql-common \ + percona-pg_stat_monitor16 \ + percona-pg_repack16 \ + percona-pgaudit16 \ + percona-pgaudit16_set_user \ + percona-wal2json16; \ + dnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db /docker-entrypoint-initdb.d; \ + chown -R 1001:0 /data/db docker-entrypoint-initdb.d + +RUN set -ex; \ + sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/pgsql-16/share/postgresql.conf.sample; \ + grep -F "listen_addresses = '*'" /usr/pgsql-16/share/postgresql.conf.sample + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-postgresql16/COPYRIGHT /licenses/COPYRIGHT.PostgreSQL + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +COPY entrypoint.sh /entrypoint.sh + +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + +VOLUME ["/data/db"] + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 5432 + +USER 1001 + +CMD ["postgres"] diff --git a/percona-distribution-postgresql-16/Dockerfile-ol9 b/percona-distribution-postgresql-16/Dockerfile-ol9 new file mode 100644 index 000000000..be5b6b995 --- /dev/null +++ b/percona-distribution-postgresql-16/Dockerfile-ol9 @@ -0,0 +1,107 @@ +FROM oraclelinux:9 + +LABEL org.opencontainers.image.authors="info@percona.com" + +RUN dnf -y update; \ + dnf -y install glibc-langpack-en + +ENV PPG_VERSION 16.1-2 +ENV OS_VER el9 +ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" + +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + dnf install -y findutils; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ + #percona-release setup -y ppg16; \ + percona-release enable ppg-16.1 testing; + +RUN set -ex; \ + dnf -y update; \ + dnf -y install \ + bind-utils \ + gettext \ + hostname \ + perl \ + tar \ + bzip2 \ + lz4 \ + procps-ng; \ + dnf -y install \ + nss_wrapper \ + shadow-utils \ + libpq \ + libedit; \ + dnf clean all + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -s /sbin/nologin \ + -c "Default Application User" postgres + +RUN set -ex; \ + dnf install -y \ + percona-postgresql16-server-${FULL_PERCONA_VERSION} \ + percona-postgresql16-contrib-${FULL_PERCONA_VERSION} \ + percona-postgresql-common \ + percona-pg_stat_monitor16 \ + percona-pg_repack16 \ + percona-pgaudit \ + percona-pgaudit16_set_user \ + percona-wal2json16; \ + dnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db /docker-entrypoint-initdb.d; \ + chown -R 1001:0 /data/db docker-entrypoint-initdb.d + +RUN set -ex; \ + sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/pgsql-16/share/postgresql.conf.sample; \ + grep -F "listen_addresses = '*'" /usr/pgsql-16/share/postgresql.conf.sample + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-postgresql16/COPYRIGHT /licenses/COPYRIGHT.PostgreSQL + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +COPY entrypoint.sh /entrypoint.sh + +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + +VOLUME ["/data/db"] + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 5432 + +USER 1001 + +CMD ["postgres"] diff --git a/percona-distribution-postgresql-16/Dockerfile_back b/percona-distribution-postgresql-16/Dockerfile_back new file mode 100644 index 000000000..dcb534299 --- /dev/null +++ b/percona-distribution-postgresql-16/Dockerfile_back @@ -0,0 +1,113 @@ +FROM redhat/ubi8-minimal + +LABEL org.opencontainers.image.authors="info@percona.com" + +RUN microdnf -y update; \ + microdnf -y install glibc-langpack-en + +ENV PPG_VERSION 16.1-2 +ENV OS_VER el8 +ENV FULL_PERCONA_VERSION "$PPG_VERSION.$OS_VER" + +# Do not report during Docker image creation. +# Note that doing so, would create telemetry config file +# which would prevent reporting when new container is started. +# If we want to track Docker image creation as well, +# remove telemetry config file after installing packages! +ARG PERCONA_TELEMETRY_DISABLE=1 + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + microdnf install -y findutils; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ + #percona-release setup -y ppg16; \ + percona-release enable ppg-16.1 testing; + +RUN set -ex; \ + microdnf -y update; \ + microdnf -y install \ + bind-utils \ + gettext \ + hostname \ + perl \ + tar \ + bzip2 \ + lz4 \ + procps-ng; \ + microdnf -y install \ + nss_wrapper \ + shadow-utils \ + libpq \ + libedit; \ + microdnf clean all + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -s /sbin/nologin \ + -c "Default Application User" postgres + +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + curl -Lf -o /tmp/perl-JSON.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/perl-JSON-2.97.001-2.el8.noarch.rpm; \ + rpmkeys --checksig /tmp/perl-JSON.rpm; \ + rpm -i /tmp/perl-JSON.rpm + +RUN set -ex; \ + microdnf install -y \ + percona-postgresql16-server-${FULL_PERCONA_VERSION} \ + percona-postgresql16-contrib-${FULL_PERCONA_VERSION} \ + percona-postgresql-common \ + percona-pg_stat_monitor16 \ + percona-pg_repack16 \ + percona-pgaudit16 \ + percona-pgaudit16_set_user \ + percona-wal2json16; \ + microdnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db /docker-entrypoint-initdb.d; \ + chown -R 1001:0 /data/db docker-entrypoint-initdb.d + +RUN set -ex; \ + sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/pgsql-16/share/postgresql.conf.sample; \ + grep -F "listen_addresses = '*'" /usr/pgsql-16/share/postgresql.conf.sample + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-postgresql16/COPYRIGHT /licenses/COPYRIGHT.PostgreSQL + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +COPY entrypoint.sh /entrypoint.sh + +ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh +RUN chmod a+rx call-home.sh +RUN mkdir -p /usr/local/percona +RUN chown 1001:0 /usr/local/percona +ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}" + +VOLUME ["/data/db"] + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 5432 + +USER 1001 + +CMD ["postgres"] diff --git a/percona-distribution-postgresql-16/LICENSE b/percona-distribution-postgresql-16/LICENSE new file mode 100644 index 000000000..2399231f0 --- /dev/null +++ b/percona-distribution-postgresql-16/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 Percona, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/percona-distribution-postgresql-16/README-build.md b/percona-distribution-postgresql-16/README-build.md new file mode 100644 index 000000000..37554974d --- /dev/null +++ b/percona-distribution-postgresql-16/README-build.md @@ -0,0 +1,12 @@ + +Build image + + `docker build -t percona-distribution-postgresql .` + +Tag image + + `docker tag perconalab/percona-distribution-postgresql:16` + +Push to hub + + `docker push perconalab/percona-distribution-postgresql:16` diff --git a/percona-distribution-postgresql-16/README.md b/percona-distribution-postgresql-16/README.md new file mode 100644 index 000000000..0069877bc --- /dev/null +++ b/percona-distribution-postgresql-16/README.md @@ -0,0 +1,141 @@ +# What is Percona Distribution for PostgreSQL? + +Percona Distribution for PostgreSQL is the best and most critical enterprise-level components from the open-source community, designed and tested to work together in one single source. + +For more information and related downloads for Percona Distribution and other Percona products, please visit http://www.percona.com. + +# Percona Distribution for PostgreSQL Docker Images + +These are the only official Percona Distribution for PostgreSQL Docker images, created and maintained by the Percona team. The image has the Percona PG-Stat-Monitor plugin enabled + + Percona Distribution for PostgreSQL 16 (tag: 16) + +Images are updated when new releases are published. + +# How to Use the Images + +## Start a Percona Distribution for PostgreSQL Instance + +Start a Percona Distribution for PostgreSQL container as follows: + + docker run --name container-name -e POSTGRES_PASSWORD=secret -d perconalab/percona-distribution-postgresql:tag + +Where `container-name` is the name you want to assign to your container, `POSTGRES_PASSWORD` is the superuser password and `tag` is the tag specifying the version you want. + +To secure the password, you can export it to the environment file and use that to start the container: + + echo "POSTGRES_PASSWORD=secret" > .my-pg.env + docker run --rm -it --env-file ./.my-pg.env percona-distribution-postgresql:tag + +Where `container-name` is the name you want to assign to your container, `--env-file` is the path to the environment file containing the password and `tag` is the tag specifying the version you want. + +See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/perconalab/percona-distribution-postgresql/tags/). + +## Connect to Percona Distribution for PostgreSQL from an Application in Another Docker Container + +This image exposes the standard PostgreSQL port (5432), so container linking makes the instance available to other containers. Start other containers like this in order to link it to the Percona Distribution for PostgreSQL container: + + docker run --rm -it --name app-container-name --network container:container-name -d app-that-uses-postgresql + +where `app-container-name` is the name of the container where your application is running, `container name` is the name of your Percona Distribution for PostgreSQL container and `app-that-uses-postgresql` is the name of your PostgreSQL client. + +## Connect to Percona Distribution for PostgreSQL from the PSQL Command Line Client + +The following command starts another container instance and runs the `psql` command line client against your original container, allowing you to execute SQL statements against your database: + + docker run -it --network container:container-name --rm perconalab/percona-distribution-postgresql:tag psql -h container-name -U user-name + +where `container-name` is the name of your database container. + + +# Notes, Tips, Gotchas + +## Where to Store Data + +There are many two ways to store data used by applications that run in Docker containers. We maintain our usual stance and encourage users to investigate the options and use the method that best suits their use case. Here are some of the options available: + +* Let Docker manage the storage of your database data by writing the database files to disk on the host system using its own internal volume management. The current solutions, devicemapper, aufs and overlayfs have negative performance records. +* Create a data directory on the host system (outside the container on high performance storage) and mount this to a directory visible from inside the container. This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The user needs to make sure that the directory exists, and that permissions and other security mechanisms on the host system are set up correctly. + +The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blog and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above: + +1. Create a data directory on a suitable volume on your host system, e.g. `/local/datadir`. +2. Start your container like this: + +``` + docker run --name container-name -v /local/datadir:/data/db -d perconalab/percona-distribution-postgresql:tag +``` + +The `-v /local/datadir:/data/db` part of the command mounts the `/local/datadir` directory from the underlying host system as `/data/db` inside the container, where PostgreSQL by default will write its data files. + +## Enabling Percona PG-Stat-Monitor extension + +After launching container, to enable Percona PG-Stat-Monitor extension, connect to server, select desired database and execute: + +``` +create extension pg_stat_monitor; +``` + +To ensure that everything setup correctly, run: + +``` +\d pg_stat_monitor; +``` + +You will see following output: + +``` + View "public.pg_stat_monitor" + Column | Type | Collation | Nullable | Default +---------------------+--------------------------+-----------+----------+--------- + bucket | integer | | | + bucket_start_time | timestamp with time zone | | | + userid | oid | | | + dbid | oid | | | + queryid | text | | | + query | text | | | + plan_calls | bigint | | | + plan_total_time | numeric | | | + plan_min_timei | numeric | | | + plan_max_time | numeric | | | + plan_mean_time | numeric | | | + plan_stddev_time | numeric | | | + plan_rows | bigint | | | + calls | bigint | | | + total_time | numeric | | | + min_time | numeric | | | + max_time | numeric | | | + mean_time | numeric | | | + stddev_time | numeric | | | + rows | bigint | | | + shared_blks_hit | bigint | | | + shared_blks_read | bigint | | | + shared_blks_dirtied | bigint | | | + shared_blks_written | bigint | | | + local_blks_hit | bigint | | | + local_blks_read | bigint | | | + local_blks_dirtied | bigint | | | + local_blks_written | bigint | | | + temp_blks_read | bigint | | | + temp_blks_written | bigint | | | + blk_read_time | double precision | | | + blk_write_time | double precision | | | + host | bigint | | | + client_ip | inet | | | + resp_calls | text[] | | | + cpu_user_time | double precision | | | + cpu_sys_time | double precision | | | + tables_names | text[] | | | + wait_event | text | | | + wait_event_type | text | | | + ``` + +## Passing options to the server + +You can pass parameters to PostgreSQL server by appending them to the `env`: + + docker run --name my-container-name -e POSTGRES_PASSWORD=root -d perconalab/percona-distribution-postgresql:tag + +# User Feedback + +We welcome your feedback! diff --git a/percona-distribution-postgresql-16/entrypoint.sh b/percona-distribution-postgresql-16/entrypoint.sh new file mode 100755 index 000000000..8e4662555 --- /dev/null +++ b/percona-distribution-postgresql-16/entrypoint.sh @@ -0,0 +1,337 @@ +#!/usr/bin/env bash +set -Eeo pipefail +# TODO swap to -Eeuo pipefail above (after handling all potentially-unset variables) + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# check to see if this file is being run or sourced from another script +_is_sourced() { + # https://unix.stackexchange.com/a/215279 + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] +} + +# used to create initial postgres directories and if run as root, ensure ownership to the "postgres" user +docker_create_db_directories() { + local user; user="$(id -u)" + + mkdir -p "$PGDATA" + chmod 700 "$PGDATA" + + # ignore failure since it will be fine when using the image provided directory; see also https://github.com/docker-library/postgres/pull/289 + mkdir -p /var/run/postgresql || : + chmod 775 /var/run/postgresql || : + + # Create the transaction log directory before initdb is run so the directory is owned by the correct user + if [ -n "$POSTGRES_INITDB_WALDIR" ]; then + mkdir -p "$POSTGRES_INITDB_WALDIR" + if [ "$user" = '0' ]; then + find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' + + fi + chmod 700 "$POSTGRES_INITDB_WALDIR" + fi + + # allow the container to be started with `--user` + if [ "$user" = '0' ]; then + find "$PGDATA" \! -user postgres -exec chown postgres '{}' + + find /var/run/postgresql \! -user postgres -exec chown postgres '{}' + + fi +} + +# initialize empty PGDATA directory with new database via 'initdb' +# arguments to `initdb` can be passed via POSTGRES_INITDB_ARGS or as arguments to this function +# `initdb` automatically creates the "postgres", "template0", and "template1" dbnames +# this is also where the database user is created, specified by `POSTGRES_USER` env +docker_init_database_dir() { + # "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary + # see https://github.com/docker-library/postgres/pull/253, https://github.com/docker-library/postgres/issues/359, https://cwrap.org/nss_wrapper.html + if ! getent passwd "$(id -u)" &> /dev/null && [ -e /usr/lib/libnss_wrapper.so ]; then + export LD_PRELOAD='/usr/lib/libnss_wrapper.so' + export NSS_WRAPPER_PASSWD="$(mktemp)" + export NSS_WRAPPER_GROUP="$(mktemp)" + echo "postgres:x:$(id -u):$(id -g):PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD" + echo "postgres:x:$(id -g):" > "$NSS_WRAPPER_GROUP" + fi + + if [ -n "$POSTGRES_INITDB_WALDIR" ]; then + set -- --waldir "$POSTGRES_INITDB_WALDIR" "$@" + fi + + eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"' "$@"' + + # unset/cleanup "nss_wrapper" bits + if [ "${LD_PRELOAD:-}" = '/usr/lib/libnss_wrapper.so' ]; then + rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP" + unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP + fi +} + +# print large warning if POSTGRES_PASSWORD is long +# error if both POSTGRES_PASSWORD is empty and POSTGRES_HOST_AUTH_METHOD is not 'trust' +# print large warning if POSTGRES_HOST_AUTH_METHOD is set to 'trust' +# assumes database is not set up, ie: [ -z "$DATABASE_ALREADY_EXISTS" ] +docker_verify_minimum_env() { + # check password first so we can output the warning before postgres + # messes it up + if [ "${#POSTGRES_PASSWORD}" -ge 100 ]; then + cat >&2 <<-'EOWARN' + + WARNING: The supplied POSTGRES_PASSWORD is 100+ characters. + + This will not work if used via PGPASSWORD with "psql". + + https://www.postgresql.org/message-id/flat/E1Rqxp2-0004Qt-PL%40wrigleys.postgresql.org (BUG #6412) + https://github.com/docker-library/postgres/issues/507 + + EOWARN + fi + if [ -z "$POSTGRES_PASSWORD" ] && [ 'trust' != "$POSTGRES_HOST_AUTH_METHOD" ]; then + # The - option suppresses leading tabs but *not* spaces. :) + cat >&2 <<-'EOE' + Error: Database is uninitialized and superuser password is not specified. + You must specify POSTGRES_PASSWORD to a non-empty value for the + superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run". + + You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all + connections without a password. This is *not* recommended. + + See PostgreSQL documentation about "trust": + https://www.postgresql.org/docs/current/auth-trust.html + EOE + exit 1 + fi + if [ 'trust' = "$POSTGRES_HOST_AUTH_METHOD" ]; then + cat >&2 <<-'EOWARN' + ******************************************************************************** + WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow + anyone with access to the Postgres port to access your database without + a password, even if POSTGRES_PASSWORD is set. See PostgreSQL + documentation about "trust": + https://www.postgresql.org/docs/current/auth-trust.html + In Docker's default configuration, this is effectively any other + container on the same system. + + It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace + it with "-e POSTGRES_PASSWORD=password" instead to set a password in + "docker run". + ******************************************************************************** + EOWARN + fi +} + +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions and permissions +docker_process_init_files() { + # psql here for backwards compatiblilty "${psql[@]}" + psql=( docker_process_sql ) + + echo + local f + for f; do + case "$f" in + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + echo "$0: running $f" + "$f" + else + echo "$0: sourcing $f" + . "$f" + fi + ;; + *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo + done +} + +# Execute sql script, passed via stdin (or -f flag of psql) +# usage: docker_process_sql [psql-cli-args] +# ie: docker_process_sql --dbname=mydb <<<'INSERT ...' +# ie: docker_process_sql -f my-file.sql +# ie: docker_process_sql > "$PGDATA/pg_hba.conf" +} + +# start socket-only postgresql server for setting up or running scripts +# all arguments will be passed along as arguments to `postgres` (via pg_ctl) +docker_temp_server_start() { + if [ "$1" = 'postgres' ]; then + shift + fi + + # internal start of server in order to allow setup using psql client + # does not listen on external TCP/IP and waits until start finishes + set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}" + + PGUSER="${PGUSER:-$POSTGRES_USER}" \ + pg_ctl -D "$PGDATA" \ + -o "$(printf '%q ' "$@")" \ + -w start +} + +# stop postgresql server after done setting up user and running scripts +docker_temp_server_stop() { + PGUSER="${PGUSER:-postgres}" \ + pg_ctl -D "$PGDATA" -m fast -w stop +} + + +pg_setup_pg_stat_monitor() { + docker_process_sql --dbname postgres <<-'EOSQL' + alter system set shared_preload_libraries=pg_stat_monitor ; + EOSQL +} + + +# check arguments for an option that would cause postgres to stop +# return true if there is one +_pg_want_help() { + local arg + for arg; do + case "$arg" in + # postgres --help | grep 'then exit' + # leaving out -C on purpose since it always fails and is unhelpful: + # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory + -'?'|--help|--describe-config|-V|--version) + return 0 + ;; + esac + done + return 1 +} + +_main() { + # if first arg looks like a flag, assume we want to run postgres server + if [ "${1:0:1}" = '-' ]; then + set -- postgres "$@" + fi + + export PATH=$PATH:/usr/pgsql-16/bin + + if [ "$1" = 'postgres' ] && ! _pg_want_help "$@"; then + docker_setup_env + # setup data directories and permissions (when run as root) + if [[ -z "$PGDATA" ]]; then + export PGDATA=/data/db + fi + docker_create_db_directories + if [ "$(id -u)" = '0' ]; then + # then restart script as postgres user + exec gosu postgres "$BASH_SOURCE" "$@" + fi + + # only run initialization on an empty data directory + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + + docker_init_database_dir + pg_setup_hba_conf + + # PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless + # e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS + export PGPASSWORD="${PGPASSWORD:-$POSTGRES_PASSWORD}" + docker_temp_server_start "$@" + + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + pg_setup_pg_stat_monitor + + docker_temp_server_stop + unset PGPASSWORD + + echo + echo 'PostgreSQL init process complete; ready for start up.' + echo + else + echo + echo 'PostgreSQL Database directory appears to contain a database; Skipping initialization' + echo + fi + fi + # PERCONA_TELEMETRY_DISABLE is handled at the very beginning of call-home.sh + ./call-home.sh -f "PRODUCT_FAMILY_POSTGRESQL" -v "16.1" -d "DOCKER" ${CALL_HOME_OPTIONAL_PARAMS} &> /dev/null || : + + exec "$@" +} + +if ! _is_sourced; then + _main "$@" +fi