Skip to content

Commit c3beb05

Browse files
authored
add pg_auto_failover extension (#126)
Signed-off-by: Piyush Raj <[email protected]>
1 parent 8db1c38 commit c3beb05

File tree

7 files changed

+81
-8
lines changed

7 files changed

+81
-8
lines changed

.github/workflows/smoke-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ jobs:
7878
echo "Test pg_repack Extension"
7979
psql -c "CREATE EXTENSION pg_repack;"
8080
psql -c "select repack.version(), repack.version_sql();"
81+
82+
echo "Test pgautofailover Extension"
83+
psql -c "CREATE EXTENSION pgautofailover CASCADE;"
84+
psql -c "SELECT pgautofailover.formation_settings();"
8185
break
8286
fi
8387
sleep 1

Dockerfile

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ RUN set -ex \
7575

7676

7777
# Update to shared_preload_libraries
78-
RUN echo "shared_preload_libraries = 'citus,timescaledb,pg_cron'" >> /usr/local/share/postgresql/postgresql.conf.sample
78+
RUN echo "shared_preload_libraries = 'citus,timescaledb,pg_cron,pgautofailover'" >> /usr/local/share/postgresql/postgresql.conf.sample
7979
# Adding PG Vector
8080

8181
RUN cd /tmp
@@ -261,4 +261,35 @@ RUN set -eux \
261261
# clean
262262
&& cd / \
263263
&& rm -rf /tmp/pg_repack-${PG_REPACK_VERSION} /tmp/pg_repack.zip \
264-
&& apk del .pg_repack-build-deps
264+
&& apk del .pg_repack-build-deps
265+
266+
# Adding pgautofailover
267+
ARG PG_AUTO_FAILOVER_VERSION
268+
RUN set -eux \
269+
&& apk add --no-cache --virtual .pg_auto_failover-build-deps \
270+
make \
271+
gcc \
272+
musl-dev \
273+
krb5-dev \
274+
openssl-dev \
275+
clang15 \
276+
ncurses-dev \
277+
linux-headers \
278+
zstd-dev \
279+
lz4-dev \
280+
zlib-dev \
281+
libedit-dev \
282+
libxml2-utils \
283+
libxslt-dev \
284+
llvm15 \
285+
# build pg_auto_failover
286+
&& wget -O /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip "https://github.com/hapostgres/pg_auto_failover/archive/refs/tags/v${PG_AUTO_FAILOVER_VERSION}.zip" \
287+
&& unzip /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip -d /tmp \
288+
&& ls -alh /tmp \
289+
&& cd /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION} \
290+
&& make \
291+
&& make install \
292+
# clean
293+
&& cd / \
294+
&& rm -rf /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION} /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION}.zip \
295+
&& apk del .pg_auto_failover-build-deps

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PG_CRON_VERSION=v1.6.0
99
POSTGIS_VERSION=3.4.2
1010
CITUS_VERSION=12.1.0
1111
PG_REPACK_VERSION=1.5.0
12+
PG_AUTO_FAILOVER_VERSION=2.1
1213
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 = !!')
1314
PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)$(PREV_EXTRA)"
1415
PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "postgres:$(PG_VER_NUMBER)-alpine"; fi )
@@ -34,7 +35,8 @@ DOCKER_BUILD_ARGS = --build-arg TS_VERSION=$(TS_VERSION) \
3435
--build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \
3536
--build-arg PG_REPACK_VERSION=$(PG_REPACK_VERSION)\
3637
--build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \
37-
--build-arg CITUS_VERSION=$(CITUS_VERSION)
38+
--build-arg CITUS_VERSION=$(CITUS_VERSION) \
39+
--build-arg PG_AUTO_FAILOVER_VERSION=$(PG_AUTO_FAILOVER_VERSION)
3840

3941

4042
default: image

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66
- [x] [PgVector](https://github.com/pgvector/pgvector)
77
- [x] [TimescaleDB](https://github.com/timescale/timescaledb)
8-
- [x] [PgCron ](https://github.com/citusdata/pg_cron)
8+
- [x] [PgCron](https://github.com/citusdata/pg_cron)
99
- [x] [PostGIS](https://postgis.net)
1010
- [x] [Citus](https://www.citusdata.com/)
1111
- [x] [Pg Repack](https://github.com/reorg/pg_repack)
12+
- [x] [PgAutoFailover](https://github.com/hapostgres/pg_auto_failover)
1213
## Releases
1314
- [Versioning Policy](./docs/version-policy.md)
1415

bitnami/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,40 @@ RUN apt-get update \
273273
/tmp/* \
274274
/var/tmp/*
275275

276+
# Adding pgautofailover
277+
ARG PG_AUTO_FAILOVER_VERSION
278+
RUN apt-get update \
279+
&& apt-get install -y unzip \
280+
build-essential \
281+
liblz4-dev \
282+
zlib1g-dev \
283+
libedit-dev \
284+
libssl-dev \
285+
libxslt1-dev \
286+
wget \
287+
# build pg_auto_failover
288+
&& wget -O /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip "https://github.com/hapostgres/pg_auto_failover/archive/refs/tags/v${PG_AUTO_FAILOVER_VERSION}.zip" \
289+
&& unzip /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip -d /tmp \
290+
&& ls -alh /tmp \
291+
&& cd /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION} \
292+
&& make \
293+
&& make install \
294+
# clean
295+
&& cd / \
296+
&& rm -rf /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION} /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION}.zip \
297+
&& apt-get autoremove --purge -y \
298+
unzip \
299+
build-essential \
300+
liblz4-dev \
301+
libedit-dev \
302+
libssl-dev \
303+
wget \
304+
&& apt-get clean -y \
305+
&& rm -rf \
306+
/var/lib/apt/lists/* \
307+
/tmp/* \
308+
/var/tmp/*
309+
276310
USER 1001
277311

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

bitnami/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ORG=timescaledev
55
PG_VER=pg15
66
PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-)
77
PG_CRON_VERSION=v1.6.0
8+
PG_AUTO_FAILOVER_VERSION=2.1
89
TS_VERSION=2.13.0
910
POSTGIS_VERSION=3.4.2
1011
CITUS_VERSION=12.1.0
@@ -31,8 +32,8 @@ DOCKER_BUILD_ARGS = --build-arg PG_VERSION=$(PG_VER_NUMBER) \
3132
--build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \
3233
--build-arg PG_REPACK_VERSION=$(PG_REPACK_VERSION) \
3334
--build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \
34-
--build-arg CITUS_VERSION=$(CITUS_VERSION)
35-
35+
--build-arg CITUS_VERSION=$(CITUS_VERSION) \
36+
--build-arg PG_AUTO_FAILOVER_VERSION=$(PG_AUTO_FAILOVER_VERSION)
3637

3738
default: image
3839

bitnami/timescaledb-bitnami-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# shared preload list, or else it gets overwritten.
55
if [ -z "$POSTGRESQL_SHARED_PRELOAD_LIBRARIES" ]
66
then
7-
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb,pg_cron"
7+
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb,pg_cron,pgautofailover"
88
else
9-
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb,pg_cron,$POSTGRESQL_SHARED_PRELOAD_LIBRARIES"
9+
POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb,pg_cron,pgautofailover,$POSTGRESQL_SHARED_PRELOAD_LIBRARIES"
1010
fi
1111
export POSTGRESQL_SHARED_PRELOAD_LIBRARIES
1212

0 commit comments

Comments
 (0)