From a036964eb67fd66dbcacfc5a711722e15f26e285 Mon Sep 17 00:00:00 2001 From: Piyush Raj Date: Sun, 25 Feb 2024 19:05:28 +0530 Subject: [PATCH] add hypopg extension Signed-off-by: Piyush Raj --- .github/workflows/smoke-test.yml | 5 ++++ Dockerfile | 38 ++++++++++++++++++++++++- Makefile | 4 ++- README.md | 2 +- bitnami/Dockerfile | 49 ++++++++++++++++++++++++++++++++ bitnami/Makefile | 4 ++- 6 files changed, 98 insertions(+), 4 deletions(-) diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index bb2e6b19..023bd34a 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -65,6 +65,11 @@ jobs: psql -c "INSERT INTO test_geometry_table (geom) VALUES (ST_GeomFromText('POINT(0 0)', 4326));" psql -c "SELECT * FROM test_geometry_table;" + echo "Test HypoPG Extension" + psql -c "CREATE EXTENSION hypopg;" + psql -c "CREATE TABLE hypo AS SELECT id, 'line ' || id AS val FROM generate_series(1,10000) id;" + psql -c "EXPLAIN SELECT * FROM hypo WHERE id = 1;" + break fi sleep 1 diff --git a/Dockerfile b/Dockerfile index 0d37a6ca..c2da0297 100644 --- a/Dockerfile +++ b/Dockerfile @@ -200,4 +200,40 @@ RUN set -eux \ # clean && cd / \ && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ No newline at end of file + && apk del .fetch-deps .build-deps + + +# Adding hypo_pg +ARG HYPOPG_VERSION + +RUN set -ex \ + && cd /tmp\ + && apk add --no-cache --virtual .hypopg-deps \ + ca-certificates \ + openssl \ + tar \ + && apk add --no-cache --virtual .hypopg-build-deps \ + autoconf \ + automake \ + g++ \ + clang15 \ + llvm15 \ + libtool \ + libxml2-dev \ + make \ + perl \ + && wget -O hypopg.tar.gz "https://github.com/HypoPG/hypopg/archive/refs/tags/${HYPOPG_VERSION}.tar.gz" \ + && mkdir -p /tmp/hypopg \ + && tar \ + --extract \ + --file hypopg.tar.gz \ + --directory /tmp/hypopg \ + --strip-components 1 \ + && cd /tmp/hypopg \ + && make \ + && make install \ + # clean + && cd / \ + && rm /tmp/hypopg.tar.gz \ + && rm -rf /tmp/hypopg \ + && apk del .hypopg-deps .hypopg-build-deps diff --git a/Makefile b/Makefile index 67fbd6d2..a45a46ac 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-) TS_VERSION=2.13.0 PG_CRON_VERSION=v1.6.0 POSTGIS_VERSION=3.4.1 +HYPOPG_VERSION=1.4.0 PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!') PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)$(PREV_EXTRA)" PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "postgres:$(PG_VER_NUMBER)-alpine"; fi ) @@ -30,7 +31,8 @@ DOCKER_BUILD_ARGS = --build-arg TS_VERSION=$(TS_VERSION) \ --build-arg PG_VERSION=$(PG_VER_NUMBER) \ --build-arg PREV_IMAGE=$(PREV_IMAGE) \ --build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \ - --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) + --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \ + --build-arg HYPOPG_VERSION=$(HYPOPG_VERSION) default: image diff --git a/README.md b/README.md index ccebfbae..0362f1d2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - [x] [PgCron ](https://github.com/citusdata/pg_cron) - [x] [PostGIS](https://postgis.net) - [ ] [Citus](https://www.citusdata.com/) - +- [x] [HypoPG](https://github.com/HypoPG/hypopg) ## Releases - [Versioning Policy](./docs/version-policy.md) diff --git a/bitnami/Dockerfile b/bitnami/Dockerfile index 873fa036..bfe6007e 100644 --- a/bitnami/Dockerfile +++ b/bitnami/Dockerfile @@ -208,6 +208,55 @@ RUN set -eux \ /tmp/* \ /var/tmp/* +# Adding hypopg +ARG HYPOPG_VERSION + +RUN set -e \ + && cd /tmp\ + && apt-get update \ + && apt-get install -y \ + ca-certificates \ + openssl \ + tar \ + autoconf \ + automake \ + g++ \ + clang \ + llvm \ + libtool \ + libxml2-dev \ + make \ + perl \ + wget \ + && wget -O hypopg.tar.gz "https://github.com/HypoPG/hypopg/archive/refs/tags/${HYPOPG_VERSION}.tar.gz" \ + && mkdir -p /tmp/hypopg \ + && tar \ + --extract \ + --file hypopg.tar.gz \ + --directory /tmp/hypopg \ + --strip-components 1 \ + && cd /tmp/hypopg \ + && make \ + && make install \ + # clean + && cd / \ + && rm /tmp/hypopg.tar.gz \ + && rm -rf /tmp/hypopg \ + && apt-get autoremove --purge -y \ + autoconf \ + automake \ + g++ \ + clang \ + llvm \ + make \ + perl \ + wget \ + && apt-get clean -y \ + && rm -rf \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* + USER 1001 ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/timescaledb-bitnami-entrypoint.sh" ] diff --git a/bitnami/Makefile b/bitnami/Makefile index 66d58dec..6b535249 100644 --- a/bitnami/Makefile +++ b/bitnami/Makefile @@ -7,6 +7,7 @@ PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-) PG_CRON_VERSION=v1.6.0 TS_VERSION=2.13.0 POSTGIS_VERSION=3.4.1 +HYPOPG_VERSION=1.4.0 PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!') PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)-bitnami" PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "bitnami/postgresql:$(PG_VER_NUMBER)"; fi ) @@ -27,7 +28,8 @@ DOCKER_BUILD_ARGS = --build-arg PG_VERSION=$(PG_VER_NUMBER) \ --build-arg TS_VERSION=$(TS_VERSION) \ --build-arg PREV_IMAGE=$(PREV_IMAGE) \ --build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \ - --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) + --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \ + --build-arg HYPOPG_VERSION=$(HYPOPG_VERSION) default: image