From 68da5267abe23a58f8052f2e0ce9d78c78599dc0 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Thu, 13 Nov 2025 20:41:30 +0100 Subject: [PATCH 01/11] Add PostgreSQL client for v18 --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 415ae0aa3..a5b381420 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,8 @@ RUN set -ex && \ sudo supervisor logrotate locales curl \ meson \ nginx openssh-server redis-tools \ - postgresql-client-13 postgresql-client-14 postgresql-client-15 postgresql-client-16 postgresql-client-17 \ + postgresql-client-13 postgresql-client-14 postgresql-client-15 \ + postgresql-client-16 postgresql-client-17 postgresql-client-18 \ python3 python3-docutils nodejs yarn gettext-base graphicsmagick \ libpq5 zlib1g libyaml-dev libssl-dev libgdbm-dev libre2-dev \ libreadline-dev libncurses5-dev libffi-dev curl openssh-server libxml2-dev libxslt-dev \ From d52f098e3786f51b1cec71a75296fff928795527 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Thu, 13 Nov 2025 21:29:54 +0100 Subject: [PATCH 02/11] Remove postgresql-clients in versions before 16 --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a5b381420..974e793ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,6 @@ RUN set -ex && \ sudo supervisor logrotate locales curl \ meson \ nginx openssh-server redis-tools \ - postgresql-client-13 postgresql-client-14 postgresql-client-15 \ postgresql-client-16 postgresql-client-17 postgresql-client-18 \ python3 python3-docutils nodejs yarn gettext-base graphicsmagick \ libpq5 zlib1g libyaml-dev libssl-dev libgdbm-dev libre2-dev \ From f84a0cc8e146707724ff56d4394995754d9b68e0 Mon Sep 17 00:00:00 2001 From: KIMURA Kazunori Date: Fri, 14 Nov 2025 15:38:51 +0900 Subject: [PATCH 03/11] fix typo in comment in gitlab_generate_postgresqlrc() --- assets/runtime/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index 564d0e651..c10f7ac71 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -196,7 +196,7 @@ gitlab_generate_postgresqlrc() { DB_CLIENT_VERSION_PACKAGE_NAME= if [[ "${DB_SERVER_VERSION_MAJOR}" -ge 10 ]]; then - # v10 or later: use "rought major version" as version number in package name + # v10 or later: use "rough major version" as version number in package name DB_CLIENT_VERSION_PACKAGE_NAME=${DB_SERVER_VERSION_MAJOR} else # prior to v10: convert From 5f52a8920ccb64d4d2540aa6e03bd8331d2a2701 Mon Sep 17 00:00:00 2001 From: KIMURA Kazunori Date: Fri, 14 Nov 2025 16:18:22 +0900 Subject: [PATCH 04/11] Check if server side DB version met requirement --- Dockerfile | 5 ++++- assets/runtime/functions | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 974e793ca..6c4722020 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,10 @@ ENV GITLAB_VERSION=${VERSION} \ GITLAB_CACHE_DIR="/etc/docker-gitlab" \ RAILS_ENV=production \ NODE_ENV=production \ - NO_SOURCEMAPS=true + NO_SOURCEMAPS=true \ + # v18.5.2 : minimum = 16.5, maximum = 17.x (currently 17.6, is 170006) + POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM=160005 \ + POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM=170100 ENV GITLAB_INSTALL_DIR="${GITLAB_HOME}/gitlab" \ GITLAB_SHELL_INSTALL_DIR="${GITLAB_HOME}/gitlab-shell" \ diff --git a/assets/runtime/functions b/assets/runtime/functions index c10f7ac71..13754d67a 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -190,11 +190,23 @@ gitlab_generate_postgresqlrc() { echo "- Detected server version: ${DB_SERVER_VERSION}" + # remove leading zero (prior to 10.x it was like "090605" so that cannot treated as number) + DB_SERVER_VERSION="${DB_SERVER_VERSION##+(0)}" + # Anyway, we can get major version (8, 9, 10 and so on) by dividing by 10000. # DB_SERVER_VERSION_MAJOR=${DB_SERVER_VERSION%%.*} DB_SERVER_VERSION_MAJOR=$((DB_SERVER_VERSION/10000)) DB_CLIENT_VERSION_PACKAGE_NAME= + # Check version requirement + if [[ "${DB_SERVER_VERSION}" -lt "${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM}" + || "${DB_SERVER_VERSION}" -gt "${POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM}" + ]]; then + echo " Version requirement mismatch! (${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM} < ${DB_SERVER_VERSION} < ${POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM})" + echo " Aborting.." + return 1 + fi + if [[ "${DB_SERVER_VERSION_MAJOR}" -ge 10 ]]; then # v10 or later: use "rough major version" as version number in package name DB_CLIENT_VERSION_PACKAGE_NAME=${DB_SERVER_VERSION_MAJOR} From c49949ba0529359f4fcc208ceeb63793dab867e8 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Wed, 27 May 2026 09:35:00 +0200 Subject: [PATCH 05/11] Stop the container or display a warning at startup, depending on PostgreSQL requirements --- Dockerfile | 4 ++-- assets/runtime/functions | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6c4722020..f18b5504c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,9 @@ ENV GITLAB_VERSION=${VERSION} \ RAILS_ENV=production \ NODE_ENV=production \ NO_SOURCEMAPS=true \ - # v18.5.2 : minimum = 16.5, maximum = 17.x (currently 17.6, is 170006) + # v18.5.2 : minimum = 16.5, maximum = 17.x (currently 17.10, is 170010) POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM=160005 \ - POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM=170100 + POSTGRESQL_SERVER_TESTED_VERSION_MAXIMUM=170010 ENV GITLAB_INSTALL_DIR="${GITLAB_HOME}/gitlab" \ GITLAB_SHELL_INSTALL_DIR="${GITLAB_HOME}/gitlab-shell" \ diff --git a/assets/runtime/functions b/assets/runtime/functions index 13754d67a..ca78dc33e 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -199,13 +199,26 @@ gitlab_generate_postgresqlrc() { DB_CLIENT_VERSION_PACKAGE_NAME= # Check version requirement - if [[ "${DB_SERVER_VERSION}" -lt "${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM}" - || "${DB_SERVER_VERSION}" -gt "${POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM}" - ]]; then - echo " Version requirement mismatch! (${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM} < ${DB_SERVER_VERSION} < ${POSTGRESQL_SERVER_REQUIRED_VERSION_MAXIMUM})" - echo " Aborting.." + if [[ "${DB_SERVER_VERSION}" -lt "${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM}" ]]; then + echo " ERROR: Version requirement mismatch for your PostgreSQL server!" + echo + echo " Consider upgrading your PostgreSQL server before running this or later versions" + echo " of this image." + echo + echo " Minimal required version is: ${POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM}" + echo " Your provided version is : ${DB_SERVER_VERSION}" + echo + echo " Aborting..." return 1 fi + + if [[ "${DB_SERVER_VERSION}" -gt "${POSTGRESQL_SERVER_TESTED_VERSION_MAXIMUM}" ]]; then + echo " WARNING: Version requirement mismatch for your PostgreSQL server!" + echo + echo " Maximal tested version is: ${POSTGRESQL_SERVER_TESTED_VERSION_MAXIMUM}" + echo " Your provided version is : ${DB_SERVER_VERSION}" + echo + fi if [[ "${DB_SERVER_VERSION_MAJOR}" -ge 10 ]]; then # v10 or later: use "rough major version" as version number in package name From 91199a0528497d842fe1cb48e2455c425dc9f339 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Wed, 27 May 2026 09:39:03 +0200 Subject: [PATCH 06/11] Remove package for postgresql-client in v16 and add client in v19 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f18b5504c..76fb5bb92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ RUN set -ex && \ sudo supervisor logrotate locales curl \ meson \ nginx openssh-server redis-tools \ - postgresql-client-16 postgresql-client-17 postgresql-client-18 \ + postgresql-client-17 postgresql-client-18 postgresql-client-19 \ python3 python3-docutils nodejs yarn gettext-base graphicsmagick \ libpq5 zlib1g libyaml-dev libssl-dev libgdbm-dev libre2-dev \ libreadline-dev libncurses5-dev libffi-dev curl openssh-server libxml2-dev libxslt-dev \ From dc88e97e7001fbc39b547f09b120b7c06a901b88 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Wed, 27 May 2026 09:39:58 +0200 Subject: [PATCH 07/11] Raise the minimum required and the maximum tested postgres server versions --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 76fb5bb92..be81a7863 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,8 @@ ENV GITLAB_VERSION=${VERSION} \ RAILS_ENV=production \ NODE_ENV=production \ NO_SOURCEMAPS=true \ - # v18.5.2 : minimum = 16.5, maximum = 17.x (currently 17.10, is 170010) - POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM=160005 \ + # v19.0.0 : minimum = 17.0, maximum = 17.x (currently 17.10, is 170010) + POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM=170000 \ POSTGRESQL_SERVER_TESTED_VERSION_MAXIMUM=170010 ENV GITLAB_INSTALL_DIR="${GITLAB_HOME}/gitlab" \ From 1c9b5d1e3afab9b4ddc344c9e0781a7a19254a99 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Wed, 27 May 2026 10:08:36 +0200 Subject: [PATCH 08/11] Remove package for postgresql-client in v19 (currently in development) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index be81a7863..e27e99163 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ RUN set -ex && \ sudo supervisor logrotate locales curl \ meson \ nginx openssh-server redis-tools \ - postgresql-client-17 postgresql-client-18 postgresql-client-19 \ + postgresql-client-17 postgresql-client-18 \ python3 python3-docutils nodejs yarn gettext-base graphicsmagick \ libpq5 zlib1g libyaml-dev libssl-dev libgdbm-dev libre2-dev \ libreadline-dev libncurses5-dev libffi-dev curl openssh-server libxml2-dev libxslt-dev \ From 0d736913b1b070b568bf0de27a30fe874c4f1f06 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Wed, 27 May 2026 13:03:17 +0200 Subject: [PATCH 09/11] Update files related to required postgres image version --- Changelog.md | 3 +++ Makefile | 2 +- README.md | 15 +++++++-------- contrib/docker-swarm/docker-compose.yml | 2 +- docker-compose.swarm.yml | 2 +- docker-compose.yml | 2 +- docs/docker-compose-keycloak.yml | 2 +- docs/docker-compose-registry.yml | 2 +- docs/s3_compatible_storage.md | 2 +- kubernetes/postgresql-rc.yml | 2 +- 10 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Changelog.md b/Changelog.md index f2d22a529..46bd4e204 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,11 +5,14 @@ gitlab.com/gitlab-org/gitlab-foss/blob/master/CHANGELOG.md) for the list of chan ## 19.0.0 +**Important note:** In GitLab 19.0 and later, [PostgreSQL 17 is the minimum supported version](https://docs.gitlab.com/releases/19/gitlab-19-0-released/#postgresql-17-minimum-requirement). + - gitlab: upgrade CE to v19.0.0 - gitaly: upgrade to v19.0.0 - gitlab-pages: upgrade to v19.0.0 - gitlab-shell: upgrade to v14.51.0 - rubygems: upgrade to v4.0.12 +- postgresql: upgrade to postgresql 17 ## 18.11.3 diff --git a/Makefile b/Makefile index a97663fe8..968513dcc 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ quickstart: @docker run --name=gitlab-postgresql -d \ --env='DB_NAME=gitlabhq_production' \ --env='DB_USER=gitlab' --env='DB_PASS=password' \ - sameersbn/postgresql:latest + kkimurak/sameersbn-postgresql:17 @echo "Starting redis container..." @docker run --name=gitlab-redis -d \ sameersbn/redis:latest diff --git a/README.md b/README.md index 0c42b3c64..a9800502b 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ docker run --name gitlab-postgresql -d \ --env 'DB_USER=gitlab' --env 'DB_PASS=password' \ --env 'DB_EXTENSION=pg_trgm,btree_gist' \ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \ - kkimurak/sameersbn-postgresql:16 + kkimurak/sameersbn-postgresql:17 ``` Step 2. Launch a redis container @@ -276,11 +276,8 @@ Configuring gitlab::database Please note furthermore, that only compatible versions of the `postgresql-client` to GitLab are shipped with this image. Currently, these belong to -- `postgresql-client-13`, -- `postgresql-client-14`, -- `postgresql-client-15`, -- `postgresql-client-16`, -- and `postgresql-client-17`. +- `postgresql-client-17` and +- `postgresql-client-18` (not officially supported). ***Notes:*** @@ -288,6 +285,7 @@ Please note furthermore, that only compatible versions of the `postgresql-client - GitLab CE version 16.0.0 and later requires PostgreSQL version 13.x. - GitLab CE version 17.0.0 and later requires PostgreSQL version 14.x. - GitLab CE version 18.0.0 and later requires PostgreSQL version 16.x. +- GitLab CE version 19.0.0 and later requires PostgreSQL version 17.x. ##### External PostgreSQL Server @@ -325,7 +323,7 @@ To illustrate linking with a postgresql container, we will use the [sameersbn/po First, let's pull the postgresql image from the docker index. ```bash -docker pull kkimurak/sameersbn-postgresql:16 +docker pull kkimurak/sameersbn-postgresql:17 ``` For data persistence lets create a store for the postgresql and start the container. @@ -345,7 +343,7 @@ docker run --name gitlab-postgresql -d \ --env 'DB_USER=gitlab' --env 'DB_PASS=password' \ --env 'DB_EXTENSION=pg_trgm' \ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \ - kkimurak/sameersbn-postgresql:16 + kkimurak/sameersbn-postgresql:17 ``` The above command will create a database named `gitlabhq_production` and also create a user named `gitlab` with the password `password` with access to the `gitlabhq_production` database. @@ -2843,6 +2841,7 @@ Usage when using `docker-compose` can also be found there. > - As of version 16.0.0, the required PostgreSQL version is 13.x. > - As of version 17.0.0, the required PostgreSQL version is 14.x. > - As of version 18.0.0, the required PostgreSQL version is 16.x. +> - As of version 19.0.0, the required PostgreSQL version is 17.x. > > If you're using PostgreSQL image other than the above, please review section [Upgrading PostgreSQL](#upgrading-postgresql). diff --git a/contrib/docker-swarm/docker-compose.yml b/contrib/docker-swarm/docker-compose.yml index 700917342..1d1a5931c 100644 --- a/contrib/docker-swarm/docker-compose.yml +++ b/contrib/docker-swarm/docker-compose.yml @@ -9,7 +9,7 @@ services: postgresql: restart: always - image: kkimurak/sameersbn-postgresql:16 + image: kkimurak/sameersbn-postgresql:17 volumes: - /srv/docker/gitlab/postgresql:/var/lib/postgresql:Z environment: diff --git a/docker-compose.swarm.yml b/docker-compose.swarm.yml index 6467b958c..b50ab633f 100644 --- a/docker-compose.swarm.yml +++ b/docker-compose.swarm.yml @@ -11,7 +11,7 @@ services: - node.labels.gitlab.redis-data == true postgresql: - image: kkimurak/sameersbn-postgresql:16 + image: kkimurak/sameersbn-postgresql:17 volumes: - postgresql-data:/var/lib/postgresql:Z environment: diff --git a/docker-compose.yml b/docker-compose.yml index b46ef8f2a..430ce2bab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: postgresql: restart: always - image: kkimurak/sameersbn-postgresql:16 + image: kkimurak/sameersbn-postgresql:17 volumes: - postgresql-data:/var/lib/postgresql:Z environment: diff --git a/docs/docker-compose-keycloak.yml b/docs/docker-compose-keycloak.yml index 31cf5cc39..8ebae1a75 100644 --- a/docs/docker-compose-keycloak.yml +++ b/docs/docker-compose-keycloak.yml @@ -9,7 +9,7 @@ services: postgresql: restart: always - image: kkimurak/sameersbn-postgresql:16 + image: kkimurak/sameersbn-postgresql:17 volumes: - postgresql-data:/var/lib/postgresql:Z environment: diff --git a/docs/docker-compose-registry.yml b/docs/docker-compose-registry.yml index 1563ac091..5edf3dde4 100644 --- a/docs/docker-compose-registry.yml +++ b/docs/docker-compose-registry.yml @@ -9,7 +9,7 @@ services: postgresql: restart: always - image: kkimurak/sameersbn-postgresql:16 + image: kkimurak/sameersbn-postgresql:17 volumes: - postgresql:/var/lib/postgresql:Z environment: diff --git a/docs/s3_compatible_storage.md b/docs/s3_compatible_storage.md index 6e5ba10af..b793f2820 100644 --- a/docs/s3_compatible_storage.md +++ b/docs/s3_compatible_storage.md @@ -76,7 +76,7 @@ services: postgresql: restart: always - image: sameersbn/postgresql:10-2 + image: kkimurak/sameersbn-postgresql:17 volumes: - /tmp/docker/gitlab/postgresql:/var/lib/postgresql:Z environment: diff --git a/kubernetes/postgresql-rc.yml b/kubernetes/postgresql-rc.yml index e6c4adbb3..76ede9241 100644 --- a/kubernetes/postgresql-rc.yml +++ b/kubernetes/postgresql-rc.yml @@ -14,7 +14,7 @@ spec: spec: containers: - name: postgresql - image: kkimurak/sameersbn-postgresql:16 + image: kkimurak/sameersbn-postgresql:17 env: - name: DB_USER value: gitlab From 8e94999799f7ffa070452ec0c70445d1eeddf969 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Wed, 27 May 2026 13:17:19 +0200 Subject: [PATCH 10/11] Remove leading zero in DB_SERVER_VERSION Apply suggestion from @kkimurak. Co-authored-by: KIMURA Kazunori <33391846+kkimurak@users.noreply.github.com> --- assets/runtime/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/runtime/functions b/assets/runtime/functions index ca78dc33e..a5adbf641 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -191,7 +191,7 @@ gitlab_generate_postgresqlrc() { echo "- Detected server version: ${DB_SERVER_VERSION}" # remove leading zero (prior to 10.x it was like "090605" so that cannot treated as number) - DB_SERVER_VERSION="${DB_SERVER_VERSION##+(0)}" + DB_SERVER_VERSION="${DB_SERVER_VERSION#0}" # Anyway, we can get major version (8, 9, 10 and so on) by dividing by 10000. # DB_SERVER_VERSION_MAJOR=${DB_SERVER_VERSION%%.*} From d5ec98fd94a444623975c4f1adaaace3cf78ec13 Mon Sep 17 00:00:00 2001 From: Steven Achilles Date: Wed, 27 May 2026 13:20:19 +0200 Subject: [PATCH 11/11] Update comment related to GitLab and PostgreSQL versions --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e27e99163..15a2245e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ENV GITLAB_VERSION=${VERSION} \ RAILS_ENV=production \ NODE_ENV=production \ NO_SOURCEMAPS=true \ - # v19.0.0 : minimum = 17.0, maximum = 17.x (currently 17.10, is 170010) + # v19.x : minimum = 17.0, maximum = 17.x (currently 17.10, is 170010) POSTGRESQL_SERVER_REQUIRED_VERSION_MINIMUM=170000 \ POSTGRESQL_SERVER_TESTED_VERSION_MAXIMUM=170010