Skip to content

Commit de8975a

Browse files
semoaldangra
andauthored
feat(): upgrade to pg18 and upgrade to latest others (#296)
* feat(): upgrade to pg18 and upgrade to latest others * chore: remove pg 18 due repmgr compatbility * Revert "chore: remove pg 18 due repmgr compatbility" This reverts commit 42bc9ee. * feat: upgrade haproxy to latest * chore: fix conflicts * chore: upgrade minors * chore: revert back to 2.8 haproxy * fix: align timescale dockerfile * Conditional push for Docker images on non-PR events * Update Go version in Dockerfile to 1.26 * lint: remove extra spaces Removed unnecessary blank lines and ensured proper formatting in the CI workflow. * fix: replace deprecated apt-key with gpg --dearmor for TimescaleDB repos apt-key was removed in Debian 12+/Ubuntu 22.04+. Updated all TimescaleDB Dockerfiles to use modern signed-by keyring approach instead. Fixes build error: /bin/sh: 1: apt-key: not found * chore: update PostgreSQL to latest minor versions (Feb 2026) - pg15: 15.15 → 15.17 - pg16: 16.11 → 16.13 - pg17: 17.7 → 17.9 - pg18: 18.1 → 18.3 Latest release: February 26, 2026 * fix(pg15): remove haproxy from initial install to prevent downgrade Haproxy was installed twice - once from default repos and again from haproxy.debian.net. This caused a downgrade error. Now only installed from the specific versioned repo. * fix(pg18): update Go builder from 1.23 to 1.26 Project go.mod requires Go 1.26 but Dockerfile was using golang:1.23. This caused build failure: 'go.mod requires go >= 1.26' --------- Co-authored-by: Daniel Graña <dangra@gmail.com>
1 parent 18b8531 commit de8975a

9 files changed

Lines changed: 263 additions & 25 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,90 +32,120 @@ jobs:
3232
uses: docker/build-push-action@v7
3333
with:
3434
build-args: |
35-
PG_VERSION=15.10
35+
PG_VERSION=15.15
3636
PG_MAJOR_VERSION=15
3737
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
3838
context: .
3939
file: ./pg15/Dockerfile
4040
push: ${{ github.event_name != 'pull_request' }}
4141
tags: |
4242
flyio/postgres-flex:15
43-
flyio/postgres-flex:15.10
43+
flyio/postgres-flex:15.15
4444
4545
- name: Build and push Postgres 15 Timescale DB
4646
id: docker_build_15_timescaledb
4747
uses: docker/build-push-action@v7
4848
with:
4949
build-args: |
50-
PG_VERSION=15.10
50+
PG_VERSION=15.15
5151
PG_MAJOR_VERSION=15
5252
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
5353
context: .
5454
file: ./pg15/Dockerfile-timescaledb
5555
push: ${{ github.event_name != 'pull_request' }}
5656
tags: |
5757
flyio/postgres-flex-timescaledb:15
58-
flyio/postgres-flex-timescaledb:15.10
58+
flyio/postgres-flex-timescaledb:15.15
5959
6060
- name: Build and push Postgres 16
6161
id: docker_build_16
6262
uses: docker/build-push-action@v7
6363
with:
6464
build-args: |
65-
PG_VERSION=16.6
65+
PG_VERSION=16.11
6666
PG_MAJOR_VERSION=16
6767
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
6868
context: .
6969
file: ./pg16/Dockerfile
7070
push: ${{ github.event_name != 'pull_request' }}
7171
tags: |
7272
flyio/postgres-flex:16
73-
flyio/postgres-flex:16.6
73+
flyio/postgres-flex:16.11
7474
7575
- name: Build and push Postgres 16 Timescale DB
7676
id: docker_build_16_timescaledb
7777
uses: docker/build-push-action@v7
7878
with:
7979
build-args: |
80-
PG_VERSION=16.6
80+
PG_VERSION=16.11
8181
PG_MAJOR_VERSION=16
8282
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
8383
context: .
8484
file: ./pg16/Dockerfile-timescaledb
8585
push: ${{ github.event_name != 'pull_request' }}
8686
tags: |
8787
flyio/postgres-flex-timescaledb:16
88-
flyio/postgres-flex-timescaledb:16.6
88+
flyio/postgres-flex-timescaledb:16.11
8989
9090
- name: Build and push Postgres 17
9191
id: docker_build_17
9292
uses: docker/build-push-action@v7
9393
with:
9494
build-args: |
95-
PG_VERSION=17.2
95+
PG_VERSION=17.7
9696
PG_MAJOR_VERSION=17
9797
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
9898
context: .
9999
file: ./pg17/Dockerfile
100100
push: ${{ github.event_name != 'pull_request' }}
101101
tags: |
102102
flyio/postgres-flex:17
103-
flyio/postgres-flex:17.2
103+
flyio/postgres-flex:17.7
104104
105105
- name: Build and push Postgres 17 Timescale DB
106106
id: docker_build_17_timescaledb
107107
uses: docker/build-push-action@v7
108108
with:
109109
build-args: |
110-
PG_VERSION=17.2
110+
PG_VERSION=17.7
111111
PG_MAJOR_VERSION=17
112112
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
113113
context: .
114114
file: ./pg17/Dockerfile-timescaledb
115115
push: ${{ github.event_name != 'pull_request' }}
116116
tags: |
117117
flyio/postgres-flex-timescaledb:17
118-
flyio/postgres-flex-timescaledb:17.2
118+
flyio/postgres-flex-timescaledb:17.7
119+
120+
- name: Build and push Postgres 18
121+
id: docker_build_18
122+
uses: docker/build-push-action@v6
123+
with:
124+
build-args: |
125+
PG_VERSION=18.1
126+
PG_MAJOR_VERSION=18
127+
VERSION=${{ steps.get-latest-tag.outputs.tag }}
128+
context: .
129+
file: ./pg18/Dockerfile
130+
push: ${{ github.event_name != 'pull_request' }}
131+
tags: |
132+
flyio/postgres-flex:18
133+
flyio/postgres-flex:18.1
134+
135+
- name: Build and push Postgres 18 Timescale DB
136+
id: docker_build_18_timescaledb
137+
uses: docker/build-push-action@v6
138+
with:
139+
build-args: |
140+
PG_VERSION=18.1
141+
PG_MAJOR_VERSION=18
142+
VERSION=${{ steps.get-latest-tag.outputs.tag }}
143+
context: .
144+
file: ./pg18/Dockerfile-timescaledb
145+
push: ${{ github.event_name != 'pull_request' }}
146+
tags: |
147+
flyio/postgres-flex-timescaledb:18
148+
flyio/postgres-flex-timescaledb:18.1
119149
120150
- name: Postgres 15 Image digest
121151
run: echo ${{ steps.docker_build_15.outputs.digest }}
@@ -134,3 +164,9 @@ jobs:
134164

135165
- name: Postgres 17 TimescaleDB Image digest
136166
run: echo ${{ steps.docker_build_17_timescaledb.outputs.digest }}
167+
168+
- name: Postgres 18 Image digest
169+
run: echo ${{ steps.docker_build_18.outputs.digest }}
170+
171+
- name: Postgres 18 TimescaleDB Image digest
172+
run: echo ${{ steps.docker_build_18_timescaledb.outputs.digest }}

pg15/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PG_VERSION=15.10
1+
ARG PG_VERSION=15.15
22
ARG PG_MAJOR_VERSION=15
33
ARG VERSION=custom
44

pg15/Dockerfile-timescaledb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PG_VERSION=15.10
1+
ARG PG_VERSION=15.17
22
ARG PG_MAJOR_VERSION=15
33
ARG VERSION=custom
44

@@ -37,7 +37,7 @@ LABEL fly.pg-version=${PG_VERSION}
3737
LABEL fly.pg-manager=repmgr
3838

3939
RUN apt-get update && apt-get install --no-install-recommends -y \
40-
ca-certificates iproute2 curl bash dnsutils vim haproxy socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud cron \
40+
ca-certificates iproute2 curl bash dnsutils vim socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud cron \
4141
&& apt autoremove -y
4242

4343
# Repmgr
@@ -47,8 +47,8 @@ RUN apt-get update && \
4747
apt-get install -y ./postgresql-${PG_MAJOR_VERSION}-repmgr_5.3.3-2_amd64.deb \
4848
&& rm ./postgresql-${PG_MAJOR_VERSION}-repmgr_5.3.3-2_amd64.deb
4949

50-
RUN echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(cat /etc/os-release | grep VERSION_CODENAME | cut -d'=' -f2) main" > /etc/apt/sources.list.d/timescaledb.list \
51-
&& curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -
50+
RUN curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor > /usr/share/keyrings/timescaledb.gpg \
51+
&& echo "deb [signed-by=/usr/share/keyrings/timescaledb.gpg] https://packagecloud.io/timescale/timescaledb/debian/ $(cat /etc/os-release | grep VERSION_CODENAME | cut -d'=' -f2) main" > /etc/apt/sources.list.d/timescaledb.list
5252

5353
# TimescaleDB and PostGIS
5454
RUN apt-get update && apt-get install --no-install-recommends -y \

pg16/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PG_VERSION=16.6
1+
ARG PG_VERSION=16.11
22
ARG PG_MAJOR_VERSION=16
33
ARG VERSION=custom
44

pg16/Dockerfile-timescaledb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PG_VERSION=16.6
1+
ARG PG_VERSION=16.13
22
ARG PG_MAJOR_VERSION=16
33
ARG VERSION=custom
44

@@ -73,8 +73,8 @@ RUN curl -L http://launchpadlibrarian.net/722514158/postgresql-${PG_MAJOR_VERSIO
7373

7474

7575
# TimescaleDB and PostGIS
76-
RUN echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ jammy main" > /etc/apt/sources.list.d/timescaledb.list \
77-
&& curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -
76+
RUN curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor > /usr/share/keyrings/timescaledb.gpg \
77+
&& echo "deb [signed-by=/usr/share/keyrings/timescaledb.gpg] https://packagecloud.io/timescale/timescaledb/ubuntu/ jammy main" > /etc/apt/sources.list.d/timescaledb.list
7878

7979
RUN apt-get update && apt-get install --no-install-recommends -y \
8080
postgresql-$PG_MAJOR_VERSION-postgis-$POSTGIS_MAJOR \

pg17/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PG_VERSION=17.2
1+
ARG PG_VERSION=17.7
22
ARG PG_MAJOR_VERSION=17
33
ARG VERSION=custom
44

pg17/Dockerfile-timescaledb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PG_VERSION=17.2
1+
ARG PG_VERSION=17.9
22
ARG PG_MAJOR_VERSION=17
33
ARG VERSION=custom
44

@@ -68,8 +68,8 @@ RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmo
6868
postgresql-${PG_MAJOR_VERSION}-repmgr=${REPMGR_VERSION}
6969

7070
# 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 -
71+
RUN curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor > /usr/share/keyrings/timescaledb.gpg \
72+
&& echo "deb [signed-by=/usr/share/keyrings/timescaledb.gpg] https://packagecloud.io/timescale/timescaledb/ubuntu/ jammy main" > /etc/apt/sources.list.d/timescaledb.list
7373

7474
RUN apt-get update && apt-get install --no-install-recommends -y \
7575
postgresql-$PG_MAJOR_VERSION-postgis-$POSTGIS_MAJOR \

pg18/Dockerfile

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
ARG PG_VERSION=18.1
2+
ARG PG_MAJOR_VERSION=18
3+
ARG VERSION=custom
4+
5+
FROM golang:1.26 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=3.3
29+
ARG REPMGR_VERSION=5.5.0+debpgdg-3.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 software-properties-common && \
78+
add-apt-repository ppa:vbernat/haproxy-${HAPROXY_VERSION} && \
79+
apt-get update && apt-get install --no-install-recommends -y \
80+
haproxy=$HAPROXY_VERSION.\* \
81+
&& apt autoremove -y && apt clean
82+
83+
# Copy Go binaries from the builder stage
84+
COPY --from=builder /fly/bin/* /usr/local/bin
85+
86+
# Copy Postgres exporter
87+
COPY --from=wrouesnel/postgres_exporter:latest /postgres_exporter /usr/local/bin/
88+
89+
# Move pg_rewind into path.
90+
RUN ln -s /usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_rewind /usr/bin/pg_rewind
91+
92+
ADD /config/* /fly/
93+
RUN mkdir -p /run/haproxy/
94+
RUN usermod -d /data postgres
95+
96+
EXPOSE 5432
97+
98+
CMD ["start"]

0 commit comments

Comments
 (0)