@@ -18,7 +18,11 @@ ARG ARCH
18
18
19
19
# Enable Beta-Repo
20
20
RUN ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-updates-testing \
21
- && ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-source-updates-testing;
21
+ && ${PACKAGER} config-manager --set-enabled pgdg${PGVERSION}-updates-testing-source;
22
+
23
+ # Spilo-specific
24
+ ENV PAM_OAUTH2=v1.0.1 \
25
+ PG_PERMISSIONS=REL_1_3
22
26
23
27
# Get some Standard-Stuff
24
28
RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 \
@@ -33,12 +37,12 @@ RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setop
33
37
python3-pip \
34
38
python3-psycopg2 \
35
39
git \
36
- clang \
37
40
patchutils \
38
41
binutils \
39
42
make \
40
43
cmake \
41
44
gcc \
45
+ clang \
42
46
pam-devel \
43
47
wget \
44
48
mlocate \
@@ -53,6 +57,8 @@ RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setop
53
57
dumb-init \
54
58
libicu \
55
59
pgbackrest-${PGBACKREST_VERSION} \
60
+ cronie \
61
+ libcurl-devel \
56
62
&& ${PACKAGER} -y clean all;
57
63
58
64
# install etcdctl
@@ -61,12 +67,27 @@ RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/et
61
67
ENV PATHBACKUP = $PATH
62
68
63
69
RUN wget https://smarden.org/runit/runit-2.1.2.tar.gz -P /package/
64
-
65
- RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python-etcd psutil requests cdiff ydiff --upgrade \
66
- && pip3 install patroni[kubernetes$EXTRAS]==$PATRONI_VERSION --upgrade \
70
+ COPY cron_unprivileged.c /package/
71
+
72
+ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python-etcd psutil requests cdiff ydiff==1.4.2 --upgrade \
73
+ && if [[ $PATRONI_VERSION == "multisite-" * ]]; then \
74
+ git clone -b $PATRONI_VERSION https://github.com/cybertec-postgresql/patroni; \
75
+ pip3 install ./patroni[kubernetes,etcd,etcd3]; \
76
+ else \
77
+ pip3 install patroni[kubernetes$EXTRAS]==$PATRONI_VERSION --upgrade; \
78
+ fi \
67
79
&& mkdir /usr/lib/postgresql \
80
+ # Install pam_oauth2.so
81
+ && git clone -b $PAM_OAUTH2 --recurse-submodules https://github.com/zalando-pg/pam-oauth2.git && make -C pam-oauth2 install \
82
+ && git clone -b $PG_PERMISSIONS https://github.com/cybertec-postgresql/pg_permissions.git \
83
+ && git clone https://github.com/dimitri/pgextwlist.git \
84
+ && git clone https://github.com/crunchydata/pgnodemx \
85
+ \
68
86
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 postgresql${PGVERSION} libevent-devel brotli-devel libbrotli \
69
87
&& ${PACKAGER} -y clean all \
88
+ \
89
+ # forbid creation of a main cluster when package is installed
90
+ # && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
70
91
\
71
92
# Install PostgreSQL
72
93
&& for version in $PG_SUPPORTED_VERSIONS; do \
@@ -75,18 +96,18 @@ RUN pip3 install 'PyYAML<6.0' setuptools pystache loader kazoo meld3 boto python
75
96
# Install PostgreSQL binaries, contrib, plproxy and multiple pl's
76
97
&& ${PACKAGER} -y install -y postgresql${version}-contrib \
77
98
postgresql${version}-devel \
78
- \
79
99
# Modify for using origial-spilo scripts
80
100
&& ln -s /usr/pgsql-${version} /usr/lib/postgresql/${version} \
81
- && export PATH=$PATHBACKUP:/usr/pgsql-${version}/bin; \
101
+ && export PATH=$PATHBACKUP:/usr/pgsql-${version}/bin; \
82
102
done \
83
103
&& ${PACKAGER} -y install --nodocs --noplugins --setopt=install_weak_deps=0 glibc-static \
84
104
&& ${PACKAGER} -y clean all;
105
+ RUN gcc -s -shared -fPIC -o /usr/local/lib/cron_unprivileged.so /package/cron_unprivileged.c
85
106
86
107
RUN cd /package && tar -xvzf runit-2.1.2.tar.gz && rm runit-2.1.2.tar.gz \
87
108
&& cd admin/runit-2.1.2 && package/install \
88
109
&& ln -s /usr/local/bin/runsvdir /usr/bin/runsvdir \
89
- && rm -rf /pg_permissions* /pgextwlist /pg_stat_kcache /pgnodemx /timescaledb /set_user /pam-oauth2 \
110
+ && rm -rf /pg_permissions /pgextwlist /pg_stat_kcache /pgnodemx /timescaledb /pam-oauth2 \
90
111
&& rm /etc/pgbackrest.conf && rm -rf /var/spool/pgbackrest \
91
112
&& ${PACKAGER} -y remove $(rpm -qa "*devel*" ) python3-pip python3-wheel python3-dev python3-setuptools git patchutils flatpak glibc-static gcc glibc-devel \
92
113
&& ${PACKAGER} -y autoremove \
@@ -131,6 +152,7 @@ RUN rm -rf /etc/service && mkdir /home/postgres/pgdata && chown -R postgres:post
131
152
chmod 755 $d/* \
132
153
&& ln -s /run/supervise/$(basename $d) $d/supervise; \
133
154
done \
155
+ && chmod +r /etc/motd \
134
156
&& ln -snf $RW_DIR/service /etc/service \
135
157
# && ln -s $RW_DIR/pam.d-postgresql /etc/pam.d/postgresql \
136
158
&& ln -s $RW_DIR/postgres.yml $PGHOME/postgres.yml \
@@ -149,7 +171,7 @@ RUN rm -rf /etc/service && mkdir /home/postgres/pgdata && chown -R postgres:post
149
171
do echo "export $e" >> /etc/bash.bashrc; \
150
172
done \
151
173
&& ln -s /etc/skel/.bashrc $PGHOME/.bashrc \
152
- && echo "source /etc/motd" >> /root /.bashrc \
174
+ && echo "source /etc/motd" >> /home/postgres /.bashrc \
153
175
# Allow users in the root group to access the following files and dirs
154
176
&& if [ "$COMPRESS" != "true" ]; then \
155
177
chmod 664 /etc/passwd \
@@ -165,6 +187,6 @@ COPY launcher/postgres/launch.sh /
165
187
166
188
ENTRYPOINT ["/scripts/nss_wrapper/nss_wrapper.sh" ]
167
189
168
- USER 26
190
+ USER postgres
169
191
170
- CMD ["/bin/sh" , "/launch.sh" , "init" ]
192
+ CMD ["/bin/sh" , "/launch.sh" , "init" ]
0 commit comments