Skip to content

Commit

Permalink
Adjust extensions build/installation process for pg16 (#945)
Browse files Browse the repository at this point in the history
* Build plprofiler from source
* More extensions support pg16: plprofiler, pgl-ddl-deploy
* Small refactoring, as we don't include pg10 anymore: always
  install/build decoderbufs, pgvector, pg_mon; never install
  amcheck (it is in contrib); no need in $POSTGIS_SUPER_LEGACY.
* Remove pg_tm_aux, plantuner
* Pllua was accidentally not installed for pg15
  • Loading branch information
hughcapet authored Nov 13, 2023
1 parent 44aff30 commit d170d49
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 44 deletions.
9 changes: 3 additions & 6 deletions postgres-appliance/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN bash /builddeps/prepare.sh

COPY --from=ubuntu-18 /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.18

COPY cron_unprivileged.c dependencies/src /builddeps/
COPY cron_unprivileged.c /builddeps/
COPY build_scripts/base.sh /builddeps/
COPY --from=dependencies-builder /builddeps/*.deb /builddeps/

Expand All @@ -56,17 +56,14 @@ ARG DEB_PG_SUPPORTED_VERSIONS="$PGOLDVERSIONS $PGVERSION"
# Install PostgreSQL, extensions and contribs
ENV POSTGIS_VERSION=3.4 \
POSTGIS_LEGACY=3.3 \
POSTGIS_SUPER_LEGACY=3.2 \
BG_MON_COMMIT=5959310104a11cb3f363bd65f3a4ef01119ca6d6 \
PG_AUTH_MON_COMMIT=3d010e5959285c32b155e8064c9c9b57869aeca7 \
PG_MON_COMMIT=382304bd6fa4804b2bea26c9bd9d420b3a998747 \
SET_USER=REL4_0_1 \
PLPROFILER=fix/pg15-shmem \
PLPROFILER=REL4_2_4 \
PG_PROFILE=4.2 \
PAM_OAUTH2=v1.0.1 \
PLANTUNER_COMMIT=800d81bc85da64ff3ef66e12aed1d4e1e54fc006 \
PG_PERMISSIONS_COMMIT=314b9359e3d77c0b2ef7dbbde97fa4be80e31925 \
PG_TM_AUX_COMMIT=51cf42f6043608919802fcc48458471d0ea3a127
PG_PERMISSIONS_COMMIT=314b9359e3d77c0b2ef7dbbde97fa4be80e31925

WORKDIR /builddeps
RUN bash base.sh
Expand Down
49 changes: 11 additions & 38 deletions postgres-appliance/build_scripts/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ else
make -C pam-oauth2 install

# prepare 3rd sources
git clone -b "$PLPROFILER" https://github.com/hughcapet/plprofiler.git
tar -xzf "plantuner-${PLANTUNER_COMMIT}.tar.gz"
git clone -b "$PLPROFILER" https://github.com/bigsql/plprofiler.git
curl -sL "https://github.com/zalando-pg/pg_mon/archive/$PG_MON_COMMIT.tar.gz" | tar xz

for p in python3-keyring python3-docutils ieee-data; do
Expand All @@ -55,7 +54,6 @@ fi
curl -sL "https://github.com/zalando-pg/bg_mon/archive/$BG_MON_COMMIT.tar.gz" | tar xz
curl -sL "https://github.com/zalando-pg/pg_auth_mon/archive/$PG_AUTH_MON_COMMIT.tar.gz" | tar xz
curl -sL "https://github.com/cybertec-postgresql/pg_permissions/archive/$PG_PERMISSIONS_COMMIT.tar.gz" | tar xz
curl -sL "https://github.com/hughcapet/pg_tm_aux/archive/$PG_TM_AUX_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
Expand Down Expand Up @@ -91,36 +89,20 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do
"postgresql-${version}-pglogical-ticker"
"postgresql-${version}-plpgsql-check"
"postgresql-${version}-pg-checksums"
"postgresql-${version}-pgl-ddl-deploy"
"postgresql-${version}-pgq-node"
"postgresql-${version}-postgis-${POSTGIS_VERSION%.*}"
"postgresql-${version}-postgis-${POSTGIS_VERSION%.*}-scripts"
"postgresql-${version}-repack"
"postgresql-${version}-wal2json")

if [ "$version" != "16" ]; then
EXTRAS+=("postgresql-${version}-pgl-ddl-deploy")
fi

if [ "$version" != "15" ]; then
# not yet present for pg15
EXTRAS+=("postgresql-${version}-pllua")
fi
"postgresql-${version}-wal2json"
"postgresql-${version}-decoderbufs"
"postgresql-${version}-pllua"
"postgresql-${version}-pgvector")

if [ "$WITH_PERL" = "true" ]; then
EXTRAS+=("postgresql-plperl-${version}")
fi

if [ "${version%.*}" -ge 10 ]; then
EXTRAS+=("postgresql-${version}-decoderbufs")
fi

if [ "${version%.*}" -ge 11 ]; then
EXTRAS+=("postgresql-${version}-pgvector")
fi

if [ "${version%.*}" -lt 11 ]; then
EXTRAS+=("postgresql-${version}-amcheck")
fi
fi

# Install PostgreSQL binaries, contrib, plproxy and multiple pl's
Expand All @@ -139,7 +121,7 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do
# use subshell to avoid having to cd back (SC2103)
(
cd timescaledb
if [ "$version" != "16 " ]; then
if [ "$version" != "16" ]; then
for v in $TIMESCALEDB; do
git checkout "$v"
sed -i "s/VERSION 3.11/VERSION 3.10/" CMakeLists.txt
Expand Down Expand Up @@ -173,19 +155,15 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do

EXTRA_EXTENSIONS=()
if [ "$DEMO" != "true" ]; then
if [ "$version" != "16" ]; then
EXTRA_EXTENSIONS+=("plantuner-${PLANTUNER_COMMIT}" plprofiler "pg_tm_aux-${PG_TM_AUX_COMMIT}")
fi
if [ "${version%.*}" -ge 10 ]; then
EXTRA_EXTENSIONS+=("pg_mon-${PG_MON_COMMIT}")
fi
EXTRA_EXTENSIONS+=("plprofiler")
fi

for n in bg_mon-${BG_MON_COMMIT} \
pg_auth_mon-${PG_AUTH_MON_COMMIT} \
set_user \
pg_permissions-${PG_PERMISSIONS_COMMIT} \
pg_profile-${PG_PROFILE} \
pg_mon-${PG_MON_COMMIT} \
"${EXTRA_EXTENSIONS[@]}"; do
make -C "$n" USE_PGXS=1 clean install-strip
done
Expand Down Expand Up @@ -286,17 +264,12 @@ if [ "$DEMO" != "true" ]; then
if [ "$v1" = "$v2" ]; then
started=1
elif [ $started = 1 ]; then

used_postgis_version=$POSTGIS_VERSION
if [ "${v1##*/}" = "11" ]; then used_postgis_version=$POSTGIS_LEGACY; fi

for d1 in extension contrib contrib/postgis-$used_postgis_version; do
for d1 in extension contrib contrib/postgis-$POSTGIS_VERSION; do
cd "$v1/$d1"
d2="$d1"
d1="../../${v1##*/}/$d1"
if [ "${d2%-*}" = "contrib/postgis" ]; then
if [ "${v2##*/}" = "11" ]; then d2="${d2%-*}-$POSTGIS_LEGACY"
elif [ "${v2##*/}" = "10" ]; then d2="${d2%-*}-$POSTGIS_SUPER_LEGACY"; fi
if [ "${v2##*/}" = "11" ]; then d2="${d2%-*}-$POSTGIS_LEGACY"; fi
d1="../$d1"
fi
d2="$v2/$d2"
Expand Down
Binary file not shown.

0 comments on commit d170d49

Please sign in to comment.