From bfc3d54e8b18e371725b1fb655c1189172c4fd14 Mon Sep 17 00:00:00 2001 From: Ida Novindasari Date: Mon, 11 Nov 2024 16:42:59 +0100 Subject: [PATCH] Only install the latest compatible version of timescaledb (#1046) Co-authored-by: Polina Bungina <27892524+hughcapet@users.noreply.github.com> --- postgres-appliance/Dockerfile | 2 ++ postgres-appliance/build_scripts/base.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/postgres-appliance/Dockerfile b/postgres-appliance/Dockerfile index db702eec..ab19aa9e 100644 --- a/postgres-appliance/Dockerfile +++ b/postgres-appliance/Dockerfile @@ -1,5 +1,6 @@ ARG BASE_IMAGE=ubuntu:22.04 ARG PGVERSION=17 +ARG TIMESCALEDB="2.15.3 2.17.2" ARG DEMO=false ARG COMPRESS=false ARG ADDITIONAL_LOCALES= @@ -43,6 +44,7 @@ COPY build_scripts/base.sh /builddeps/ COPY --from=dependencies-builder /builddeps/*.deb /builddeps/ ARG PGVERSION +ARG TIMESCALEDB ARG TIMESCALEDB_APACHE_ONLY=true ARG TIMESCALEDB_TOOLKIT=true ARG COMPRESS diff --git a/postgres-appliance/build_scripts/base.sh b/postgres-appliance/build_scripts/base.sh index 201b0776..b7d10192 100644 --- a/postgres-appliance/build_scripts/base.sh +++ b/postgres-appliance/build_scripts/base.sh @@ -124,6 +124,19 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do "postgresql-${version}-pg-stat-kcache" \ "${EXTRAS[@]}" + # Clean up timescaledb versions except the highest compatible version + exclude_patterns=() + exclude_patterns_tsl=() + for ts_version in ${TIMESCALEDB}; do + exclude_patterns+=(! -name timescaledb-"${ts_version}".so) + exclude_patterns_tsl+=(! -name timescaledb-tsl-"${ts_version}".so) + done + find /usr/lib/postgresql/"${version}"/lib/ -name 'timescaledb-2.*.so' "${exclude_patterns[@]}" -delete; + + if [ "${TIMESCALEDB_APACHE_ONLY}" != "true" ]; then + find /usr/lib/postgresql/"${version}"/lib/ -name 'timescaledb-tsl-2.*.so' "${exclude_patterns_tsl[@]}" -delete; + fi + # Install 3rd party stuff if [ "${TIMESCALEDB_APACHE_ONLY}" != "true" ] && [ "${TIMESCALEDB_TOOLKIT}" = "true" ]; then