From db06191665c78b6005f0141abd31bafea0ca0501 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 28 Jan 2025 15:59:52 +0100 Subject: [PATCH 1/2] Add support for RHEL10 for dist-gen source files. PostgreSQL 16 is supported on RHEL10. README.md file is updated for the each version as well. Signed-off-by: Petr "Stone" Hracek --- manifest.yml | 3 +++ specs/multispec.yml | 11 +++++++++++ src/Dockerfile | 4 ++-- .../usr/share/container-scripts/postgresql/README.md | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/manifest.yml b/manifest.yml index b11b4022..de712638 100644 --- a/manifest.yml +++ b/manifest.yml @@ -29,6 +29,9 @@ DISTGEN_MULTI_RULES: - src: src/Dockerfile dest: Dockerfile.rhel9 + - src: src/Dockerfile + dest: Dockerfile.rhel10 + - src: src/Dockerfile dest: Dockerfile.c9s diff --git a/specs/multispec.yml b/specs/multispec.yml index 4a36adcd..70ddfd85 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -52,6 +52,16 @@ specs: { yum -y module enable postgresql:{{ spec.version }} || :; } && \ post_install: >-4 (yum -y reinstall tzdata || yum -y update tzdata ) && \ + rhel10: + distros: + - rhel-10-x86_64 + s2i_base: ubi10/s2i-core + org: "rhel10" + prod: "rhel10" + openshift_tags: "database,postgresql,postgresql{{ spec.short }},postgresql-{{ spec.short }}" + redhat_component: "postgresql-{{ spec.short }}-container" + img_name: "{{ spec.org }}/postgresql-{{ spec.short }}" + pkgs: "postgresql{{ spec.short }}-server postgresql{{ spec.short }}-contrib" c9s: distros: - centos-stream-9-x86_64 @@ -139,3 +149,4 @@ matrix: - centos-stream-9-x86_64 - fedora-40-x86_64 - centos-stream-10-x86_64 + - rhel-10-x86_64 diff --git a/src/Dockerfile b/src/Dockerfile index 55da1c75..881312e8 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -55,7 +55,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions {% if spec.repo_enable_reason %} {{ spec.repo_enable_reason }} {% endif %} -{% if spec.prod == "c10s" %} +{% if spec.prod == "c10s" or spec.prod == "rhel10" %} RUN INSTALL_PKGS="rsync tar gettext-envsubst bind-utils nss_wrapper-libs glibc-locale-source xz" && \ PSQL_PKGS="{{ spec.pkgs }}" && \ {% elif spec.prod == "rhel9" and spec.version == "13" %} \ @@ -70,7 +70,7 @@ RUN {{ spec.environment_setup }} INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ {% endif %} {% endif %} -{% if spec.prod == "c10s" %} +{% if spec.prod == "c10s" or spec.prod == "rhel10" %} yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS $PSQL_PKGS && \ rpm -V $INSTALL_PKGS {{ spec.check_pkgs }} && \ {% else %} diff --git a/src/root/usr/share/container-scripts/postgresql/README.md b/src/root/usr/share/container-scripts/postgresql/README.md index 37c2469a..8ab2f87a 100644 --- a/src/root/usr/share/container-scripts/postgresql/README.md +++ b/src/root/usr/share/container-scripts/postgresql/README.md @@ -200,4 +200,4 @@ Subsequently, log output is redirected to the logging collector process and will ## Additional Resources -The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, and the Fedora Dockerfile is named Dockerfile.fedora. +The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, the RHEL10 Dockerfile is named Dockerfile.rhel10, and the Fedora Dockerfile is named Dockerfile.fedora. From 005cbc717766385cfb1b8414c16f2af2c82ebdf5 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 28 Jan 2025 16:01:03 +0100 Subject: [PATCH 2/2] Update README.md files and add generated 16/Dockerfile.rhel10 Signed-off-by: Petr "Stone" Hracek --- .../container-scripts/postgresql/README.md | 2 +- .../container-scripts/postgresql/README.md | 2 +- .../container-scripts/postgresql/README.md | 2 +- 16/Dockerfile.rhel10 | 92 +++++++++++++++++++ .../container-scripts/postgresql/README.md | 2 +- README.md | 1 + 6 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 16/Dockerfile.rhel10 diff --git a/12/root/usr/share/container-scripts/postgresql/README.md b/12/root/usr/share/container-scripts/postgresql/README.md index 3cb10149..9420848b 100644 --- a/12/root/usr/share/container-scripts/postgresql/README.md +++ b/12/root/usr/share/container-scripts/postgresql/README.md @@ -200,4 +200,4 @@ Subsequently, log output is redirected to the logging collector process and will ## Additional Resources -The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, and the Fedora Dockerfile is named Dockerfile.fedora. +The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, the RHEL10 Dockerfile is named Dockerfile.rhel10, and the Fedora Dockerfile is named Dockerfile.fedora. diff --git a/13/root/usr/share/container-scripts/postgresql/README.md b/13/root/usr/share/container-scripts/postgresql/README.md index 3ee52614..d981794b 100644 --- a/13/root/usr/share/container-scripts/postgresql/README.md +++ b/13/root/usr/share/container-scripts/postgresql/README.md @@ -200,4 +200,4 @@ Subsequently, log output is redirected to the logging collector process and will ## Additional Resources -The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, and the Fedora Dockerfile is named Dockerfile.fedora. +The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, the RHEL10 Dockerfile is named Dockerfile.rhel10, and the Fedora Dockerfile is named Dockerfile.fedora. diff --git a/15/root/usr/share/container-scripts/postgresql/README.md b/15/root/usr/share/container-scripts/postgresql/README.md index c91a0565..33d31a04 100644 --- a/15/root/usr/share/container-scripts/postgresql/README.md +++ b/15/root/usr/share/container-scripts/postgresql/README.md @@ -200,4 +200,4 @@ Subsequently, log output is redirected to the logging collector process and will ## Additional Resources -The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, and the Fedora Dockerfile is named Dockerfile.fedora. +The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, the RHEL10 Dockerfile is named Dockerfile.rhel10, and the Fedora Dockerfile is named Dockerfile.fedora. diff --git a/16/Dockerfile.rhel10 b/16/Dockerfile.rhel10 new file mode 100644 index 00000000..b482e7c8 --- /dev/null +++ b/16/Dockerfile.rhel10 @@ -0,0 +1,92 @@ +FROM ubi10/s2i-core + +# PostgreSQL image for OpenShift. +# Volumes: +# * /var/lib/pgsql/data - Database cluster for PostgreSQL +# Environment: +# * $POSTGRESQL_USER - Database user name +# * $POSTGRESQL_PASSWORD - User's password +# * $POSTGRESQL_DATABASE - Name of the database to create +# * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres' +# PostgreSQL administrative account + +ENV POSTGRESQL_VERSION=16 \ + POSTGRESQL_PREV_VERSION=15 \ + HOME=/var/lib/pgsql \ + PGUSER=postgres \ + APP_DATA=/opt/app-root + +ENV SUMMARY="PostgreSQL is an advanced Object-Relational database management system" \ + DESCRIPTION="PostgreSQL is an advanced Object-Relational database management system (DBMS). \ +The image contains the client and server programs that you'll need to \ +create, run, maintain and access a PostgreSQL DBMS server." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="PostgreSQL 16" \ + io.openshift.expose-services="5432:postgresql" \ + io.openshift.tags="database,postgresql,postgresql16,postgresql-16" \ + io.openshift.s2i.assemble-user="26" \ + name="rhel10/postgresql-16" \ + com.redhat.component="postgresql-16-container" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ + usage="podman run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 rhel10/postgresql-16" \ + maintainer="SoftwareCollections.org " + +EXPOSE 5432 + +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" && \ + PSQL_PKGS="postgresql16-server postgresql16-contrib" && \ + INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \ + INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \ + yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS $PSQL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \ + yum -y clean all --enablerepo='*' && \ + localedef -f UTF-8 -i en_US en_US.UTF-8 && \ + test "$(id postgres)" = "uid=26(postgres) gid=26(postgres) groups=26(postgres)" && \ + mkdir -p /var/lib/pgsql/data && \ + mkdir -p /run/postgresql && \ + /usr/libexec/fix-permissions /var/lib/pgsql /run/postgresql + +# Get prefix path and path to scripts rather than hard-code them in scripts +ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/postgresql \ + ENABLED_COLLECTIONS= + +COPY root / +COPY ./s2i/bin/ $STI_SCRIPTS_PATH + +# Hard links are not supported in Testing Farm approach during sync to guest +# operation system. Therefore tests are failing on error +# /usr/libexec/s2i/run no such file or directory +RUN ln -s /usr/bin/run-postgresql $STI_SCRIPTS_PATH/run + +# Not using VOLUME statement since it's not working in OpenShift Online: +# https://github.com/sclorg/httpd-container/issues/30 +# VOLUME ["/var/lib/pgsql/data"] + +# S2I permission fixes +# -------------------- +# 1. unless specified otherwise (or - equivalently - we are in OpenShift), s2i +# build process would be executed as 'uid=26(postgres) gid=26(postgres)'. +# Such process wouldn't be able to execute the default 'assemble' script +# correctly (it transitively executes 'fix-permissions' script). So let's +# add the 'postgres' user into 'root' group here +# +# 2. we call fix-permissions on $APP_DATA here directly (UID=0 during build +# anyways) to assure that s2i process is actually able to _read_ the +# user-specified scripting. +RUN usermod -a -G root postgres && \ + /usr/libexec/fix-permissions --read-only "$APP_DATA" + +USER 26 + +ENTRYPOINT ["container-entrypoint"] +CMD ["run-postgresql"] diff --git a/16/root/usr/share/container-scripts/postgresql/README.md b/16/root/usr/share/container-scripts/postgresql/README.md index c79cf68e..348060da 100644 --- a/16/root/usr/share/container-scripts/postgresql/README.md +++ b/16/root/usr/share/container-scripts/postgresql/README.md @@ -200,4 +200,4 @@ Subsequently, log output is redirected to the logging collector process and will ## Additional Resources -The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, and the Fedora Dockerfile is named Dockerfile.fedora. +The Dockerfile and other sources related to this container image can be found at https://github.com/sclorg/postgresql-container. In this repository, the RHEL8 Dockerfile is named Dockerfile.rhel8, the RHEL9 Dockerfile is named Dockerfile.rhel9, the RHEL10 Dockerfile is named Dockerfile.rhel10, and the Fedora Dockerfile is named Dockerfile.fedora. diff --git a/README.md b/README.md index 51c2104f..4c317745 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ PostgreSQL versions currently supported are: RHEL versions currently supported are: - RHEL8 - RHEL9 +- RHEL10 CentOS versions currently supported are: - CentOS Stream 9