Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 48 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,90 +32,120 @@ jobs:
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=15.10
PG_VERSION=15.15
PG_MAJOR_VERSION=15
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
context: .
file: ./pg15/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex:15
flyio/postgres-flex:15.10
flyio/postgres-flex:15.15

- name: Build and push Postgres 15 Timescale DB
id: docker_build_15_timescaledb
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=15.10
PG_VERSION=15.15
PG_MAJOR_VERSION=15
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
context: .
file: ./pg15/Dockerfile-timescaledb
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex-timescaledb:15
flyio/postgres-flex-timescaledb:15.10
flyio/postgres-flex-timescaledb:15.15

- name: Build and push Postgres 16
id: docker_build_16
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=16.6
PG_VERSION=16.11
PG_MAJOR_VERSION=16
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
context: .
file: ./pg16/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex:16
flyio/postgres-flex:16.6
flyio/postgres-flex:16.11

- name: Build and push Postgres 16 Timescale DB
id: docker_build_16_timescaledb
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=16.6
PG_VERSION=16.11
PG_MAJOR_VERSION=16
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
context: .
file: ./pg16/Dockerfile-timescaledb
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex-timescaledb:16
flyio/postgres-flex-timescaledb:16.6
flyio/postgres-flex-timescaledb:16.11

- name: Build and push Postgres 17
id: docker_build_17
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=17.2
PG_VERSION=17.7
PG_MAJOR_VERSION=17
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
context: .
file: ./pg17/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex:17
flyio/postgres-flex:17.2
flyio/postgres-flex:17.7

- name: Build and push Postgres 17 Timescale DB
id: docker_build_17_timescaledb
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=17.2
PG_VERSION=17.7
PG_MAJOR_VERSION=17
VERSION=${{ steps.get-latest-tag.outputs.tag || 'pr-build' }}
context: .
file: ./pg17/Dockerfile-timescaledb
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex-timescaledb:17
flyio/postgres-flex-timescaledb:17.2
flyio/postgres-flex-timescaledb:17.7

- name: Build and push Postgres 18
id: docker_build_18
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=18.1
PG_MAJOR_VERSION=18
VERSION=${{ steps.get-latest-tag.outputs.tag }}
context: .
file: ./pg18/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex:18
flyio/postgres-flex:18.1

- name: Build and push Postgres 18 Timescale DB
id: docker_build_18_timescaledb
uses: docker/build-push-action@v6
with:
build-args: |
PG_VERSION=18.1
PG_MAJOR_VERSION=18
VERSION=${{ steps.get-latest-tag.outputs.tag }}
context: .
file: ./pg18/Dockerfile-timescaledb
push: ${{ github.event_name != 'pull_request' }}
tags: |
flyio/postgres-flex-timescaledb:18
flyio/postgres-flex-timescaledb:18.1

- name: Postgres 15 Image digest
run: echo ${{ steps.docker_build_15.outputs.digest }}
Expand All @@ -134,3 +164,9 @@ jobs:

- name: Postgres 17 TimescaleDB Image digest
run: echo ${{ steps.docker_build_17_timescaledb.outputs.digest }}

- name: Postgres 18 Image digest
run: echo ${{ steps.docker_build_18.outputs.digest }}

- name: Postgres 18 TimescaleDB Image digest
run: echo ${{ steps.docker_build_18_timescaledb.outputs.digest }}
2 changes: 1 addition & 1 deletion pg15/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PG_VERSION=15.10
ARG PG_VERSION=15.15
ARG PG_MAJOR_VERSION=15
ARG VERSION=custom

Expand Down
8 changes: 4 additions & 4 deletions pg15/Dockerfile-timescaledb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PG_VERSION=15.10
ARG PG_VERSION=15.17
ARG PG_MAJOR_VERSION=15
ARG VERSION=custom

Expand Down Expand Up @@ -37,7 +37,7 @@ LABEL fly.pg-version=${PG_VERSION}
LABEL fly.pg-manager=repmgr

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

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

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 \
&& curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -
RUN curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor > /usr/share/keyrings/timescaledb.gpg \
&& 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

# TimescaleDB and PostGIS
RUN apt-get update && apt-get install --no-install-recommends -y \
Expand Down
2 changes: 1 addition & 1 deletion pg16/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PG_VERSION=16.6
ARG PG_VERSION=16.11
ARG PG_MAJOR_VERSION=16
ARG VERSION=custom

Expand Down
6 changes: 3 additions & 3 deletions pg16/Dockerfile-timescaledb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PG_VERSION=16.6
ARG PG_VERSION=16.13
ARG PG_MAJOR_VERSION=16
ARG VERSION=custom

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


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

RUN apt-get update && apt-get install --no-install-recommends -y \
postgresql-$PG_MAJOR_VERSION-postgis-$POSTGIS_MAJOR \
Expand Down
2 changes: 1 addition & 1 deletion pg17/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PG_VERSION=17.2
ARG PG_VERSION=17.7
ARG PG_MAJOR_VERSION=17
ARG VERSION=custom

Expand Down
6 changes: 3 additions & 3 deletions pg17/Dockerfile-timescaledb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PG_VERSION=17.2
ARG PG_VERSION=17.9
ARG PG_MAJOR_VERSION=17
ARG VERSION=custom

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

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

RUN apt-get update && apt-get install --no-install-recommends -y \
postgresql-$PG_MAJOR_VERSION-postgis-$POSTGIS_MAJOR \
Expand Down
98 changes: 98 additions & 0 deletions pg18/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
ARG PG_VERSION=18.1
ARG PG_MAJOR_VERSION=18
ARG VERSION=custom

FROM golang:1.26 AS builder

WORKDIR /go/src/github.com/fly-apps/fly-postgres
COPY . .

RUN CGO_ENABLED=0 GOOS=linux \
go build -v -o /fly/bin/event_handler ./cmd/event_handler && \
go build -v -o /fly/bin/failover_validation ./cmd/failover_validation && \
go build -v -o /fly/bin/pg_unregister ./cmd/pg_unregister && \
go build -v -o /fly/bin/start_monitor ./cmd/monitor && \
go build -v -o /fly/bin/start_admin_server ./cmd/admin_server && \
go build -v -o /fly/bin/start ./cmd/start && \
go build -v -o /fly/bin/flexctl ./cmd/flexctl


COPY ./bin/* /fly/bin/

FROM ubuntu:24.04

ARG VERSION
ARG PG_MAJOR_VERSION
ARG PG_VERSION
ARG POSTGIS_MAJOR=3
ARG HAPROXY_VERSION=3.3
ARG REPMGR_VERSION=5.5.0+debpgdg-3.pgdg24.04+1

ENV PGDATA=/data/postgresql
ENV PGPASSFILE=/data/.pgpass
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials
ENV PG_MAJOR_VERSION=${PG_MAJOR_VERSION}
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH"


LABEL fly.app_role=postgres_cluster
LABEL fly.version=${VERSION}
LABEL fly.pg-version=${PG_VERSION}
LABEL fly.pg-manager=repmgr

# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
RUN set -eux; \
if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \
# 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)
grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \
! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
fi; \
apt-get update; apt-get install -y --no-install-recommends locales; rm -rf /var/lib/apt/lists/*; \
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen; \
locale-gen; \
locale -a | grep 'en_US.utf8'
ENV LANG en_US.utf8

RUN apt-get update && apt-get install --no-install-recommends -y \
ca-certificates iproute2 curl bash dnsutils vim socat procps ssh gnupg rsync barman-cli barman barman-cli-cloud python3-setuptools cron gosu \
&& apt autoremove -y && apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install PostgreSQL
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-archive-keyring.gpg && \
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 && \
apt-get update && apt-get install --no-install-recommends -y \
postgresql-${PG_MAJOR_VERSION} \
postgresql-client-${PG_MAJOR_VERSION} \
postgresql-contrib-${PG_MAJOR_VERSION} \
postgresql-${PG_MAJOR_VERSION}-repmgr=${REPMGR_VERSION}

# PostGIS
RUN apt-get update && apt-get install --no-install-recommends -y \
postgresql-${PG_MAJOR_VERSION}-postgis-$POSTGIS_MAJOR \
postgresql-${PG_MAJOR_VERSION}-postgis-$POSTGIS_MAJOR-scripts

# Haproxy
RUN apt-get update && apt-get install --no-install-recommends -y software-properties-common && \
add-apt-repository ppa:vbernat/haproxy-${HAPROXY_VERSION} && \
apt-get update && apt-get install --no-install-recommends -y \
haproxy=$HAPROXY_VERSION.\* \
&& apt autoremove -y && apt clean

# Copy Go binaries from the builder stage
COPY --from=builder /fly/bin/* /usr/local/bin

# Copy Postgres exporter
COPY --from=wrouesnel/postgres_exporter:latest /postgres_exporter /usr/local/bin/

# Move pg_rewind into path.
RUN ln -s /usr/lib/postgresql/${PG_MAJOR_VERSION}/bin/pg_rewind /usr/bin/pg_rewind

ADD /config/* /fly/
RUN mkdir -p /run/haproxy/
RUN usermod -d /data postgres

EXPOSE 5432

CMD ["start"]
Loading
Loading