Skip to content

Commit a2cfc9b

Browse files
warpsql: Update smoke tests
1. Add Citus extension smoke tests to GitHub Actions workflow 2. Update Bitnami entrypoint script to preload Citus extension 3. Test Citus extension and distributed table creation in smoke tests 4. Ensure logs are displayed for debugging purposes Fixes: #11
1 parent 1518ee0 commit a2cfc9b

4 files changed

Lines changed: 39 additions & 6 deletions

File tree

.github/workflows/smoke-test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ jobs:
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

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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

7881
RUN cd /tmp

bitnami/Dockerfile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ RUN set +o pipefail \
5151
ARG PG_VERSION
5252
FROM bitnami/postgresql:${PG_VERSION}
5353
ARG PG_VERSION
54+
ARG CITUS_VERSION="11.2.0"
5455

5556
LABEL 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+
110130
USER 1001
111131

112132
ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/timescaledb-bitnami-entrypoint.sh" ]

bitnami/timescaledb-bitnami-entrypoint.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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.
55
if [ -z "$POSTGRESQL_SHARED_PRELOAD_LIBRARIES" ]
66
then
7-
POSTGRESQL_SHARED_PRELOAD_LIBRARIES=timescaledb
7+
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb"
88
else
9-
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="$POSTGRESQL_SHARED_PRELOAD_LIBRARIES,timescaledb"
9+
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb,$POSTGRESQL_SHARED_PRELOAD_LIBRARIES"
1010
fi
1111
export POSTGRESQL_SHARED_PRELOAD_LIBRARIES
1212

0 commit comments

Comments
 (0)