Skip to content
Open
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
72 changes: 36 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Using --build-arg PGVERSION=14 we can build pg_auto_failover for any
# Using --build-arg PGVERSION=17 we can build pg_auto_failover for any
# target version of Postgres. In the Makefile, we use that to our advantage
# and tag test images such as pg_auto_failover_test:pg14.
#
Expand All @@ -10,15 +10,25 @@ ARG PGVERSION=17
#
# This base image contains all our target Postgres versions.
#
FROM debian:bullseye-slim AS base
FROM debian:bookworm-slim AS base

ARG PGVERSION

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
postgresql-common

RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list

# bypass initdb of a "main" cluster
RUN echo 'create_main_cluster = false' >> /etc/postgresql-common/createcluster.conf

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
gnupg \
git \
gawk \
Expand Down Expand Up @@ -60,21 +70,11 @@ RUN apt-get update \
less \
mg \
valgrind \
postgresql-common \
&& rm -rf /var/lib/apt/lists/*
postgresql-server-dev-${PGVERSION} \
postgresql-${PGVERSION} \
&& rm -rf /var/lib/apt/lists/*

RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list

# bypass initdb of a "main" cluster
RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
postgresql-server-dev-${PGVERSION} \
postgresql-${PGVERSION} \
&& rm -rf /var/lib/apt/lists/*

RUN pip3 install pyroute2>=0.5.17
RUN pip3 install --break-system-packages pyroute2>=0.5.17

RUN adduser --disabled-password --gecos '' docker
RUN adduser docker sudo
Expand Down Expand Up @@ -136,38 +136,38 @@ ENV PATH /usr/lib/postgresql/${PGVERSION}/bin:/usr/local/sbin:/usr/local/bin:/us
#
# And finally our "run" images with the bare minimum for run-time.
#
FROM debian:bullseye-slim AS run
FROM debian:bookworm-slim AS run

ARG PGVERSION

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
curl \
postgresql-common

RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list

# bypass initdb of a "main" cluster
RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
gnupg \
make \
sudo \
tmux \
watch \
watch \
libncurses6 \
lsof \
psutils \
dnsutils \
bind9-host \
libcurl4-gnutls-dev \
libcurl4-gnutls-dev \
libzstd-dev \
postgresql-common \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*

RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list

# bypass initdb of a "main" cluster
RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf
RUN apt-get update\
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-${PGVERSION} \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

RUN adduser --disabled-password --gecos '' --home /var/lib/postgres docker
RUN adduser docker sudo
Expand All @@ -189,7 +189,7 @@ COPY --from=build /usr/lib/postgresql/${PGVERSION}/bin/pg_autoctl /usr/local/bin
# pg_autoctl has the necessary set of privileges.
#
RUN mkdir -p /var/lib/postgres \
&& chown -R docker /var/lib/postgres
&& chown -R docker /var/lib/postgres

USER docker
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/${PGVERSION}/bin
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.docs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bullseye-slim
FROM debian:bookworm-slim

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand All @@ -18,7 +18,7 @@ RUN apt-get update \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*

RUN pip3 install sphinx_rtd_theme
RUN pip3 install --break-system-packages sphinx_rtd_theme

WORKDIR /usr/src/pg_auto_failover

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ To avoid debian creating a default Postgres data directory and service,
follow these steps before installing the previous packages.

```bash
$ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
$ echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ apt install curl ca-certificates
$ install -d /usr/share/postgresql-common/pgdg
$ curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
$ echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list

# bypass initdb of a "main" cluster
$ echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf
Expand Down
12 changes: 6 additions & 6 deletions docs/citus/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:bullseye-slim
FROM debian:bookworm-slim

ARG PGVERSION=14
ARG CITUS=postgresql-14-citus-11.1
ARG PGVERSION=17
ARG CITUS=postgresql-17-citus-13.0

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -19,9 +19,9 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# we use apt.postgresql.org
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list

# bypass initdb of a "main" cluster
RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf
Expand Down
11 changes: 6 additions & 5 deletions docs/citus/Dockerfile.app
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM debian:bullseye-slim
FROM debian:bookworm-slim

ARG PGVERSION=14
ARG PGVERSION=17

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -17,9 +17,10 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# we use apt.postgresql.org
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list
RUN install -d /usr/share/postgresql-common/pgdg
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand Down
12 changes: 7 additions & 5 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ debian package, follow those steps:

::

$ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
$ echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ apt install curl ca-certificates
$ install -d /usr/share/postgresql-common/pgdg
$ curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
$ echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list

# bypass initdb of a "main" cluster
$ echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf
Expand Down Expand Up @@ -116,12 +118,12 @@ install`.

For this to work please consider adding both the binary and the source
repositories to your debian distribution by using the following apt sources,
as an example targetting the debian bullseye distribution:
as an example targetting the debian bookworm distribution:

::

deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main
deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main
deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main
deb-src https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main

Then we can install the build dependencies for Postgres, knowing that
pg_auto_failover uses the same build dependencies:
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorial/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:bullseye-slim
FROM debian:bookworm-slim

ARG PGVERSION=14
ARG CITUS=postgresql-14-citus-11.1
ARG PGVERSION=17
ARG CITUS=postgresql-17-citus-13.0

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -19,9 +19,9 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# we use apt.postgresql.org
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list

# bypass initdb of a "main" cluster
RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf
Expand Down
11 changes: 6 additions & 5 deletions docs/tutorial/Dockerfile.app
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM debian:bullseye-slim
FROM debian:bookworm-slim

ARG PGVERSION=14
ARG PGVERSION=17

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -17,9 +17,10 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# we use apt.postgresql.org
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list
RUN install -d /usr/share/postgresql-common/pgdg
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list
RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand Down
6 changes: 3 additions & 3 deletions src/bin/pg_autoctl/cli_do_tmux_compose.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,13 @@ tmux_compose_docker_build(TmuxOptions *options)
if (!get_env_copy("PGVERSION", pgversion, sizeof(pgversion)))
{
/* errors have already been logged */
log_warn("Using PGVERSION=14");
strlcpy(pgversion, "14", sizeof(pgversion));
log_warn("Using PGVERSION=17");
strlcpy(pgversion, "17", sizeof(pgversion));
}
}
else
{
strlcpy(pgversion, "14", sizeof(pgversion));
strlcpy(pgversion, "17", sizeof(pgversion));
}

/* prepare Postgres/Citus compatibility matrix */
Expand Down
2 changes: 1 addition & 1 deletion tests/tablespaces/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG PGVERSION=14

FROM pg_auto_failover_test:pg${PGVERSION} as test
FROM pg_auto_failover_test:pg${PGVERSION} AS test

USER root
RUN mkdir -p /extra_volumes/extended_a && chown -R docker /extra_volumes/extended_a
Expand Down
Loading