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
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BASE_IMAGE ?= rockylinux/rockylinux:9
BASEOS ?= rocky9
CONTAINERIMAGE ?= rockylinux/rockylinux:9-ubi-micro
IMAGE_REPOSITORY ?= docker.io
IMAGE_REPOSITORY ?= containers.cybertec.at
IMAGE_PATH ?= cybertec-pg-container
PGVERSION ?= 18
PGVERSION_FULL ?= 18.1
Expand All @@ -14,10 +14,12 @@ POSTGIS_VERSION ?= 36
ETCD_VERSION ?= 3.6.6
PGBOUNCER_VERSION ?= 1.25
PACKAGER ?= dnf
BUILD ?= 1
BUILD ?= 2
ARCH ?= amd64
IMAGE_TAG ?= $(BASEOS)-$(PGVERSION_FULL)-$(BUILD)
POSTGIS_IMAGE_TAG ?= $(BASEOS)-$(PGVERSION_FULL)-$(POSTGIS_VERSION)-$(BUILD)
PGBOUNCER_IMAGE_TAG ?= $(BASEOS)-$(PGBOUNCER_VERSION)-$(BUILD)
REPOSITORY ?= containers.cybertec.at

# Public-Beta
PUBLICBETA ?= 3
Expand All @@ -44,7 +46,7 @@ publicbeta: publicbeta-pg publicbeta-pgbackrest
base-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/base/Dockerfile \
--tag cybertec-pg-container/base:$(BASEOS)-$(BUILD) \
--tag $(IMAGE_PATH)/base:$(BASEOS)-$(BUILD) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
--build-arg BASEOS=$(BASEOS) \
Expand All @@ -56,7 +58,7 @@ base: base-build;
pgbackrest-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/pgbackrest/Dockerfile \
--tag cybertec-pg-container/pgbackrest:$(IMAGE_TAG) \
--tag $(REPOSITORY)/$(IMAGE_PATH)/pgbackrest:$(IMAGE_TAG) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand All @@ -74,7 +76,7 @@ pgbackrest: pgbackrest-build;
postgres-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/postgres/Dockerfile \
--tag cybertec-pg-container/postgres:$(IMAGE_TAG) \
--tag $(REPOSITORY)/$(IMAGE_PATH)/postgres:$(IMAGE_TAG) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand All @@ -94,7 +96,7 @@ postgres: postgres-build
postgres-gis-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/postgres-gis/Dockerfile \
--tag cybertec-pg-container/postgres-gis:$(IMAGE_TAG) \
--tag $(REPOSITORY)/$(IMAGE_PATH)/postgres-gis:$(POSTGIS_IMAGE_TAG) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand All @@ -115,7 +117,7 @@ postgres-gis: postgres-gis-build
postgres-oracle-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/postgres-oracle/Dockerfile \
--tag cybertec-pg-container/postgres-oracle:$(IMAGE_TAG) \
--tag $(REPOSITORY)/$(IMAGE_PATH)/postgres-oracle:$(IMAGE_TAG) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand All @@ -135,7 +137,7 @@ postgres-oracle: postgres-oracle-build
pgbouncer-build:
docker build $(ROOTPATH) --no-cache \
--file $(ROOTPATH)/docker/pgbouncer/Dockerfile \
--tag cybertec-pg-container/pgbouncer:$(IMAGE_TAG) \
--tag $(REPOSITORY)/$(IMAGE_PATH)/pgbouncer:$(PGBOUNCER_IMAGE_TAG) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand All @@ -151,7 +153,7 @@ pgbouncer: pgbouncer-build
exporter-build:
docker build $(ROOTPATH) --no-cache \
--file $(ROOTPATH)/docker/exporter/Dockerfile \
--tag cybertec-pg-container/exporter:$(IMAGE_TAG) \
--tag $(REPOSITORY)/$(IMAGE_PATH)/exporter:$(IMAGE_TAG) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand All @@ -167,7 +169,7 @@ exporter: exporter-build
publicbeta-pg-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/pg-public-beta/Dockerfile \
--tag cybertec-pg-container/postgres:$(IMAGE_TAG)-beta${PUBLICBETA} \
--tag $(REPOSITORY)/$(IMAGE_PATH)/postgres:$(IMAGE_TAG)-beta${PUBLICBETA} \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand All @@ -187,7 +189,7 @@ publicbeta-pg: publicbeta-pg-build
publicbeta-pgbackrest-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/pgbackrest-public-beta/Dockerfile \
--tag cybertec-pg-container/pgbackrest:$(IMAGE_TAG)-beta${PUBLICBETA} \
--tag $(REPOSITORY)/$(IMAGE_PATH)/pgbackrest:$(IMAGE_TAG)-beta${PUBLICBETA} \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
Expand Down
2 changes: 1 addition & 1 deletion docker/exporter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN ${PACKAGER} -y install --nodocs \
make \
&& ${PACKAGER} -y clean all ;

RUN wget https://go.dev/dl/go1.24.4.linux-amd64.tar.gz && tar -xzf go1.24.4.linux-amd64.tar.gz && mv go /usr/local
RUN wget https://go.dev/dl/go1.25.5.linux-amd64.tar.gz && tar -xzf go1.25.5.linux-amd64.tar.gz && mv go /usr/local
ENV PATH=$PATH:/usr/local/go/bin

RUN git clone https://github.com/prometheus-community/postgres_exporter.git && cd postgres_exporter && make build;
Expand Down
6 changes: 5 additions & 1 deletion docker/pgbackrest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ COPY --from=builder /usr/bin/trust /usr/bin/

# libraries
COPY --from=builder /usr/bin/nss_wrapper.pl /usr/bin/nss_wrapper.pl
# COPY --from=builder /usr/lib64/libnss_wrapper.so /usr/lib64/libnss_wrapper.so
COPY --from=builder /usr/lib64/libnss_wrapper.so /usr/lib64/libnss_wrapper.so
COPY --from=builder /usr/share/man/man1 /usr/share/man/man1
COPY --from=builder /usr/bin/envsubst /usr/bin/envsubst

Expand Down Expand Up @@ -161,6 +161,10 @@ VOLUME ["sshd", "/home/postgres/pgdata", "/backrestrepo"]

ENTRYPOINT ["/scripts/nss_wrapper/nss_wrapper.sh"]

ENV LD_PRELOAD=/usr/lib64/libnss_wrapper.so \
NSS_WRAPPER_PASSWD=/tmp/nss_wrapper/passwd \
NSS_WRAPPER_GROUP=/tmp/nss_wrapper/group

USER postgres

CMD ["dumb-init", "/launch.sh", "init"]
11 changes: 5 additions & 6 deletions docker/postgres-gis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
&& git clone -b $PAM_OAUTH2 --recurse-submodules https://github.com/zalando-pg/pam-oauth2.git && make -C pam-oauth2 install \
&& git clone -b $PG_PERMISSIONS https://github.com/cybertec-postgresql/pg_permissions.git \
&& git clone https://github.com/dimitri/pgextwlist.git \
&& git clone https://github.com/crunchydata/pgnodemx \
# && git clone https://github.com/crunchydata/pgnodemx \
\
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 postgresql${PGVERSION} libevent-devel brotli-devel libbrotli \
&& ${PACKAGER} -y clean all \
Expand All @@ -94,7 +94,7 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
# Install PostgreSQL binaries, contrib, plproxy and multiple pl's
&& ${PACKAGER} -y install -y postgresql${version}-contrib \
postgresql${version}-plpython3 postgresql${version}-devel \
pg_cron_${version} pgvector_${version} set_user_${version} \
pg_cron_${version} pgvector_${version} set_user_${version} pgnodemx_${version} \
# Modify for using origial-spilo scripts
&& ln -s /usr/pgsql-${version} /usr/lib/postgresql/${version} \
&& export PATH=$PATHBACKUP:/usr/pgsql-${version}/bin \
Expand All @@ -106,8 +106,8 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
&& for n in pg_permissions $EXTRA_EXTENSIONS; do \
make -C $n USE_PGXS=1 clean install-strip; \
done \
&& cd /pgextwlist && make clean && make && make install \
&& cd /pgnodemx && make USE_PGXS=1 clean && make USE_PGXS=1 && make USE_PGXS=1 install; \
&& cd /pgextwlist && make clean && make && make install; \
# && cd /pgnodemx && make USE_PGXS=1 clean && make USE_PGXS=1 && make USE_PGXS=1 install; \
done \
&& ${PACKAGER} -y install pgbackrest-${PGBACKREST_VERSION} \
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 glibc-static \
Expand Down Expand Up @@ -194,8 +194,7 @@ RUN rm -rf /etc/service && mkdir /home/postgres/pgdata && chown -R postgres:post
&& chgrp -R 0 $PGHOME $RW_DIR \
&& chmod -R g=u $PGHOME $RW_DIR \
&& usermod -a -G root postgres; \
fi

fi

COPY scripts bootstrap major_upgrade /scripts/
COPY launcher/postgres/launch.sh /
Expand Down
11 changes: 5 additions & 6 deletions docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
&& git clone -b $PAM_OAUTH2 --recurse-submodules https://github.com/zalando-pg/pam-oauth2.git && make -C pam-oauth2 install \
&& git clone -b $PG_PERMISSIONS https://github.com/cybertec-postgresql/pg_permissions.git \
&& git clone https://github.com/dimitri/pgextwlist.git \
&& git clone https://github.com/crunchydata/pgnodemx \
# && git clone https://github.com/crunchydata/pgnodemx \
\
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 postgresql${PGVERSION} libevent-devel brotli-devel libbrotli \
&& ${PACKAGER} -y clean all \
Expand All @@ -93,7 +93,7 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
# Install PostgreSQL binaries, contrib, plproxy and multiple pl's
&& ${PACKAGER} -y install -y postgresql${version}-contrib \
postgresql${version}-plpython3 postgresql${version}-devel \
pg_cron_${version} pgvector_${version} set_user_${version} \
pg_cron_${version} pgvector_${version} set_user_${version} pgnodemx_${version} \
# Modify for using origial-spilo scripts
&& ln -s /usr/pgsql-${version} /usr/lib/postgresql/${version} \
&& export PATH=$PATHBACKUP:/usr/pgsql-${version}/bin \
Expand All @@ -103,8 +103,8 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
&& for n in pg_permissions $EXTRA_EXTENSIONS; do \
make -C $n USE_PGXS=1 clean install-strip; \
done \
&& cd /pgextwlist && make clean && make && make install \
&& cd /pgnodemx && make USE_PGXS=1 clean && make USE_PGXS=1 && make USE_PGXS=1 install; \
&& cd /pgextwlist && make clean && make && make install; \
# && cd /pgnodemx && make USE_PGXS=1 clean && make USE_PGXS=1 && make USE_PGXS=1 install; \
done \
&& ${PACKAGER} -y install pgbackrest-${PGBACKREST_VERSION} \
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 glibc-static \
Expand Down Expand Up @@ -191,8 +191,7 @@ RUN rm -rf /etc/service && mkdir /home/postgres/pgdata && chown -R postgres:post
&& chgrp -R 0 $PGHOME $RW_DIR \
&& chmod -R g=u $PGHOME $RW_DIR \
&& usermod -a -G root postgres; \
fi

fi

COPY scripts bootstrap major_upgrade /scripts/
COPY launcher/postgres/launch.sh /
Expand Down
3 changes: 2 additions & 1 deletion scripts/postgres/promote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ done

source "/scripts/postgres/shell_lib.sh"
output_info "pgBackRest: Promote Database because of earlier pgBackRest-Restore."
pg_ctl promote -D ${PGDATA}
DETECTED_VERSION=$(cat "${PGDATA}/PG_VERSION")
/usr/pgsql-${DETECTED_VERSION}/bin/pg_ctl promote -D ${PGDATA}
rm -f "${PGDATA}/promote_after_restore.signal"