Skip to content

Commit

Permalink
add zombodb extension
Browse files Browse the repository at this point in the history
Signed-off-by: Piyush Raj <[email protected]>
  • Loading branch information
PiyushRaj927 committed Feb 21, 2024
1 parent 7fd3328 commit 4094902
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 6 deletions.
33 changes: 32 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,35 @@ RUN set -eux \
# clean
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps
&& apk del .fetch-deps .build-deps

ENV RUSTFLAGS="-C target-feature=-crt-static"
ARG ZOMBODB_VERSION
ARG PG_VERSION
# RUN echo ${PG_VERSION} && exit 1
RUN apk add --no-cache --virtual .zombodb-build-deps \
git \
curl \
bash \
ruby-dev \
ruby-etc \
musl-dev \
make \
gcc \
coreutils \
util-linux-dev \
musl-dev \
openssl-dev \
clang15 \
tar \
&& gem install --no-document fpm \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y \
&& PATH=$HOME/.cargo/bin:$PATH \
&& cargo install cargo-pgrx --version 0.9.3 \
&& cargo pgrx init --pg${PG_VERSION}=$(which pg_config) \
&& git clone --depth 1 --branch ${ZOMBODB_VERSION} https://github.com/zombodb/zombodb.git \
&& cd ./zombodb \
&& cargo pgrx install --release \
&& cd .. \
&& rm -rf ./zombodb \
&& apk del .zombodb-build-deps
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
ZOMBODB_VERSION=v3000.2.3
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 )
Expand All @@ -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 ZOMBODB_VERSION=$(ZOMBODB_VERSION)


default: image
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [x] [TimescaleDB](https://github.com/timescale/timescaledb)
- [x] [PgCron ](https://github.com/citusdata/pg_cron)
- [x] [PostGIS](https://postgis.net)
- [x] [ZomboDB](https://github.com/zombodb/zombodb)
- [ ] [Citus](https://www.citusdata.com/)

## Releases
Expand Down
40 changes: 40 additions & 0 deletions bitnami/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,46 @@ RUN set -eux \
/tmp/* \
/var/tmp/*

# Install zombodb extension
ARG PG_MAJOR
ENV RUSTFLAGS="-C target-cpu=native target-cpu=native link-arg=-fuse-ld=lld"
RUN apt-get update -y -qq --fix-missing \
&& apt-get install -y wget gnupg \
&& echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" >> /etc/apt/sources.list \
&& echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list \
&& wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 \
&& apt update \
&& apt-get update -y --fix-missing \
&& apt-get install -y git curl clang-14 llvm-14 gcc make build-essential libz-dev zlib1g-dev pkg-config libreadline-dev libgdbm-dev libssl1.0-dev \
&& wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz \
&& tar -xzvf openssl-1.0.2l.tar.gz \
&& cd openssl-1.0.2l \
&& ./config \
&& make install \
&& ln -sf /usr/local/ssl/bin/openssl `which openssl` \
&& mkdir ruby \
&& cd ruby \
&& wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz \
&& tar xvfz ruby-2.3.0.tar.gz \
&& cd ruby-2.3.0 \
&& ./configure --with-openssl-dir=/usr/include/openssl-1.0 \
&& make -j64 \
&& make install \
&& gem install --no-document fpm \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& export PATH="/.cargo/bin:$PATH" \
&& export PGRX_HOME="/.pgrx/" \
&& mkdir -p $PGRX_HOME \
&& cargo install cargo-pgrx --version 0.9.3 \
&& cargo pgrx init --pg${PG_MAJOR}=/opt/bitnami/postgresql/bin/pg_config \
&& git clone --depth 1 --branch ${ZOMBODB_VERSION} https://github.com/zombodb/zombodb.git \
&& cd zombodb \
&& export PATH="/.cargo/bin:$PATH" && cargo pgrx install --release \
&& cd / \
&& apt-get autoremove --purge -y git curl clang-14 gcc make build-essential wget \
&& rm -rf .cargo .gem openssl-1.0.2l .rustup openssl-1.0.2l.tar.gz

USER 1001

ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/timescaledb-bitnami-entrypoint.sh" ]
Expand Down
6 changes: 4 additions & 2 deletions bitnami/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ PG_VER=pg15
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
POSTGIS_VERSION=3.4.1
ZOMBODB_VERSION=v3000.2.3
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 )
Expand All @@ -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 ZOMBODB_VERSION=$(ZOMBODB_VERSION)


default: image
Expand Down
4 changes: 2 additions & 2 deletions bitnami/timescaledb-bitnami-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# shared preload list, or else it gets overwritten.
if [ -z "$POSTGRESQL_SHARED_PRELOAD_LIBRARIES" ]
then
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="timescaledb,pg_cron"
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="timescaledb,pg_cron,zombodb"
else
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="$POSTGRESQL_SHARED_PRELOAD_LIBRARIES,timescaledb,pg_cron"
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="$POSTGRESQL_SHARED_PRELOAD_LIBRARIES,timescaledb,pg_cron,zombodb"
fi
export POSTGRESQL_SHARED_PRELOAD_LIBRARIES

Expand Down

0 comments on commit 4094902

Please sign in to comment.