Skip to content

Commit

Permalink
Moving timescaledb to pkg instead of building (#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
idanovinda authored Nov 5, 2024
1 parent 07bbb08 commit d07ca8c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 30 deletions.
1 change: 0 additions & 1 deletion delivery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 0 additions & 4 deletions postgres-appliance/Dockerfile
Original file line number Diff line number Diff line change
@@ -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=
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -92,7 +90,6 @@ FROM builder-${COMPRESS}
LABEL maintainer="Team ACID @ Zalando <[email protected]>"

ARG PGVERSION
ARG TIMESCALEDB
ARG DEMO
ARG COMPRESS

Expand All @@ -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 \
Expand Down
31 changes: 6 additions & 25 deletions postgres-appliance/build_scripts/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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" \
Expand All @@ -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 </etc/os-release -ne 's/^VERSION_CODENAME=//p')
echo "deb [signed-by=/usr/share/keyrings/timescale_E7391C94080429FF.gpg] https://packagecloud.io/timescale/timescaledb/ubuntu/ ${__versionCodename} main" | tee /etc/apt/sources.list.d/timescaledb.list
curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor > /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=()
Expand Down
4 changes: 4 additions & 0 deletions postgres-appliance/build_scripts/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d07ca8c

Please sign in to comment.