Skip to content

Commit 3f253f2

Browse files
authored
PG17 release (#277)
1 parent 5a04d2b commit 3f253f2

File tree

3 files changed

+235
-1
lines changed

3 files changed

+235
-1
lines changed

.github/workflows/ci.yaml

+37-1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,37 @@ jobs:
9191
tags: |
9292
flyio/postgres-flex-timescaledb:16
9393
flyio/postgres-flex-timescaledb:16.6
94+
95+
-
96+
name: Build and push Postgres 17
97+
id: docker_build_17
98+
uses: docker/build-push-action@v3
99+
with:
100+
build-args: |
101+
PG_VERSION=17.2
102+
PG_MAJOR_VERSION=17
103+
VERSION=${{ steps.get-latest-tag.outputs.tag }}
104+
context: .
105+
file: ./pg17/Dockerfile
106+
push: true
107+
tags: |
108+
flyio/postgres-flex:17
109+
flyio/postgres-flex:17.2
110+
-
111+
name: Build and push Postgres 17 Timescale DB
112+
id: docker_build_17_timescaledb
113+
uses: docker/build-push-action@v3
114+
with:
115+
build-args: |
116+
PG_VERSION=17.2
117+
PG_MAJOR_VERSION=17
118+
VERSION=${{ steps.get-latest-tag.outputs.tag }}
119+
context: .
120+
file: ./pg17/Dockerfile-timescaledb
121+
push: true
122+
tags: |
123+
flyio/postgres-flex-timescaledb:17
124+
flyio/postgres-flex-timescaledb:17.2
94125
-
95126
name: Postgres 15 Image digest
96127
run: echo ${{ steps.docker_build_15.outputs.digest }}
@@ -103,4 +134,9 @@ jobs:
103134
-
104135
name: Postgres 16 TimescaleDB Image digest
105136
run: echo ${{ steps.docker_build_16_timescaledb.outputs.digest }}
106-
137+
-
138+
name: Postgres 17 Image digest
139+
run: echo ${{ steps.docker_build_17.outputs.digest }}
140+
-
141+
name: Postgres 17 TimescaleDB Image digest
142+
run: echo ${{ steps.docker_build_17_timescaledb.outputs.digest }}

pg17/Dockerfile

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
ARG PG_VERSION=17.2
2+
ARG PG_MAJOR_VERSION=17
3+
ARG VERSION=custom
4+
5+
FROM golang:1.23 AS builder
6+
7+
WORKDIR /go/src/github.com/fly-apps/fly-postgres
8+
COPY . .
9+
10+
RUN CGO_ENABLED=0 GOOS=linux \
11+
go build -v -o /fly/bin/event_handler ./cmd/event_handler && \
12+
go build -v -o /fly/bin/failover_validation ./cmd/failover_validation && \
13+
go build -v -o /fly/bin/pg_unregister ./cmd/pg_unregister && \
14+
go build -v -o /fly/bin/start_monitor ./cmd/monitor && \
15+
go build -v -o /fly/bin/start_admin_server ./cmd/admin_server && \
16+
go build -v -o /fly/bin/start ./cmd/start && \
17+
go build -v -o /fly/bin/flexctl ./cmd/flexctl
18+
19+
20+
COPY ./bin/* /fly/bin/
21+
22+
FROM ubuntu:24.04
23+
24+
ARG VERSION
25+
ARG PG_MAJOR_VERSION
26+
ARG PG_VERSION
27+
ARG POSTGIS_MAJOR=3
28+
ARG HAPROXY_VERSION=2.8
29+
ARG REPMGR_VERSION=5.5.0+debpgdg-1.pgdg24.04+1
30+
31+
ENV PGDATA=/data/postgresql
32+
ENV PGPASSFILE=/data/.pgpass
33+
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials
34+
ENV PG_MAJOR_VERSION=${PG_MAJOR_VERSION}
35+
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH"
36+
37+
38+
LABEL fly.app_role=postgres_cluster
39+
LABEL fly.version=${VERSION}
40+
LABEL fly.pg-version=${PG_VERSION}
41+
LABEL fly.pg-manager=repmgr
42+
43+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
44+
RUN set -eux; \
45+
if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \
46+
# if this file exists, we're likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales)
47+
grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
48+
sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \
49+
! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
50+
fi; \
51+
apt-get update; apt-get install -y --no-install-recommends locales; rm -rf /var/lib/apt/lists/*; \
52+
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen; \
53+
locale-gen; \
54+
locale -a | grep 'en_US.utf8'
55+
ENV LANG en_US.utf8
56+
57+
RUN apt-get update && apt-get install --no-install-recommends -y \
58+
ca-certificates iproute2 curl bash dnsutils vim socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud python3-setuptools cron gosu \
59+
&& apt autoremove -y && apt clean && \
60+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
61+
62+
# Install PostgreSQL
63+
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-archive-keyring.gpg && \
64+
echo "deb [signed-by=/usr/share/keyrings/postgresql-archive-keyring.gpg] http://apt.postgresql.org/pub/repos/apt/ noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
65+
apt-get update && apt-get install --no-install-recommends -y \
66+
postgresql-${PG_MAJOR_VERSION} \
67+
postgresql-client-${PG_MAJOR_VERSION} \
68+
postgresql-contrib-${PG_MAJOR_VERSION} \
69+
postgresql-${PG_MAJOR_VERSION}-repmgr=${REPMGR_VERSION}
70+
71+
# PostGIS
72+
RUN apt-get update && apt-get install --no-install-recommends -y \
73+
postgresql-${PG_MAJOR_VERSION}-postgis-$POSTGIS_MAJOR \
74+
postgresql-${PG_MAJOR_VERSION}-postgis-$POSTGIS_MAJOR-scripts
75+
76+
# Haproxy
77+
RUN apt-get update && apt-get install --no-install-recommends -y \
78+
haproxy=$HAPROXY_VERSION.\* \
79+
&& apt autoremove -y && apt clean
80+
81+
# Copy Go binaries from the builder stage
82+
COPY --from=builder /fly/bin/* /usr/local/bin
83+
84+
# Copy Postgres exporter
85+
COPY --from=wrouesnel/postgres_exporter:latest /postgres_exporter /usr/local/bin/
86+
87+
# Move pg_rewind into path.
88+
RUN ln -s /usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_rewind /usr/bin/pg_rewind
89+
90+
ADD /config/* /fly/
91+
RUN mkdir -p /run/haproxy/
92+
RUN usermod -d /data postgres
93+
94+
EXPOSE 5432
95+
96+
CMD ["start"]

pg17/Dockerfile-timescaledb

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
ARG PG_VERSION=17.2
2+
ARG PG_MAJOR_VERSION=17
3+
ARG VERSION=custom
4+
5+
FROM golang:1.23 AS builder
6+
7+
WORKDIR /go/src/github.com/fly-apps/fly-postgres
8+
COPY . .
9+
10+
RUN CGO_ENABLED=0 GOOS=linux \
11+
go build -v -o /fly/bin/event_handler ./cmd/event_handler && \
12+
go build -v -o /fly/bin/failover_validation ./cmd/failover_validation && \
13+
go build -v -o /fly/bin/pg_unregister ./cmd/pg_unregister && \
14+
go build -v -o /fly/bin/start_monitor ./cmd/monitor && \
15+
go build -v -o /fly/bin/start_admin_server ./cmd/admin_server && \
16+
go build -v -o /fly/bin/start ./cmd/start && \
17+
go build -v -o /fly/bin/flexctl ./cmd/flexctl
18+
19+
20+
COPY ./bin/* /fly/bin/
21+
22+
FROM ubuntu:24.04
23+
24+
ARG VERSION
25+
ARG PG_MAJOR_VERSION
26+
ARG PG_VERSION
27+
ARG POSTGIS_MAJOR=3
28+
ARG HAPROXY_VERSION=2.8
29+
ARG REPMGR_VERSION=5.5.0+debpgdg-1.pgdg24.04+1
30+
31+
ENV PGDATA=/data/postgresql
32+
ENV PGPASSFILE=/data/.pgpass
33+
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials
34+
ENV PG_MAJOR_VERSION=${PG_MAJOR_VERSION}
35+
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH"
36+
37+
LABEL fly.app_role=postgres_cluster
38+
LABEL fly.version=${VERSION}
39+
LABEL fly.pg-version=${PG_VERSION}
40+
LABEL fly.pg-manager=repmgr
41+
42+
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
43+
RUN set -eux; \
44+
if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \
45+
# if this file exists, we're likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales)
46+
grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
47+
sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \
48+
! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
49+
fi; \
50+
apt-get update; apt-get install -y --no-install-recommends locales; rm -rf /var/lib/apt/lists/*; \
51+
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen; \
52+
locale-gen; \
53+
locale -a | grep 'en_US.utf8'
54+
ENV LANG en_US.utf8
55+
56+
RUN apt-get update && apt-get install --no-install-recommends -y \
57+
ca-certificates iproute2 curl bash dnsutils vim socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud python3-setuptools cron gosu \
58+
&& apt autoremove -y && apt clean && \
59+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
60+
61+
# Install PostgreSQL
62+
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-archive-keyring.gpg && \
63+
echo "deb [signed-by=/usr/share/keyrings/postgresql-archive-keyring.gpg] http://apt.postgresql.org/pub/repos/apt/ noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
64+
apt-get update && apt-get install --no-install-recommends -y \
65+
postgresql-${PG_MAJOR_VERSION} \
66+
postgresql-client-${PG_MAJOR_VERSION} \
67+
postgresql-contrib-${PG_MAJOR_VERSION} \
68+
postgresql-${PG_MAJOR_VERSION}-repmgr=${REPMGR_VERSION}
69+
70+
# TimescaleDB and PostGIS
71+
RUN echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ jammy main" > /etc/apt/sources.list.d/timescaledb.list \
72+
&& curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -
73+
74+
RUN apt-get update && apt-get install --no-install-recommends -y \
75+
postgresql-$PG_MAJOR_VERSION-postgis-$POSTGIS_MAJOR \
76+
postgresql-$PG_MAJOR_VERSION-postgis-$POSTGIS_MAJOR-scripts \
77+
timescaledb-2-postgresql-$PG_MAJOR_VERSION \
78+
&& apt autoremove -y && apt clean
79+
80+
# Haproxy
81+
RUN apt-get update && apt-get install --no-install-recommends -y \
82+
haproxy=$HAPROXY_VERSION.\* \
83+
&& apt autoremove -y && apt clean
84+
85+
# Copy Go binaries from the builder stage
86+
COPY --from=builder /fly/bin/* /usr/local/bin
87+
88+
# Copy Postgres exporter
89+
COPY --from=wrouesnel/postgres_exporter:latest /postgres_exporter /usr/local/bin/
90+
91+
# Move pg_rewind into path.
92+
RUN ln -s /usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_rewind /usr/bin/pg_rewind
93+
94+
ADD /config/* /fly/
95+
RUN mkdir -p /run/haproxy/
96+
RUN usermod -d /data postgres
97+
98+
ENV TIMESCALEDB_ENABLED=true
99+
100+
EXPOSE 5432
101+
102+
CMD ["start"]

0 commit comments

Comments
 (0)