File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252 fi
5353 if psql -c "select 1"
5454 then
55+ echo "Test Citus Extension"
56+ psql -c "CREATE EXTENSION citus;"
57+ psql -c "SELECT * FROM citus_version();"
58+
59+ echo "Test Citus Distributed Table"
60+ psql -c "CREATE TABLE test_distributed_table (id serial primary key, data text);"
61+ psql -c "SELECT create_distributed_table('test_distributed_table', 'id');"
62+ psql -c "INSERT INTO test_distributed_table (data) VALUES ('test data');"
63+ psql -c "SELECT * FROM test_distributed_table;"
64+
5565 break
5666 fi
5767 sleep 1
Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ RUN set -ex \
7373 && rm -rf /build \
7474 && sed -r -i "s/[#]*\s *(shared_preload_libraries)\s *=\s *'(.*)'/\1 = 'timescaledb,\2 '/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample
7575
76+ # Add Citus to shared_preload_libraries
77+ RUN echo "shared_preload_libraries = 'citus,timescaledb'" >> /usr/local/share/postgresql/postgresql.conf.sample
78+
7679# Adding PG Vector
7780
7881RUN cd /tmp
@@ -93,3 +96,38 @@ RUN apk add --no-cache --virtual .build-deps \
9396 && ls \
9497 && make \
9598 && make install
99+
100+ # # Adding Citus
101+
102+ # Install Citus dependencies
103+ RUN apk add --no-cache --virtual .citus-deps \
104+ curl \
105+ jq
106+
107+ # Install Citus
108+ ARG CITUS_VERSION="11.2.0"
109+ RUN set -ex \
110+ && apk add --no-cache --virtual .citus-build-deps \
111+ gcc \
112+ libc-dev \
113+ make \
114+ curl-dev \
115+ lz4-dev \
116+ zstd-dev \
117+ clang \
118+ krb5-dev \
119+ icu-dev \
120+ libxslt-dev \
121+ libxml2-dev \
122+ llvm15-dev \
123+ && CITUS_DOWNLOAD_URL="https://github.com/citusdata/citus/archive/refs/tags/v${CITUS_VERSION}.tar.gz" \
124+ && curl -L -o /tmp/citus.tar.gz "${CITUS_DOWNLOAD_URL}" \
125+ && tar -C /tmp -xvf /tmp/citus.tar.gz \
126+ && chown -R postgres:postgres /tmp/citus-${CITUS_VERSION} \
127+ && cd /tmp/citus-${CITUS_VERSION} \
128+ && PATH="/usr/local/pgsql/bin:$PATH" ./configure \
129+ && make \
130+ && make install \
131+ && cd ~ \
132+ && rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \
133+ && apk del .citus-deps .citus-build-deps
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ RUN set +o pipefail \
5151ARG PG_VERSION
5252FROM bitnami/postgresql:${PG_VERSION}
5353ARG PG_VERSION
54+ ARG CITUS_VERSION="11.2.0"
5455
5556LABEL maintainer="Timescale https://www.timescale.com"
5657
@@ -89,6 +90,22 @@ RUN set -ex \
8990 && cd build && make install \
9091 && cd ~ \
9192 \
93+ # Install Citus
94+ && apt-get update \
95+ && apt-get install -y curl liblz4-dev libzstd-dev clang libkrb5-dev libicu-dev libxslt1-dev libxml2-dev llvm-dev libcurl4-openssl-dev \
96+ && CITUS_DOWNLOAD_URL="https://github.com/citusdata/citus/archive/refs/tags/v${CITUS_VERSION}.tar.gz" \
97+ && curl -L -o /tmp/citus.tar.gz "${CITUS_DOWNLOAD_URL}" \
98+ && tar -C /tmp -xvf /tmp/citus.tar.gz \
99+ && addgroup --system postgres \
100+ && adduser --system --ingroup postgres --home /opt/bitnami/postgresql --no-create-home postgres \
101+ && chown -R postgres:postgres /tmp/citus-${CITUS_VERSION} \
102+ && cd /tmp/citus-${CITUS_VERSION} \
103+ && PATH="/opt/bitnami/postgresql/bin:$PATH" ./configure \
104+ && make \
105+ && make install \
106+ && cd ~ \
107+ && rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \
108+ \
92109 && apt-get autoremove --purge -y \
93110 \
94111 build-essential \
@@ -105,8 +122,11 @@ RUN set -ex \
105122 "${HOME}/.cache" \
106123 /var/lib/apt/lists/* \
107124 /tmp/* \
108- /var/tmp/*
109-
125+ /var/tmp/* \
126+ \
127+ # Update shared_preload_libraries
128+ && sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = 'citus,timescaledb'/g" /opt/bitnami/postgresql/conf/postgresql.conf
129+
110130USER 1001
111131
112132ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/timescaledb-bitnami-entrypoint.sh" ]
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # We have to use the bitnami configuration variable to add timescaledb to
4- # shared preload list, or else it gets overwritten.
3+ # We have to use the Bitnami configuration variable to add TimescaleDB and Citus to
4+ # the shared preload list, or else it gets overwritten.
55if [ -z " $POSTGRESQL_SHARED_PRELOAD_LIBRARIES " ]
66then
7- POSTGRESQL_SHARED_PRELOAD_LIBRARIES=timescaledb
7+ POSTGRESQL_SHARED_PRELOAD_LIBRARIES=" citus, timescaledb"
88else
9- POSTGRESQL_SHARED_PRELOAD_LIBRARIES=" $POSTGRESQL_SHARED_PRELOAD_LIBRARIES ,timescaledb"
9+ POSTGRESQL_SHARED_PRELOAD_LIBRARIES=" citus ,timescaledb, $POSTGRESQL_SHARED_PRELOAD_LIBRARIES "
1010fi
1111export POSTGRESQL_SHARED_PRELOAD_LIBRARIES
1212
You can’t perform that action at this time.
0 commit comments