Skip to content

Commit

Permalink
Use build arg to optionally include Patroni changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thedodd committed Apr 28, 2022
1 parent 1b91dc5 commit df49865
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:
TIMESCALE_TSDB_ADMIN: "1.0.0"
TIMESCALEDB_TOOLKIT_REPO: github.com/timescale/timescaledb-toolkit
TIMESCALEDB_TOOLKIT_EXTENSIONS: forge-stable-1.3.1 1.5.1-cloud 1.6.0
TIMESCALE_STATIC_PRIMARY: "true"
jobs:
build-image:
name: Build the default Docker Image
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/publish_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
TIMESCALE_TSDB_ADMIN: "1.0.0"
TIMESCALEDB_TOOLKIT_REPO: github.com/timescale/timescaledb-toolkit
TIMESCALEDB_TOOLKIT_EXTENSIONS: forge-stable-1.3.1 1.5.1-cloud 1.6.0
TIMESCALE_STATIC_PRIMARY: ''
jobs:
publish-image:
name: Publish the Docker Images
Expand All @@ -23,6 +24,11 @@ jobs:
# This is the 'default' image, it contains PostgreSQL 14 13 and 12, and defaults to PostgreSQL 14 binaries
- pg_major: "14"
pg_versions: "14 13 12"
# This is the 'default' image, along with Patroni changes to support static primaries
- pg_major: "14"
pg_versions: "14 13 12"
patroni_static_primary: "true"
docker_tag_postfix: "-patroni-static-primary"
# This is the PostgreSQL 14 image containing only oss software
- pg_major: "14"
pg_versions: "14 13 12"
Expand Down Expand Up @@ -75,6 +81,7 @@ jobs:
DOCKER_ECR_URL: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/timescaledb-ha
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TIMESCALE_STATIC_PRIMARY: ${{ matrix.patroni_static_primary }}
# Note that our ECR registry has immutability guarantees, therefore we do not push
# the mutable ('latest') tags to the ECR registry
run: |
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,12 @@ RUN apt-get install -y python3-etcd python3-requests python3-pystache python3-ku
RUN apt-get install -y patroni=2.1.3-\*
# Patch Patroni code with changes from https://github.com/timescale/patroni/pull/1
# NOTE: This is a temporary solution until changes land upstream.
RUN wget -qO- https://raw.githubusercontent.com/timescale/patroni/v2.2.0-beta.1/patroni/ha.py > /usr/lib/python3/dist-packages/patroni/ha.py && \
ARG TIMESCALE_STATIC_PRIMARY
RUN if [ "${TIMESCALE_STATIC_PRIMARY}" != "" ]; then \
wget -qO- https://raw.githubusercontent.com/timescale/patroni/v2.2.0-beta.1/patroni/ha.py > /usr/lib/python3/dist-packages/patroni/ha.py && \
wget -qO- https://raw.githubusercontent.com/timescale/patroni/v2.2.0-beta.1/patroni/config.py > /usr/lib/python3/dist-packages/patroni/config.py && \
wget -qO- https://raw.githubusercontent.com/timescale/patroni/v2.2.0-beta.1/patroni/validator.py > /usr/lib/python3/dist-packages/patroni/validator.py
wget -qO- https://raw.githubusercontent.com/timescale/patroni/v2.2.0-beta.1/patroni/validator.py > /usr/lib/python3/dist-packages/patroni/validator.py \
fi

RUN for file in $(find /usr/share/postgresql -name 'postgresql.conf.sample'); do \
# We want timescaledb to be loaded in this image by every created cluster
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ TIMESCALE_TSDB_ADMIN?=
TIMESCALE_HOT_FORGE?=
TIMESCALE_OOM_GUARD?=
TIMESCALE_CLOUDUTILS?=
TIMESCALE_STATIC_PRIMARY?=

DOCKER_EXTRA_BUILDARGS?=
DOCKER_REGISTRY?=localhost:5000
Expand Down Expand Up @@ -81,6 +82,7 @@ DOCKER_BUILD_COMMAND=docker build --progress=plain \
--build-arg TIMESCALE_TSDB_ADMIN="$(TIMESCALE_TSDB_ADMIN)" \
--build-arg TIMESCALEDB_TOOLKIT_EXTENSIONS="$(TIMESCALEDB_TOOLKIT_EXTENSIONS)" \
--build-arg TIMESCALEDB_TOOLKIT_REPO="$(TIMESCALEDB_TOOLKIT_REPO)" \
--build-arg TIMESCALE_STATIC_PRIMARY="$(TIMESCALE_STATIC_PRIMARY)" \
--cache-from "$(DOCKER_CACHE_FROM)" \
--label com.timescaledb.image.install_method=$(INSTALL_METHOD) \
--label org.opencontainers.image.created="$$(date -Iseconds --utc)" \
Expand Down

0 comments on commit df49865

Please sign in to comment.