Skip to content

Commit

Permalink
Initial commit for pg17
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcapet committed Aug 11, 2024
1 parent 5eca94d commit f3f40b1
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 93 deletions.
13 changes: 7 additions & 6 deletions postgres-appliance/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_IMAGE=ubuntu:22.04
ARG PGVERSION=16
ARG TIMESCALEDB="2.11.2 2.14.2"
ARG PGVERSION=17
ARG TIMESCALEDB="2.14.2"
ARG DEMO=false
ARG COMPRESS=false
ARG ADDITIONAL_LOCALES=
Expand Down Expand Up @@ -55,14 +55,15 @@ ARG DEB_PG_SUPPORTED_VERSIONS="$PGOLDVERSIONS $PGVERSION"

# Install PostgreSQL, extensions and contribs
ENV POSTGIS_VERSION=3.4 \
BG_MON_COMMIT=ef60961eff92672b1e21f5260dc1211367da6f1f \
PG_AUTH_MON_COMMIT=3d010e5959285c32b155e8064c9c9b57869aeca7 \
PG_MON_COMMIT=a6c5982368edd876edbee01e51b91e7387071e21 \
BG_MON_COMMIT=7f5887218790b263fe3f42f85f4ddc9c8400b154 \
PG_AUTH_MON_COMMIT=fe099eef7662cbc85b0b79191f47f52f1e96b779 \
PG_MON_COMMIT=ead1de70794ed62ca1e34d4022f6165ff36e9a91 \
SET_USER=REL4_0_1 \
SET_USER_COMMT=7f063e5d6e9e03847cf96c40b6ff62583ef457d5 \
PLPROFILER=REL4_2_4 \
PG_PROFILE=4.6 \
PAM_OAUTH2=v1.0.1 \
PG_PERMISSIONS_COMMIT=314b9359e3d77c0b2ef7dbbde97fa4be80e31925
PG_PERMISSIONS_COMMIT=f4b7c18676fa64236a1c8e28d34a35764e4a70e2

WORKDIR /builddeps
RUN bash base.sh
Expand Down
68 changes: 43 additions & 25 deletions postgres-appliance/build_scripts/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ curl -sL "https://github.com/zalando-pg/bg_mon/archive/$BG_MON_COMMIT.tar.gz" |
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/zubkov-andrei/pg_profile/archive/$PG_PROFILE.tar.gz" | tar xz
git clone -b "$SET_USER" https://github.com/pgaudit/set_user.git
curl -sL "https://github.com/pgaudit/set_user/archive/$SET_USER_COMMT.tar.gz" | tar xz
# git clone -b "$SET_USER" https://github.com/pgaudit/set_user.git # pg17 support is not released
git clone https://github.com/timescale/timescaledb.git

apt-get install -y \
Expand All @@ -82,22 +83,25 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do
"postgresql-${version}-hll"
"postgresql-${version}-hypopg"
"postgresql-${version}-plproxy"
"postgresql-${version}-partman"
"postgresql-${version}-pgaudit"
"postgresql-${version}-pldebugger"
"postgresql-${version}-pglogical"
"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"
"postgresql-${version}-decoderbufs"
"postgresql-${version}-pllua"
"postgresql-${version}-pgvector")

if [ "$version" != "17" ]; then
EXTRAS+=("postgresql-${version}-partman"
"postgresql-${version}-pglogical"
"postgresql-${version}-pglogical-ticker"
"postgresql-${version}-pg-checksums"
"postgresql-${version}-pgl-ddl-deploy"
"postgresql-${version}-postgis-${POSTGIS_VERSION%.*}"
"postgresql-${version}-postgis-${POSTGIS_VERSION%.*}-scripts"
"postgresql-${version}-repack"
"postgresql-${version}-decoderbufs")
fi

if [ "$WITH_PERL" = "true" ]; then
EXTRAS+=("postgresql-plperl-${version}")
Expand All @@ -113,26 +117,31 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do
"postgresql-plpython3-${version}" \
"postgresql-server-dev-${version}" \
"postgresql-${version}-pgq3" \
"postgresql-${version}-pg-stat-kcache" \
"${EXTRAS[@]}"

if [ "$version" != "17" ]; then
apt-get install --allow-downgrades -y "postgresql-${version}-pg-stat-kcache"
fi

# 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 [ "$version" != "17" ]; then
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
fi
)

if [ "${TIMESCALEDB_APACHE_ONLY}" != "true" ] && [ "${TIMESCALEDB_TOOLKIT}" = "true" ]; then
Expand All @@ -153,12 +162,15 @@ for version in $DEB_PG_SUPPORTED_VERSIONS; do

EXTRA_EXTENSIONS=()
if [ "$DEMO" != "true" ]; then
EXTRA_EXTENSIONS+=("plprofiler" "pg_mon-${PG_MON_COMMIT}")
EXTRA_EXTENSIONS+=("pg_mon-${PG_MON_COMMIT}")
if [ "$version" != "17" ]; then
EXTRA_EXTENSIONS+=("plprofiler")
fi
fi

for n in bg_mon-${BG_MON_COMMIT} \
pg_auth_mon-${PG_AUTH_MON_COMMIT} \
set_user \
set_user-${SET_USER_COMMT} \
pg_permissions-${PG_PERMISSIONS_COMMIT} \
pg_profile-${PG_PROFILE} \
"${EXTRA_EXTENSIONS[@]}"; do
Expand All @@ -177,6 +189,9 @@ done

if [ "$DEMO" != "true" ]; then
for version in $DEB_PG_SUPPORTED_VERSIONS; do
if [ "$version" = "17" ]; then
continue
fi
# create postgis symlinks to make it possible to perform update
ln -s "postgis-${POSTGIS_VERSION%.*}.so" "/usr/lib/postgresql/${version}/lib/postgis-2.5.so"
done
Expand Down Expand Up @@ -258,6 +273,9 @@ if [ "$DEMO" != "true" ]; then
# relink files with the same name and content across different major versions
started=0
for v2 in $(find /usr/share/postgresql -type d -mindepth 1 -maxdepth 1 | sort -Vr); do
if [ "${v2##*/}" = "17" ]; then
continue
fi
if [ "$v1" = "$v2" ]; then
started=1
elif [ $started = 1 ]; then
Expand Down
4 changes: 2 additions & 2 deletions postgres-appliance/scripts/spilo_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
# (min_version, max_version, shared_preload_libraries, extwlist.extensions)
extensions = {
'timescaledb': (9.6, 16, True, True),
'pg_cron': (9.5, 16, True, False),
'pg_cron': (9.5, 17, True, False),
'pg_stat_kcache': (9.4, 16, True, False),
'pg_partman': (9.4, 16, False, True)
}
if os.environ.get('ENABLE_PG_MON') == 'true':
extensions['pg_mon'] = (11, 16, True, False)
extensions['pg_mon'] = (11, 17, True, False)


def adjust_extensions(old, version, extwlist=False):
Expand Down
2 changes: 1 addition & 1 deletion postgres-appliance/tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ services:
postgresql:
parameters:
shared_buffers: 32MB
PGVERSION: '12'
PGVERSION: '13'
# Just to test upgrade with clone. Without CLONE_SCOPE they don't work
CLONE_WAL_S3_BUCKET: *bucket
CLONE_AWS_ACCESS_KEY_ID: *access_key
Expand Down
Loading

0 comments on commit f3f40b1

Please sign in to comment.