From b140a1a22d707e6c006d66970078fd7d8fc63a3e Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Wed, 18 Dec 2024 13:18:44 -0500 Subject: [PATCH] Upgrade 2 extensions, refactor others (#859) Update these extensions for Postgres 17: * pg_html5_email_address * redis_fdw * Upgrade these extensions: * pg_html5_email_address v1.2.3 * pg_jsonschema v0.3.3 Refactor build scripting for these extensions: * aggs_for_vecs * chkpass * pg_analytics * pg_cron * pg_graphql * pg_html5_email_address * pg_search * redis_fdw Add configuration for pg_jsonschema, which was previously published manually. --- contrib/aggs_for_vecs/Dockerfile | 18 ++++-------- contrib/aggs_for_vecs/Trunk.toml | 7 +---- contrib/chkpass/Dockerfile | 14 +++++---- contrib/chkpass/Trunk.toml | 7 +---- contrib/pg_analytics/Dockerfile | 2 +- contrib/pg_cron/Dockerfile | 15 ++++------ contrib/pg_cron/Trunk.toml | 2 +- contrib/pg_graphql/Dockerfile | 26 +++++++---------- contrib/pg_graphql/Trunk.toml | 12 +++----- contrib/pg_html5_email_address/Dockerfile | 20 ++++++------- contrib/pg_html5_email_address/Trunk.toml | 11 ++----- contrib/pg_jsonschema/Dockerfile | 14 +++++++++ contrib/pg_jsonschema/Trunk.toml | 18 ++++++++++++ contrib/pg_search/Dockerfile | 35 ++++++++--------------- contrib/pg_search/Trunk.toml | 6 +--- contrib/redis_fdw/Dockerfile | 27 +++++++---------- contrib/redis_fdw/Trunk.toml | 9 ++---- 17 files changed, 107 insertions(+), 136 deletions(-) create mode 100644 contrib/pg_jsonschema/Dockerfile create mode 100644 contrib/pg_jsonschema/Trunk.toml diff --git a/contrib/aggs_for_vecs/Dockerfile b/contrib/aggs_for_vecs/Dockerfile index 80f50d1a..c5171c0b 100644 --- a/contrib/aggs_for_vecs/Dockerfile +++ b/contrib/aggs_for_vecs/Dockerfile @@ -1,15 +1,9 @@ # Set PostgreSQL version -ARG PG_VERSION=17 +ARG PG_VERSION FROM quay.io/coredb/c-builder:pg${PG_VERSION} -# Clone repository -RUN git clone https://github.com/pjungwir/aggs_for_vecs.git - -# Set project version -ARG RELEASE=v1.3.2 - -# Build extension -RUN cd aggs_for_vecs && \ - git fetch origin ${RELEASE} && \ - git checkout ${RELEASE} && \ - make +# Clone and build the extension. +ARG EXTENSION_NAME +ARG EXTENSION_VERSION +RUN git clone --depth 1 --branch "v${EXTENSION_VERSION}" https://github.com/pjungwir/${EXTENSION_NAME}.git \ + && make -C ${EXTENSION_NAME} diff --git a/contrib/aggs_for_vecs/Trunk.toml b/contrib/aggs_for_vecs/Trunk.toml index 8b717535..fe9a4f82 100644 --- a/contrib/aggs_for_vecs/Trunk.toml +++ b/contrib/aggs_for_vecs/Trunk.toml @@ -14,9 +14,4 @@ apt = ["libc6"] postgres_version = "17" platform = "linux/amd64" dockerfile = "Dockerfile" -install_command = """ - cd aggs_for_vecs && make install - set -x - mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension - mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib - """ +install_command = "make -C aggs_for_vecs install" diff --git a/contrib/chkpass/Dockerfile b/contrib/chkpass/Dockerfile index 98885f7e..83e83dd4 100644 --- a/contrib/chkpass/Dockerfile +++ b/contrib/chkpass/Dockerfile @@ -1,8 +1,10 @@ -ARG PG_VERSION=17 +ARG PG_VERSION FROM quay.io/coredb/c-builder:pg${PG_VERSION} -# Clone repository -RUN git clone https://github.com/lacanoid/chkpass.git - -RUN cd chkpass && \ - make +ARG EXTENSION_NAME +# ARG EXTENSION_VERSION +ARG RELEASE=87159fd +RUN git clone https://github.com/lacanoid/${EXTENSION_NAME}.git \ + && cd ${EXTENSION_NAME} \ + && git checkout ${RELEASE} \ + && make diff --git a/contrib/chkpass/Trunk.toml b/contrib/chkpass/Trunk.toml index 305b1314..9a2211a7 100644 --- a/contrib/chkpass/Trunk.toml +++ b/contrib/chkpass/Trunk.toml @@ -14,9 +14,4 @@ apt = ["libcrypt1", "libc6"] postgres_version = "17" platform = "linux/amd64" dockerfile = "Dockerfile" -install_command = """ - cd chkpass && make install - set -x - mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension - mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib - """ +install_command = "make -C chkpass install" diff --git a/contrib/pg_analytics/Dockerfile b/contrib/pg_analytics/Dockerfile index e6a2d9e2..d79b8fac 100644 --- a/contrib/pg_analytics/Dockerfile +++ b/contrib/pg_analytics/Dockerfile @@ -1,4 +1,4 @@ -ARG PG_VERSION=17 +ARG PG_VERSION FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.12.7 USER root diff --git a/contrib/pg_cron/Dockerfile b/contrib/pg_cron/Dockerfile index 199ff769..c4c6a125 100644 --- a/contrib/pg_cron/Dockerfile +++ b/contrib/pg_cron/Dockerfile @@ -1,11 +1,8 @@ -ARG PG_VERSION=17 +ARG PG_VERSION FROM quay.io/coredb/c-builder:pg${PG_VERSION} -ARG EXTENSION_VERSION=1.6.4 -# Clone repository -RUN git clone https://github.com/citusdata/pg_cron.git - -RUN cd pg_cron && \ - git fetch origin v${EXTENSION_VERSION} && \ - git checkout v${EXTENSION_VERSION} && \ - make +# Clone and build the extension. +ARG EXTENSION_NAME +ARG EXTENSION_VERSION +RUN git clone --depth 1 --branch "v${EXTENSION_VERSION}" https://github.com/citusdata/${EXTENSION_NAME}.git \ + && make -C ${EXTENSION_NAME} diff --git a/contrib/pg_cron/Trunk.toml b/contrib/pg_cron/Trunk.toml index aaabff3e..87885228 100644 --- a/contrib/pg_cron/Trunk.toml +++ b/contrib/pg_cron/Trunk.toml @@ -15,4 +15,4 @@ apt = ["libpq5", "libc6"] postgres_version = "17" platform = "linux/amd64" dockerfile = "Dockerfile" -install_command = "cd pg_cron && make install" +install_command = "make -C pg_cron install" diff --git a/contrib/pg_graphql/Dockerfile b/contrib/pg_graphql/Dockerfile index f1edb371..6154c688 100644 --- a/contrib/pg_graphql/Dockerfile +++ b/contrib/pg_graphql/Dockerfile @@ -1,10 +1,7 @@ -ARG PG_VERSION=17 - +ARG PG_VERSION FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.12.6 -USER root -ARG PG_VERSION=17 -ARG RELEASE=v1.5.9 +USER root RUN apt-get update && apt-get install -y \ # extension build dependencies build-essential \ @@ -13,16 +10,15 @@ RUN apt-get update && apt-get install -y \ git \ libpq-dev \ libreadline6-dev \ - zlib1g-dev \ - # Install Rust - && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ - # Set default Rust version + zlib1g-dev + +ARG PG_VERSION +ARG EXTENSION_NAME +ARG EXTENSION_VERSION + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ && /root/.cargo/bin/rustup default stable \ - # Download the source - && git clone https://github.com/supabase/pg_graphql.git \ - && cd pg_graphql \ - && git fetch origin ${RELEASE} \ - && git checkout ${RELEASE} \ - # Build the extension + && git clone --depth 1 --branch v${EXTENSION_VERSION} https://github.com/supabase/${EXTENSION_NAME}.git \ + && cd ${EXTENSION_NAME} \ && cargo pgrx init --pg${PG_VERSION}=/usr/bin/pg_config \ && cargo pgrx package diff --git a/contrib/pg_graphql/Trunk.toml b/contrib/pg_graphql/Trunk.toml index 548e6ea6..498ed859 100644 --- a/contrib/pg_graphql/Trunk.toml +++ b/contrib/pg_graphql/Trunk.toml @@ -8,15 +8,11 @@ homepage = "https://supabase.com" documentation = "https://supabase.github.io/pg_graphql" categories = ["data_transformations"] +[dependencies] +apt = ["libc6"] + [build] postgres_version = "17" platform = "linux/amd64" dockerfile = "Dockerfile" -install_command = """ - cd pg_graphql - mv target/release/pg_graphql-pg17/usr/lib/postgresql/15/lib/* /usr/lib/postgresql/15/lib - mv target/release/pg_graphql-pg17/usr/share/postgresql/15/extension/* /usr/share/postgresql/15/extension -""" - -[dependencies] -apt = ["libc6"] +install_command = "cd pg_graphql && cargo pgrx install --release" diff --git a/contrib/pg_html5_email_address/Dockerfile b/contrib/pg_html5_email_address/Dockerfile index 5110ce93..71c912b5 100644 --- a/contrib/pg_html5_email_address/Dockerfile +++ b/contrib/pg_html5_email_address/Dockerfile @@ -1,16 +1,12 @@ # Set PostgreSQL version -ARG PG_VERSION=15 +ARG PG_VERSION FROM quay.io/coredb/c-builder:pg${PG_VERSION} -USER root -# Clone repository -RUN git clone https://github.com/bigsmoke/pg_html5_email_address.git - -ARG RELEASE=v1.2.2 - -# Build extension -RUN cd pg_html5_email_address && \ - git fetch origin ${RELEASE} && \ - git checkout ${RELEASE} && \ - make +ARG EXTENSION_NAME +ARG EXTENSION_VERSION +# Extension build dependencies +RUN curl -O https://api.pgxn.org/dist/${EXTENSION_NAME}/${EXTENSION_VERSION}/${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \ + && unzip ${EXTENSION_NAME}-${EXTENSION_VERSION}.zip \ + && cd ${EXTENSION_NAME}-${EXTENSION_VERSION} && make +WORKDIR /app/${EXTENSION_NAME}-${EXTENSION_VERSION} diff --git a/contrib/pg_html5_email_address/Trunk.toml b/contrib/pg_html5_email_address/Trunk.toml index 5827b181..2240eb34 100644 --- a/contrib/pg_html5_email_address/Trunk.toml +++ b/contrib/pg_html5_email_address/Trunk.toml @@ -1,18 +1,13 @@ [extension] name = "pg_html5_email_address" -version = "1.2.2" +version = "1.2.3" repository = "https://github.com/bigsmoke/pg_html5_email_address" license = "PostgreSQL" description = "PostgreSQL email validation that is consistent with the HTML5 spec." categories = ["data_transformations"] [build] -postgres_version = "15" +postgres_version = "17" platform = "linux/amd64" dockerfile = "Dockerfile" -install_command = """ - cd pg_html5_email_address && make install - set -x - mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension - mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib - """ +install_command = "make install" diff --git a/contrib/pg_jsonschema/Dockerfile b/contrib/pg_jsonschema/Dockerfile new file mode 100644 index 00000000..c8325232 --- /dev/null +++ b/contrib/pg_jsonschema/Dockerfile @@ -0,0 +1,14 @@ +ARG PG_VERSION +FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.12.6 + +ARG PG_VERSION +ARG EXTENSION_NAME +ARG EXTENSION_VERSION + +USER root +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + && /root/.cargo/bin/rustup default stable \ + && git clone --depth 1 --branch v${EXTENSION_VERSION} https://github.com/supabase/${EXTENSION_NAME}.git \ + && cd ${EXTENSION_NAME} \ + && cargo pgrx init --pg${PG_VERSION}=/usr/bin/pg_config \ + && cargo pgrx package diff --git a/contrib/pg_jsonschema/Trunk.toml b/contrib/pg_jsonschema/Trunk.toml new file mode 100644 index 00000000..a58f3c16 --- /dev/null +++ b/contrib/pg_jsonschema/Trunk.toml @@ -0,0 +1,18 @@ +[extension] +name = "pg_jsonschema" +version = "0.3.3" +repository = "https://github.com/supabase/pg_jsonschema" +license = "Apache-2.0" +description = "PostgreSQL extension providing JSON Schema validation." +homepage = "https://github.com/supabase/pg_jsonschema" +documentation = "https://github.com/supabase/pg_jsonschema/blob/master/README.md" +categories = ["data_transformations"] + +[dependencies] +apt = ["libc6"] + +[build] +postgres_version = "17" +platform = "linux/amd64" +dockerfile = "Dockerfile" +install_command = "cd pg_jsonschema && cargo pgrx install --release" diff --git a/contrib/pg_search/Dockerfile b/contrib/pg_search/Dockerfile index 18510855..40e822e1 100644 --- a/contrib/pg_search/Dockerfile +++ b/contrib/pg_search/Dockerfile @@ -1,29 +1,18 @@ -ARG PG_VERSION=17 +ARG PG_VERSION FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.12.5 -USER root # Extension build dependencies -RUN apt-get update && apt-get install -y \ - build-essential - -# Install Rust -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - -# Set default Rust version -RUN /root/.cargo/bin/rustup default 1.82.0-x86_64-unknown-linux-gnu -ARG PG_VERSION=17 +USER root +RUN apt-get update && apt-get install -y build-essential -# argument passed in during build and defined in Trunk.toml +ARG PG_VERSION +ARG EXTENSION_NAME ARG EXTENSION_VERSION -# Clone repository -RUN git clone https://github.com/paradedb/paradedb.git && \ - cd paradedb && \ - git fetch --tags && \ - git fetch --depth 1 origin tag v${EXTENSION_VERSION} && \ - git checkout v${EXTENSION_VERSION} - -# Build the extension -RUN cd paradedb/pg_search && \ - cargo pgrx init --pg${PG_VERSION} /usr/bin/pg_config && \ - cargo pgrx package --features icu +# Install Rust and build the extension. +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + && /root/.cargo/bin/rustup default stable \ + && git clone --depth 1 --branch v${EXTENSION_VERSION} https://github.com/paradedb/paradedb.git \ + && cd paradedb/${EXTENSION_NAME} \ + && cargo pgrx init --pg${PG_VERSION}=/usr/bin/pg_config \ + && cargo pgrx package --features icu diff --git a/contrib/pg_search/Trunk.toml b/contrib/pg_search/Trunk.toml index 9b2f31a4..906aec4f 100644 --- a/contrib/pg_search/Trunk.toml +++ b/contrib/pg_search/Trunk.toml @@ -16,8 +16,4 @@ apt = ["libc6"] postgres_version = "17" platform = "linux/amd64" dockerfile = "Dockerfile" -install_command = """ - cd paradedb/ - mv target/release/pg_search-pg17/usr/lib/postgresql/15/lib/* /usr/lib/postgresql/15/lib - mv target/release/pg_search-pg17/usr/share/postgresql/15/extension/* /usr/share/postgresql/15/extension -""" +install_command = "cd paradedb/pg_search && cargo pgrx install --release --features icu" diff --git a/contrib/redis_fdw/Dockerfile b/contrib/redis_fdw/Dockerfile index 6cc9fc5d..089742b8 100644 --- a/contrib/redis_fdw/Dockerfile +++ b/contrib/redis_fdw/Dockerfile @@ -1,21 +1,14 @@ # Set PostgreSQL version -ARG PG_VERSION=15 +ARG PG_VERSION FROM quay.io/coredb/c-builder:pg${PG_VERSION} -USER root # Extension build dependencies -RUN apt-get update && apt-get install -y \ - libhiredis-dev - -# Clone repository -RUN git clone https://github.com/pg-redis-fdw/redis_fdw.git - -ARG PG_VERSION=15 -# Set project version -ARG RELEASE=REL_${PG_VERSION}_STABLE - -# Build extension -RUN cd redis_fdw && \ - git fetch origin ${RELEASE} && \ - git checkout ${RELEASE} && \ - make +USER root +RUN apt-get update && apt-get install -y libhiredis-dev + +# Clone and build the extension. +ARG EXTENSION_NAME +ARG EXTENSION_VERSION +ARG PG_VERSION +RUN git clone --depth 1 --branch "REL_${PG_VERSION}_STABLE" https://github.com/pg-redis-fdw/${EXTENSION_NAME}.git \ + && make -C ${EXTENSION_NAME} diff --git a/contrib/redis_fdw/Trunk.toml b/contrib/redis_fdw/Trunk.toml index d31318ab..f146d177 100644 --- a/contrib/redis_fdw/Trunk.toml +++ b/contrib/redis_fdw/Trunk.toml @@ -11,12 +11,7 @@ categories = ["connectors"] apt = ["libc6", "libhiredis0.14"] [build] -postgres_version = "15" +postgres_version = "17" platform = "linux/amd64" dockerfile = "Dockerfile" -install_command = """ - cd redis_fdw && make install - set -x - mv /usr/local/pgsql/share/extension/* /usr/share/postgresql/15/extension - mv /usr/local/pgsql/lib/* /usr/lib/postgresql/15/lib - """ +install_command = "make -C redis_fdw install"