From d07ca8c832442cc24a87326cdfb1ccc14f73599b Mon Sep 17 00:00:00 2001 From: Ida Novindasari Date: Tue, 5 Nov 2024 17:05:15 +0100 Subject: [PATCH] Moving timescaledb to pkg instead of building (#1036) --- delivery.yaml | 1 - postgres-appliance/Dockerfile | 4 --- postgres-appliance/build_scripts/base.sh | 31 ++++----------------- postgres-appliance/build_scripts/prepare.sh | 4 +++ 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/delivery.yaml b/delivery.yaml index 286fe4e20..4c21d3d82 100644 --- a/delivery.yaml +++ b/delivery.yaml @@ -31,7 +31,6 @@ pipeline: --build-arg PGVERSION="$PGVERSION" \ --build-arg BASE_IMAGE="$BASE_IMAGE" \ --build-arg PGOLDVERSIONS="14 15 16" \ - --build-arg TIMESCALEDB="2.17.0" \ -t "$ECR_TEST_IMAGE" \ --push . cdp-promote-image "$ECR_TEST_IMAGE" diff --git a/postgres-appliance/Dockerfile b/postgres-appliance/Dockerfile index c2ca9338f..db702eec3 100644 --- a/postgres-appliance/Dockerfile +++ b/postgres-appliance/Dockerfile @@ -1,6 +1,5 @@ ARG BASE_IMAGE=ubuntu:22.04 ARG PGVERSION=17 -ARG TIMESCALEDB="2.15.3 2.17.0" ARG DEMO=false ARG COMPRESS=false ARG ADDITIONAL_LOCALES= @@ -44,7 +43,6 @@ 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 @@ -92,7 +90,6 @@ FROM builder-${COMPRESS} LABEL maintainer="Team ACID @ Zalando " ARG PGVERSION -ARG TIMESCALEDB ARG DEMO ARG COMPRESS @@ -102,7 +99,6 @@ ENV LC_ALL=en_US.utf-8 \ PATH=$PATH:/usr/lib/postgresql/$PGVERSION/bin \ PGHOME=/home/postgres \ RW_DIR=/run \ - TIMESCALEDB=$TIMESCALEDB \ DEMO=$DEMO ENV WALE_ENV_DIR=$RW_DIR/etc/wal-e.d/env \ diff --git a/postgres-appliance/build_scripts/base.sh b/postgres-appliance/build_scripts/base.sh index 9b6f28451..201b0776f 100644 --- a/postgres-appliance/build_scripts/base.sh +++ b/postgres-appliance/build_scripts/base.sh @@ -56,7 +56,6 @@ curl -sL "https://github.com/zalando-pg/pg_auth_mon/archive/$PG_AUTH_MON_COMMIT. curl -sL "https://github.com/cybertec-postgresql/pg_permissions/archive/$PG_PERMISSIONS_COMMIT.tar.gz" | tar xz curl -sL "https://github.com/zubkov-andrei/pg_profile/archive/$PG_PROFILE.tar.gz" | tar xz git clone -b "$SET_USER" https://github.com/pgaudit/set_user.git -git clone https://github.com/timescale/timescaledb.git apt-get install -y \ postgresql-common \ @@ -108,6 +107,12 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do fi + if [ "${TIMESCALEDB_APACHE_ONLY}" = "true" ]; then + EXTRAS+=("timescaledb-2-oss-postgresql-${version}") + else + EXTRAS+=("timescaledb-2-postgresql-${version}") + fi + # Install PostgreSQL binaries, contrib, plproxy and multiple pl's apt-get install --allow-downgrades -y \ "postgresql-${version}-cron" \ @@ -121,37 +126,13 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do # Install 3rd party stuff - # use subshell to avoid having to cd back (SC2103) - ( - cd timescaledb - for v in $TIMESCALEDB; do - git checkout "$v" - sed -i "s/VERSION 3.11/VERSION 3.10/" CMakeLists.txt - if BUILD_FORCE_REMOVE=true ./bootstrap -DREGRESS_CHECKS=OFF -DWARNINGS_AS_ERRORS=OFF \ - -DTAP_CHECKS=OFF -DPG_CONFIG="/usr/lib/postgresql/$version/bin/pg_config" \ - -DAPACHE_ONLY="$TIMESCALEDB_APACHE_ONLY" -DSEND_TELEMETRY_DEFAULT=NO; then - make -C build install - strip /usr/lib/postgresql/"$version"/lib/timescaledb*.so - fi - git reset --hard - git clean -f -d - done - ) - if [ "${TIMESCALEDB_APACHE_ONLY}" != "true" ] && [ "${TIMESCALEDB_TOOLKIT}" = "true" ]; then - __versionCodename=$(sed /usr/share/keyrings/timescale_E7391C94080429FF.gpg - apt-get update if [ "$(apt-cache search --names-only "^timescaledb-toolkit-postgresql-${version}$" | wc -l)" -eq 1 ]; then apt-get install "timescaledb-toolkit-postgresql-$version" else echo "Skipping timescaledb-toolkit-postgresql-$version as it's not found in the repository" fi - - rm /etc/apt/sources.list.d/timescaledb.list - rm /usr/share/keyrings/timescale_E7391C94080429FF.gpg fi EXTRA_EXTENSIONS=() diff --git a/postgres-appliance/build_scripts/prepare.sh b/postgres-appliance/build_scripts/prepare.sh index 50f32db86..66c2a2cb8 100644 --- a/postgres-appliance/build_scripts/prepare.sh +++ b/postgres-appliance/build_scripts/prepare.sh @@ -40,6 +40,10 @@ for t in deb deb-src; do done curl -s -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg +# add TimescaleDB repository +echo "deb [signed-by=/etc/apt/keyrings/timescale_timescaledb-archive-keyring.gpg] https://packagecloud.io/timescale/timescaledb/ubuntu/ ${DISTRIB_CODENAME} main" | tee /etc/apt/sources.list.d/timescaledb.list +curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor | tee /etc/apt/keyrings/timescale_timescaledb-archive-keyring.gpg > /dev/null + # Clean up apt-get purge -y libcap2-bin apt-get autoremove -y