Skip to content

Commit 022f94d

Browse files
authored
Merge pull request #42 from cybertec-postgresql/updateExtensions
updated extensions & add public-beta
2 parents 5a79182 + 16f8420 commit 022f94d

File tree

4 files changed

+201
-14
lines changed

4 files changed

+201
-14
lines changed

Makefile

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ ARCH ?= amd64
1818
IMAGE_TAG ?= $(BASEOS)-$(PGVERSION_FULL)-$(BUILD)
1919
POSTGIS_IMAGE_TAG ?= $(BASEOS)-$(PGVERSION_FULL)-$(POSTGIS_VERSION)-$(BUILD)
2020

21+
# Public-Beta
22+
PUBLICBETA ?= 2
23+
BETAVERSION ?= 17
24+
2125
# Settings for the Build-Process
2226
BUILDWITH ?= docker
2327
ROOTPATH ?= $(GOPATH)/src/github.com/cybertec/cybertec-pg-container
@@ -33,9 +37,10 @@ postgres-gis: base postgres-gis
3337
postgres-oracle: base postgres-oracle
3438
pgbouncer: pgbouncer
3539
exporter: exporter
40+
publicbeta: publicbeta
3641

3742
base-build:
38-
docker build $(ROOTPATH) \
43+
docker build $(ROOTPATH) --no-cache \
3944
--file $(ROOTPATH)/docker/base/Dockerfile \
4045
--tag cybertec-pg-container/base:$(BASEOS)-$(BUILD) \
4146
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
@@ -78,7 +83,7 @@ postgres-build:
7883
--build-arg PATRONI_VERSION=$(PATRONI_VERSION) \
7984
--build-arg OLD_PG_VERSIONS="$(OLD_PG_VERSIONS)" \
8085
--build-arg PGVERSION=$(PGVERSION) \
81-
--build-arg ARCH=$(ARCH)
86+
--build-arg ARCH=$(ARCH)
8287

8388
postgres: postgres-build
8489

@@ -168,3 +173,22 @@ exporter-build:
168173
--build-arg PGVERSION=$(PGVERSION)
169174

170175
exporter: exporter-build
176+
177+
publicbeta-build:
178+
docker build $(ROOTPATH) \
179+
--file $(ROOTPATH)/docker/pg-public-beta/Dockerfile \
180+
--tag cybertec-pg-container/postgres:$(IMAGE_TAG)-beta${PUBLICBETA} \
181+
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
182+
--build-arg CONTAINERIMAGE=${CONTAINERIMAGE} \
183+
--build-arg IMAGE_REPOSITORY=$(IMAGE_REPOSITORY) \
184+
--build-arg BASEOS=$(BASEOS) \
185+
--build-arg PACKAGER=$(PACKAGER) \
186+
--build-arg CONTAINERSUITE=$(CONTAINERSUITE) \
187+
--build-arg BUILD=$(BUILD) \
188+
--build-arg PGBACKREST_VERSION=$(PGBACKREST_VERSION) \
189+
--build-arg PATRONI_VERSION=$(PATRONI_VERSION) \
190+
--build-arg OLD_PG_VERSIONS="$(OLD_PG_VERSIONS)" \
191+
--build-arg PGVERSION=$(BETAVERSION) \
192+
--build-arg ARCH=$(ARCH)
193+
194+
publicbeta: publicbeta-build

docker/pg-public-beta/Dockerfile

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
ARG CONTAINERSUITE
2+
ARG BUILD
3+
ARG BASEOS
4+
ARG PGVERSION
5+
6+
FROM ${CONTAINERSUITE}/base:${BASEOS}-${BUILD} as builder
7+
8+
# Dockerfile specific informations
9+
ARG PACKAGER
10+
ARG PGBACKREST_VERSION
11+
ARG PATRONI_VERSION
12+
ARG PGVERSION
13+
ARG OLD_PG_VERSIONS
14+
ARG PG_SUPPORTED_VERSIONS="$PGVERSION"
15+
ARG PG_SUPPORTED_VERSIONS="$OLD_PG_VERSIONS $PGVERSION"
16+
ARG ARCH
17+
18+
# Enable Beta-Repo
19+
RUN ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-updates-testing \
20+
&& ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-source-updates-testing;
21+
22+
# Get some Standard-Stuff
23+
RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 \
24+
--setopt=skip_missing_names_on_install=False \
25+
openssh-clients \
26+
openssh-server \
27+
shadow-utils \
28+
tar \
29+
bzip2 \
30+
lz4 \
31+
python3 \
32+
python3-pip \
33+
python3-psycopg2 \
34+
git \
35+
patchutils \
36+
binutils \
37+
make \
38+
cmake \
39+
gcc \
40+
pam-devel \
41+
wget \
42+
mlocate \
43+
git-clang-format \
44+
openssl-devel \
45+
ccache \
46+
redhat-rpm-config \
47+
krb5-devel \
48+
busybox \
49+
jq \
50+
rsync \
51+
dumb-init \
52+
libicu \
53+
pgbackrest-${PGBACKREST_VERSION} \
54+
&& ${PACKAGER} -y clean all;
55+
56+
# install etcdctl
57+
RUN ETCDVERSION=3.5.1 \
58+
&& curl -L https://github.com/coreos/etcd/releases/download/v${ETCDVERSION}/etcd-v${ETCDVERSION}-linux-${ARCH}.tar.gz | tar xz -C /bin --strip=1 --wildcards --no-anchored --no-same-owner etcdctl etcd;
59+
60+
ENV PATHBACKUP = $PATH
61+
62+
RUN wget https://smarden.org/runit/runit-2.1.2.tar.gz -P /package/
63+
64+
RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python-etcd psutil requests cdiff ydiff --upgrade \
65+
&& pip3 install patroni[kubernetes$EXTRAS]==$PATRONI_VERSION --upgrade \
66+
&& mkdir /usr/lib/postgresql \
67+
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 postgresql${PGVERSION} libevent-devel brotli-devel libbrotli \
68+
&& ${PACKAGER} -y clean all \
69+
\
70+
# Install PostgreSQL
71+
&& for version in $PG_SUPPORTED_VERSIONS; do \
72+
${PACKAGER} -y update && \
73+
${PACKAGER} -y install postgresql${version}-pltcl \
74+
# Install PostgreSQL binaries, contrib, plproxy and multiple pl's
75+
&& ${PACKAGER} -y install -y postgresql${version}-contrib \
76+
postgresql${version}-devel \
77+
\
78+
# Modify for using origial-spilo scripts
79+
&& ln -s /usr/pgsql-${version} /usr/lib/postgresql/${version} \
80+
&& export PATH=$PATHBACKUP:/usr/pgsql-${version}/bin; \
81+
done \
82+
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 glibc-static \
83+
&& ${PACKAGER} -y clean all;
84+
85+
RUN cd /package && tar -xvzf runit-2.1.2.tar.gz && rm runit-2.1.2.tar.gz \
86+
&& cd admin/runit-2.1.2 && package/install \
87+
&& ln -s /usr/local/bin/runsvdir /usr/bin/runsvdir \
88+
&& rm -rf /pg_permissions* /pgextwlist /pg_stat_kcache /pgnodemx /timescaledb /set_user /pam-oauth2 \
89+
&& rm /etc/pgbackrest.conf && rm -rf /var/spool/pgbackrest \
90+
&& ${PACKAGER} -y remove $(rpm -qa "*devel*") python3-pip python3-wheel python3-dev python3-setuptools git patchutils flatpak glibc-static gcc glibc-devel \
91+
&& ${PACKAGER} -y autoremove \
92+
&& ${PACKAGER} -y clean dbcache \
93+
&& ${PACKAGER} -y clean all;
94+
95+
FROM scratch
96+
97+
ARG PGVERSION
98+
99+
COPY --from=builder / /
100+
101+
EXPOSE 5432 8008 8080
102+
ENV LC_ALL=en_US.utf-8 \
103+
PATH=$PATH:/usr/pgsql-$PGVERSION/bin \
104+
PGHOME=/home/postgres \
105+
RW_DIR=/run \
106+
TIMESCALEDB=$TIMESCALEDB \
107+
DEMO=$DEMO
108+
109+
ENV LOG_ENV_DIR=$RW_DIR/etc/log.d/env \
110+
PGROOT=$PGHOME/pgdata/pgroot
111+
112+
ENV PGDATA=$PGROOT/data \
113+
PGLOG=$PGROOT/pg_log
114+
115+
WORKDIR $PGHOME
116+
117+
COPY motd /etc/
118+
#COPY runit /etc/service/
119+
120+
COPY runit /etc/runit/runsvdir/default/
121+
COPY pgq_ticker.ini $PGHOME/
122+
RUN rm -rf /etc/service && mkdir /home/postgres/pgdata && chown -R postgres:postgres /home/postgres/pgdata && chmod -R g=u /home/postgres/pgdata \
123+
&& sed -i "s|/var/lib/pgsql.*|$PGHOME:/bin/bash|" /etc/passwd \
124+
&& chown -R postgres:postgres $PGHOME $PGHOME/pgdata $RW_DIR \
125+
&& rm -fr /var/spool/cron /var/tmp \
126+
&& mkdir -p /var/spool \
127+
&& ln -s $RW_DIR/cron /var/spool/cron \
128+
&& ln -s $RW_DIR/tmp /var/tmp \
129+
&& for d in /etc/runit/runsvdir/default/*; do \
130+
chmod 755 $d/* \
131+
&& ln -s /run/supervise/$(basename $d) $d/supervise; \
132+
done \
133+
&& ln -snf $RW_DIR/service /etc/service \
134+
#&& ln -s $RW_DIR/pam.d-postgresql /etc/pam.d/postgresql \
135+
&& ln -s $RW_DIR/postgres.yml $PGHOME/postgres.yml \
136+
&& ln -s $RW_DIR/.bash_history /root/.bash_history \
137+
&& ln -s $RW_DIR/postgresql/.bash_history $PGHOME/.bash_history \
138+
&& ln -s $RW_DIR/postgresql/.psql_history $PGHOME/.psql_history \
139+
&& ln -s $RW_DIR/etc $PGHOME/etc \
140+
&& for d in $PGHOME /root; do \
141+
d=$d/.config/patroni \
142+
&& mkdir -p $d \
143+
&& ln -s $PGHOME/postgres.yml $d/patronictl.yaml; \
144+
done \
145+
&& sed -i 's/set compatible/set nocompatible/' /etc/vimrc \
146+
&& echo "PATH=\"$PATH\"" > /etc/environment \
147+
&& for e in TERM=linux LC_ALL=C.UTF-8 LANG=C.UTF-8 EDITOR=editor; \
148+
do echo "export $e" >> /etc/bash.bashrc; \
149+
done \
150+
&& ln -s /etc/skel/.bashrc $PGHOME/.bashrc \
151+
&& echo "source /etc/motd" >> /root/.bashrc \
152+
# Allow users in the root group to access the following files and dirs
153+
&& if [ "$COMPRESS" != "true" ]; then \
154+
chmod 664 /etc/passwd \
155+
&& chmod o+r /etc/shadow \
156+
&& chgrp -R 0 $PGHOME $RW_DIR \
157+
&& chmod -R g=u $PGHOME $RW_DIR \
158+
&& usermod -a -G root postgres; \
159+
fi
160+
161+
162+
COPY scripts bootstrap major_upgrade /scripts/
163+
COPY launcher/postgres/launch.sh /
164+
165+
ENTRYPOINT ["/scripts/nss_wrapper/nss_wrapper.sh"]
166+
167+
USER 26
168+
169+
CMD ["/bin/sh", "/launch.sh", "init"]

docker/postgres/Dockerfile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ ARG TIMESCALEDB="1.7.5 2.3.1 2.13.0"
1717
ARG ARCH
1818

1919
# Spilo-specific
20-
ENV SET_USER=REL3_0_0 \
21-
PLPROFILER=REL4_1 \
22-
PG_PROFILE=0.3.6 \
20+
ENV SET_USER=REL4_0_1 \
2321
PAM_OAUTH2=v1.0.1 \
22+
PG_PERMISSIONS=REL_1_3 \
2423
PLANTUNER_COMMIT=800d81bc85da64ff3ef66e12aed1d4e1e54fc006 \
25-
PG_PERMISSIONS_COMMIT=314b9359e3d77c0b2ef7dbbde97fa4be80e31925 \
2624
PG_TM_AUX_COMMIT=6c012d38a4c1b0ba4a36952d60b0ce3a22ac9c3d
2725

2826
# Get some Standard-Stuff
@@ -76,15 +74,11 @@ RUN wget https://smarden.org/runit/runit-2.1.2.tar.gz -P /package/
7674
RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python-etcd psutil requests cdiff ydiff --upgrade \
7775
&& pip3 install patroni[kubernetes$EXTRAS]==$PATRONI_VERSION --upgrade \
7876
&& mkdir /usr/lib/postgresql \
79-
&& curl -sL https://github.com/cybertec-postgresql/pg_permissions/archive/$PG_PERMISSIONS_COMMIT.tar.gz | tar xz \
80-
#&& curl -sL https://github.com/x4m/pg_tm_aux/archive/$PG_TM_AUX_COMMIT.tar.gz | tar xz \
81-
#&& curl -sL https://github.com/zubkov-andrei/pg_profile/archive/$PG_PROFILE.tar.gz | tar xz \
77+
&& git clone -b $PG_PERMISSIONS https://github.com/cybertec-postgresql/pg_permissions.git \
8278
&& git clone -b $SET_USER https://github.com/pgaudit/set_user.git \
8379
&& git clone https://github.com/timescale/timescaledb.git \
8480
#&& git clone https://github.com/dimitri/pgextwlist.git \
85-
#&& git clone https://github.com/powa-team/pg_stat_kcache.git \
8681
&& git clone https://github.com/crunchydata/pgnodemx \
87-
#&& git clone https://github.com/pgq/pgqd.git \
8882
\
8983
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 postgresql${PGVERSION} libevent-devel brotli-devel libbrotli \
9084
&& ${PACKAGER} -y clean all \
@@ -121,7 +115,7 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
121115
&& git clean -f -d; \
122116
done \
123117
&& cd .. \
124-
&& for n in set_user pg_permissions-${PG_PERMISSIONS_COMMIT} $EXTRA_EXTENSIONS; do \
118+
&& for n in set_user pg_permissions $EXTRA_EXTENSIONS; do \
125119
#pg_profile-${PG_PROFILE} pg_tm_aux-${PG_TM_AUX_COMMIT} bg_mon-${BG_MON_COMMIT} pg_auth_mon-${PG_AUTH_MON_COMMIT}
126120
make -C $n USE_PGXS=1 clean install-strip; \
127121
done \
@@ -136,7 +130,7 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
136130
RUN cd /package && tar -xvzf runit-2.1.2.tar.gz && rm runit-2.1.2.tar.gz \
137131
&& cd admin/runit-2.1.2 && package/install \
138132
&& ln -s /usr/local/bin/runsvdir /usr/bin/runsvdir \
139-
&& rm -rf /pg_permissions* /pgextwlist /pg_stat_kcache /pgnodemx /timescaledb /set_user /pam-oauth2 \
133+
&& rm -rf /pg_permissions /pgextwlist /pg_stat_kcache /pgnodemx /timescaledb /set_user /pam-oauth2 \
140134
&& rm /etc/pgbackrest.conf && rm -rf /var/spool/pgbackrest \
141135
&& ${PACKAGER} -y remove $(rpm -qa "*devel*") python3-pip python3-wheel python3-dev python3-setuptools git patchutils flatpak glibc-static gcc glibc-devel \
142136
&& ${PACKAGER} -y autoremove \

scripts/configure_spilo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def deep_update(a, b):
309309
{{/SSL_CRL_FILE}}
310310
ssl_cert_file: {{SSL_CERTIFICATE_FILE}}
311311
ssl_key_file: {{SSL_PRIVATE_KEY_FILE}}
312-
shared_preload_libraries: 'pg_stat_statements,set_user'
312+
shared_preload_libraries: 'pg_stat_statements'
313313
pg_stat_statements.track_utility: 'off'
314314
extwlist.extensions: 'btree_gin,btree_gist,citext,extra_window_functions,first_last_agg,hll,\
315315
hstore,hypopg,intarray,ltree,pgcrypto,pgq,pgq_node,pg_trgm,postgres_fdw,tablefunc,uuid-ossp'

0 commit comments

Comments
 (0)