Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ 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 Citus Extension"
psql -c "CREATE EXTENSION citus;"
psql -c "SELECT * FROM citus_version();"

echo "Test Citus Distributed Table"
psql -c "CREATE TABLE test_distributed_table (id serial primary key, data text);"
psql -c "SELECT create_distributed_table('test_distributed_table', 'id');"
psql -c "INSERT INTO test_distributed_table (data) VALUES ('test data');"
psql -c "SELECT * FROM test_distributed_table;"

break
fi
sleep 1
Expand Down
39 changes: 37 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ RUN set -ex \


# Update to shared_preload_libraries
RUN echo "shared_preload_libraries = 'timescaledb,pg_cron'" >> /usr/local/share/postgresql/postgresql.conf.sample
RUN echo "shared_preload_libraries = 'timescaledb,pg_cron,citus'" >> /usr/local/share/postgresql/postgresql.conf.sample
# Adding PG Vector

RUN cd /tmp
Expand Down Expand Up @@ -200,4 +200,39 @@ RUN set -eux \
# clean
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps
&& apk del .fetch-deps .build-deps

## Adding Citus

ARG CITUS_VERSION
# Install Citus dependencies
RUN set -ex \
&& apk add --no-cache --virtual .citus-deps \
curl \
jq \
# Install Citus
&& apk add --no-cache --virtual .citus-build-deps \
gcc \
libc-dev \
make \
curl-dev \
lz4-dev \
zstd-dev \
clang-15 \
krb5-dev \
icu-dev \
libxslt-dev \
libxml2-dev \
llvm15-dev \
&& CITUS_DOWNLOAD_URL="https://github.com/citusdata/citus/archive/refs/tags/v${CITUS_VERSION}.tar.gz" \
&& curl -L -o /tmp/citus.tar.gz "${CITUS_DOWNLOAD_URL}" \
&& tar -C /tmp -xvf /tmp/citus.tar.gz \
&& chown -R postgres:postgres /tmp/citus-${CITUS_VERSION} \
&& cd /tmp/citus-${CITUS_VERSION} \
&& PATH="/usr/local/pgsql/bin:$PATH" ./configure \
&& make \
&& make install \
&& cd ~ \
&& rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \
&& apk del .citus-deps .citus-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
CITUS_VERSION=12.1.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 )
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 CITUS_VERSION=$(CITUS_VERSION)


default: image
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Test on GitPod
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/ChakshuGautam/postgres-tsdb-vector-docker)

## Postgres
## Current and future supported extensions

- [x] [PgVector](https://github.com/pgvector/pgvector)
- [x] [TimescaleDB](https://github.com/timescale/timescaledb)
- [x] [PgCron ](https://github.com/citusdata/pg_cron)
- [x] [PostGIS](https://postgis.net)
- [ ] [Citus](https://www.citusdata.com/)
- [x] [Citus](https://www.citusdata.com/)

## Releases
- [Versioning Policy](./docs/version-policy.md)
Expand Down
33 changes: 33 additions & 0 deletions bitnami/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,39 @@ RUN set -eux \
/tmp/* \
/var/tmp/*

# add Citus
ARG CITUS_VERSION
RUN set -eux \
&& apt-get update \
&& apt-get install -y libc-dev make libssl-dev curl gcc liblz4-dev libzstd-dev clang libkrb5-dev libicu-dev libxslt1-dev libxml2-dev llvm-dev libcurl4-openssl-dev \
&& CITUS_DOWNLOAD_URL="https://github.com/citusdata/citus/archive/refs/tags/v${CITUS_VERSION}.tar.gz" \
&& curl -L -o /tmp/citus.tar.gz "${CITUS_DOWNLOAD_URL}" \
&& tar -C /tmp -xvf /tmp/citus.tar.gz \
&& addgroup --system postgres \
&& adduser --system --ingroup postgres --home /opt/bitnami/postgresql --no-create-home postgres \
&& chown -R postgres:postgres /tmp/citus-${CITUS_VERSION} \
&& cd /tmp/citus-${CITUS_VERSION} \
&& PATH="/opt/bitnami/postgresql/bin:$PATH" ./configure \
&& make \
&& make install \
&& cd ~ \
&& rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \
\
&& apt-get autoremove --purge -y \
\
build-essential \
libssl-dev \
gcc \
libc-dev \
make \
&& apt-get clean -y \
&& rm -rf \
/build \
"${HOME}/.cache" \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*

USER 1001

ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/timescaledb-bitnami-entrypoint.sh" ]
Expand Down
4 changes: 3 additions & 1 deletion bitnami/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-)
PG_CRON_VERSION=v1.6.0
TS_VERSION=2.13.0
POSTGIS_VERSION=3.4.1
CITUS_VERSION=12.1.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 )
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 CITUS_VERSION=$(CITUS_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,citus"
else
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="$POSTGRESQL_SHARED_PRELOAD_LIBRARIES,timescaledb,pg_cron"
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="$POSTGRESQL_SHARED_PRELOAD_LIBRARIES,timescaledb,pg_cron,citus"
fi
export POSTGRESQL_SHARED_PRELOAD_LIBRARIES

Expand Down