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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# exclude some folders
docker/postgres-stage
docker/postgres-oracle
docker/newpg
docker/benchmark
103 changes: 78 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

# Define Default if Values not exist
BASE_IMAGE ?= rockylinux:9-minimal
BASE_IMAGE ?= rockylinux:9.1-minimal
BASEOS ?= rocky9
IMAGE_REPOSITORY ?= docker.io
IMAGE_PATH ?= cybertec-os-container
PG_MAJOR ?= 15
PG_VERSION ?= 15.0
OLD_PG_VERSIONS ?= 10 11 12 13 14
PATRONI_VERSION ?= 2.1.4
PGBACKREST_VERSION ?= 2.41
POSTGIS_VERSION ?= 3.2
IMAGE_PATH ?= cybertec-pg-container
PGVERSION ?= 15
PGVERSION_FULL ?= 15.2
OLD_PG_VERSIONS ?= 11 12 13 14
PATRONI_VERSION ?= 3.0.1
PGBACKREST_VERSION ?= 2.44
POSTGIS_VERSION ?= 33
PACKAGER ?= dnf
BUILD ?= 0
IMAGE_TAG ?= $(BASEOS)-$(PG_VERSION)-$(BUILD)
POSTGIS_IMAGE_TAG ?= $(BASEOS)-$(PG_VERSION)-$(POSTGIS_VERSION)-$(BUILD)
BUILD ?= 1
IMAGE_TAG ?= $(BASEOS)-$(PGVERSION_FULL)-$(BUILD)
POSTGIS_IMAGE_TAG ?= $(BASEOS)-$(PGVERSION_FULL)-$(POSTGIS_VERSION)-$(BUILD)

# Settings for the Build-Process
BUILDWITH ?= docker
ROOTPATH = $(GOPATH)/src/github.com/cybertec/cybertec-os-container
ROOTPATH = $(GOPATH)/src/github.com/cybertec/cybertec-pg-container
ifndef ROOTPATH
export ROOTPATH=$(GOPATH)/src/github.com/cybertec/cybertec-os-container
export ROOTPATH=$(GOPATH)/src/github.com/cybertec/cybertec-pg-container
endif

# Build Images
Expand All @@ -28,12 +28,15 @@ all: base pgbackrest postgres
base: base
pgbackrest: pgbackrest
postgres: base postgres
postgres-stage: postgres-stage
postgres-stage: base postgres-stage
postgres-gis: base postgres-gis
postgres-oracle: base postgres-oracle
exporter: exporter

base-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/base/Dockerfile \
--tag cybertec-os-container/base:0.0.$(BUILD) \
--tag cybertec-pg-container/base:$(BASEOS)-$(BUILD) \
--build-arg BASE_IMAGE \
--build-arg IMAGE_REPOSITORY \
--build-arg BASEOS \
Expand All @@ -44,22 +47,22 @@ base: base-build;
pgbackrest-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/pgbackrest/Dockerfile \
--tag cybertec-os-container/pgbackrest:0.0.$(BUILD) \
--tag cybertec-pg-container/pgbackrest:$(IMAGE_TAG)-$(BUILD) \
--build-arg BASE_IMAGE \
--build-arg IMAGE_REPOSITORY \
--build-arg BASEOS \
--build-arg PACKAGER \
--build-arg CONTAINERSUITE \
--build-arg BUILD \
--build-arg PGBACKREST_VERSION \
--build-arg PG_MAJOR
--build-arg PGVERSION

pgbackrest: pgbackrest-build;

postgres-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/postgres/Dockerfile \
--tag cybertec-os-container/postgres:$(PG_MAJOR).0.$(BUILD) \
--tag cybertec-pg-container/postgres:$(IMAGE_TAG)-$(BETA)$(BUILD) \
--build-arg BASE_IMAGE \
--build-arg IMAGE_REPOSITORY \
--build-arg BASEOS \
Expand All @@ -68,16 +71,67 @@ postgres-build:
--build-arg BUILD \
--build-arg PATRONI_VERSION \
--build-arg PGBACKREST_VERSION \
--build-arg PG_VERSION \
--build-arg OLD_PG_VERSIONS \
--build-arg PG_MAJOR
--build-arg PGVERSION

postgres: postgres-build

postgres-stage-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/postgres_stage/Dockerfile \
--tag cybertec-os-container/postgres-stage:$(PG_MAJOR).0.$(BUILD) \
--file $(ROOTPATH)/docker/postgres-stage/Dockerfile \
--tag cybertec-pg-container/postgres-stage:$(PGVERSION_FULL)-$(BETA)$(BUILD) \
--build-arg BASE_IMAGE \
--build-arg IMAGE_REPOSITORY \
--build-arg BASEOS \
--build-arg PACKAGER \
--build-arg CONTAINERSUITE \
--build-arg BUILD \
--build-arg PATRONI_VERSION \
--build-arg PGBACKREST_VERSION \
--build-arg OLD_PG_VERSIONS \
--build-arg PGVERSION

postgres-stage: postgres-stage-build

postgres-gis-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/postgres-gis/Dockerfile \
--tag cybertec-pg-container/postgres-gis:$(IMAGE_TAG)-$(BETA)$(BUILD) \
--build-arg BASE_IMAGE \
--build-arg IMAGE_REPOSITORY \
--build-arg BASEOS \
--build-arg PACKAGER \
--build-arg CONTAINERSUITE \
--build-arg BUILD \
--build-arg PATRONI_VERSION \
--build-arg PGBACKREST_VERSION \
--build-arg OLD_PG_VERSIONS \
--build-arg PGVERSION \
--build-arg POSTGIS_VERSION

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)-$(BETA)$(BUILD) \
--build-arg BASE_IMAGE \
--build-arg IMAGE_REPOSITORY \
--build-arg BASEOS \
--build-arg PACKAGER \
--build-arg CONTAINERSUITE \
--build-arg BUILD \
--build-arg PATRONI_VERSION \
--build-arg PGBACKREST_VERSION \
--build-arg OLD_PG_VERSIONS \
--build-arg PGVERSION

postgres-oracle: postgres-oracle-build

exporter-build:
docker build $(ROOTPATH) \
--file $(ROOTPATH)/docker/exporter/Dockerfile \
--tag cybertec-pg-container/exporter:0.1.$(BUILD) \
--build-arg BASE_IMAGE \
--build-arg IMAGE_REPOSITORY \
--build-arg BASEOS \
Expand All @@ -86,8 +140,7 @@ postgres-stage-build:
--build-arg BUILD \
--build-arg PATRONI_VERSION \
--build-arg PGBACKREST_VERSION \
--build-arg PG_VERSION \
--build-arg OLD_PG_VERSION \
--build-arg PG_MAJOR
--build-arg PGVERSION

postgres-stage: postgres-stage-build
exporter: exporter-build
11 changes: 7 additions & 4 deletions docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MAINTAINER CYBERTEC PostgreSQL International GmbH
LABEL vendor="CYBERTEC PostgreSQL International GmbH" url="https://www.cybertec-postgresql.com"
LABEL maintainer="Matthias Groemmer <[email protected]>"

#RUN microdnf -y install ${PACKAGER}
#RUN microdnf -y --nodocs --noplugins --setopt=install_weak_deps=0 install ${PACKAGER}

RUN ${PACKAGER} -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm vim && ${PACKAGER} -y upgrade
RUN ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm vim && ${PACKAGER} -y upgrade

RUN ${PACKAGER} -y install --nodocs \
RUN ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 \
bind-utils \
gettext \
hostname \
Expand All @@ -26,10 +26,13 @@ RUN ${PACKAGER} -y install --nodocs \
openssl \
vim \
glibc-langpack-en \
#config-manager \
&& ${PACKAGER} -y clean all ;

#Enable CRB-Repo (Powertools)
#RUN ${PACKAGER} -y config-manager --set-enabled crb
#Add PostgreSQL-Repo to Base
RUN ${PACKAGER} install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm && ${PACKAGER} -y update && ${PACKAGER} -y clean all
RUN ${PACKAGER} --nodocs --noplugins --setopt=install_weak_deps=0 install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm && ${PACKAGER} -y update && ${PACKAGER} -y clean all
#RUN dnf -qy module disable postgresql


Expand Down
30 changes: 10 additions & 20 deletions docker/benchmark/Dockerfile → docker/exporter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,29 @@ ARG PG_MAJOR

RUN if [ "$BASEOS" = "ubi8" ] ; then \
${PACKAGER} -y install --nodocs \
openssh-clients \
openssh-server \
shadow-utils \
tar \
bzip2 \
lz4 \
#crunchy-backrest-${BACKREST_VER} \
&& ${PACKAGER} -y clean all ; \
else \
${PACKAGER} -y install --nodocs \
--setopt=skip_missing_names_on_install=False \
openssh-clients \
openssh-server \
bzip2 \
lz4 \
postgresql${PG_MAJOR}-server \

nano \
git \
go \
dumb-init \
&& ${PACKAGER} -y clean all ; \
fi

RUN git clone https://github.com/prometheus-community/postgres_exporter.git && cd postgres_exporter && make build
COPY launcher/exporter/launch.sh /
COPY scripts/exporter/queries/ /postgres_exporter/queries

# add benbchmark files
#ADD scripts/benchmark/ /opt/benchmark/bin/
ENTRYPOINT ["/usr/bin/dumb-init", "--"]

# set user and group ownership
R#UN chown -R postgres:postgres /opt/benchmark

#COPY launcher/benchmark/launch.sh /

USER 26

#ENTRYPOINT ["/opt/pgbackrest/bin/uid_postgres.sh"]

#CMD ["/opt/pgbackrest/bin/start.sh"]

#CMD ["/bin/sh", "/launch.sh", "init"]
CMD ["/bin/sh", "/launch.sh", "init"]
#CMD ["/bin/sh", "/scripts/postgres/promote.sh"]
10 changes: 5 additions & 5 deletions docker/pgbackrest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG CONTAINERSUITE
ARG BUILD
ARG BASEOS

FROM ${CONTAINERSUITE}/base:0.0.${BUILD}
FROM ${CONTAINERSUITE}/base:${BASEOS}-${BUILD}

# Dockerfile specific informations
ARG PACKAGER
ARG BASEOS
ARG PGBACKREST_VERSION
ARG PG_MAJOR
ARG PGVERSION

RUN if [ "$BASEOS" = "ubi8" ] ; then \
${PACKAGER} -y install --nodocs \
Expand All @@ -26,7 +26,7 @@ else \
openssh-server \
bzip2 \
lz4 \
postgresql${PG_MAJOR}-server \
postgresql${PGVERSION}-server \
pgbackrest-${PGBACKREST_VERSION} \
nano \
&& ${PACKAGER} -y clean all ; \
Expand Down Expand Up @@ -67,7 +67,7 @@ RUN curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl && chmod
RUN chown -R postgres:postgres /opt/pgbackrest \
/backrestrepo /home/postgres/pgdata

ENV PATH=$PATH:/usr/pgsql-$PG_MAJOR/bin
ENV PATH=$PATH:/usr/pgsql-$PGVERSION/bin
COPY launcher/pgbackrest/launch.sh /

VOLUME ["sshd", "/home/postgres/pgdata", "/backrestrepo"]
Expand Down
Loading