-
Notifications
You must be signed in to change notification settings - Fork 76
PG16 Support #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
PG16 Support #233
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5de4982
Allow PG16 to be built with its own dockerfile
davissp14 6c9673a
This will need more testing
davissp14 c2cd48c
Don't bump haproxy version here
davissp14 4793c61
Install python3-setuptools to get distutils module needed by barman.
ndarilek 079824f
Merge branch 'master' into pg-16-support
ndarilek b042097
Integrate flexctl.
ndarilek 32a0897
Inject AWS shared credentials file into environment.
ndarilek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
ARG PG_VERSION=16.3 | ||
ARG PG_MAJOR_VERSION=16 | ||
ARG VERSION=custom | ||
|
||
FROM golang:1.20 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 | ||
|
||
ENV PGDATA=/data/postgresql | ||
ENV PGPASSFILE=/data/.pgpass | ||
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials | ||
ARG VERSION | ||
ARG PG_MAJOR_VERSION | ||
ARG POSTGIS_MAJOR=3 | ||
ARG HAPROXY_VERSION=2.8 | ||
ARG REPMGR_VERSION=5.4.1-1build2 | ||
|
||
LABEL fly.app_role=postgres_cluster | ||
LABEL fly.version=${VERSION} | ||
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 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} | ||
|
||
# Repmgr | ||
RUN curl -L http://launchpadlibrarian.net/722514158/postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb -o postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb && \ | ||
apt-get install -y ./postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb \ | ||
&& rm ./postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb | ||
|
||
# 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 \ | ||
haproxy=$HAPROXY_VERSION.\* \ | ||
&& apt autoremove -y && apt clean | ||
|
||
|
||
# Add PostgreSQL bin directory to PATH | ||
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH" | ||
|
||
# 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/ | ||
|
||
ADD /config/* /fly/ | ||
RUN mkdir -p /run/haproxy/ | ||
RUN usermod -d /data postgres | ||
|
||
EXPOSE 5432 | ||
|
||
CMD ["start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
ARG PG_VERSION=16.3 | ||
ARG PG_MAJOR_VERSION=16 | ||
ARG VERSION=custom | ||
|
||
FROM golang:1.20 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 | ||
|
||
ENV PGDATA=/data/postgresql | ||
ENV PGPASSFILE=/data/.pgpass | ||
ENV AWS_SHARED_CREDENTIALS_FILE=/data/.aws/credentials | ||
ARG VERSION | ||
ARG PG_MAJOR_VERSION | ||
ARG POSTGIS_MAJOR=3 | ||
ARG HAPROXY_VERSION=2.8 | ||
ARG REPMGR_VERSION=5.4.1-1build2 | ||
|
||
LABEL fly.app_role=postgres_cluster | ||
LABEL fly.version=${VERSION} | ||
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 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} | ||
|
||
# Repmgr | ||
RUN curl -L http://launchpadlibrarian.net/722514158/postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb -o postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb && \ | ||
apt-get install -y ./postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb \ | ||
&& rm ./postgresql-${PG_MAJOR_VERSION}-repmgr_${REPMGR_VERSION}_amd64.deb | ||
|
||
|
||
# TimescaleDB and PostGIS | ||
RUN echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ jammy main" > /etc/apt/sources.list.d/timescaledb.list \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Timescale isn't compatible with noble yet... While jammy seems to work, some additional testing is needed. Related: |
||
&& curl -L https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add - | ||
|
||
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 \ | ||
timescaledb-2-postgresql-$PG_MAJOR_VERSION \ | ||
&& apt autoremove -y && apt clean | ||
|
||
# Haproxy | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
haproxy=$HAPROXY_VERSION.\* \ | ||
&& apt autoremove -y && apt clean | ||
|
||
|
||
# Add PostgreSQL bin directory to PATH | ||
ENV PATH="/usr/lib/postgresql/${PG_MAJOR_VERSION}/bin:$PATH" | ||
|
||
# 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/ | ||
|
||
ADD /config/* /fly/ | ||
RUN mkdir -p /run/haproxy/ | ||
RUN usermod -d /data postgres | ||
|
||
ENV TIMESCALEDB_ENABLED=true | ||
|
||
EXPOSE 5432 | ||
|
||
CMD ["start"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this also cover arm64? This is mainly for building an image on Mac for local testing 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are you testing locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm testing the building of the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're just testing the build process you can specify the platform.
E.G.
docker build . --platform linux/amd64