From bc1383a622105dd17463164f5aa83e985911a7e6 Mon Sep 17 00:00:00 2001 From: Leonardo Mosquera Date: Fri, 25 Aug 2023 15:30:28 -0300 Subject: [PATCH] Install latest Postgres client version besides the one for PG_MAJOR (#729) Before, if a remote server is upgraded to a newer PG version, it wouldn't be able to be backed up from inside the application, since `pg_dump` would be a lower version, resulting in this: ``` pg_dump: error: server version: 15.3; pg_dump version: 13.11 (Debian 13.11-1.pgdg110+1) pg_dump: error: aborting because of server version mismatch ``` With this change, `postgresql-${PG_MAJOR}` pulls in `postgresql-client` for the server version, AND `postgresql-client` metapackage pulls in the latest version available in the upstream Apt repository. This guarantees there will be a `pg_dump` for the latest version available, so a remote server freshly upgraded to that latest version will always be able to be backed up from inside the application (since [`pg_wrapper`](https://github.com/credativ/postgresql-common/blob/master/pg_wrapper#L110) chooses the latest locally available version for remote connections). * Bump Postgres client version ahead of Postgres server version bump * Fall back to PG_MAJOR if client env var is undefined * Use postgresql-client metapackage instead for latest client version --- image/base/slim.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/base/slim.Dockerfile b/image/base/slim.Dockerfile index 3a04a1f..05e112d 100644 --- a/image/base/slim.Dockerfile +++ b/image/base/slim.Dockerfile @@ -40,7 +40,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install autoconf build-essential c libssl-dev libyaml-dev libtool \ libpcre3 libpcre3-dev zlib1g zlib1g-dev \ libxml2-dev gawk parallel \ - postgresql-${PG_MAJOR} postgresql-client-${PG_MAJOR} \ + postgresql-${PG_MAJOR} postgresql-client \ postgresql-contrib-${PG_MAJOR} libpq-dev postgresql-${PG_MAJOR}-pgvector \ libreadline-dev anacron wget \ psmisc whois brotli libunwind-dev \ -- 2.25.1