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
1 change: 1 addition & 0 deletions docker/pg-public-beta/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setop
python3-pip \
python3-psycopg2 \
git \
clang \
patchutils \
binutils \
make \
Expand Down
9 changes: 1 addition & 8 deletions docker/postgres-gis/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setop
make \
cmake \
gcc \
clang \
pam-devel \
wget \
mlocate \
Expand All @@ -62,14 +63,6 @@ RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setop
# install etcdctl
RUN curl -L https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-${ARCH}.tar.gz | tar xz -C /bin --strip=1 --wildcards --no-anchored --no-same-owner etcdctl etcd;

# Install Patroni
RUN pip3 install 'PyYAML<6.0' setuptools pystache loader dumb-init kazoo meld3 boto
#swiftclient
RUN ${PACKAGER} -y install python3-etcd python3-consul \
python3-gevent python3-greenlet python3-cachetools \
python3-rsa python3-pyasn1-modules python3-cffi \
&& ${PACKAGER} -y clean all;

ENV PATHBACKUP = $PATH

RUN wget https://smarden.org/runit/runit-2.1.2.tar.gz -P /package/
Expand Down
1 change: 1 addition & 0 deletions docker/postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ RUN ${PACKAGER} -y update && ${PACKAGER} -y install --nodocs --noplugins --setop
make \
cmake \
gcc \
clang \
pam-devel \
wget \
mlocate \
Expand Down
18 changes: 10 additions & 8 deletions launcher/pgbouncer/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ if [ "$PGUSER" = "postgres" ]; then
echo "You need to fix this as soon as possible."
fi

mkdir -p /tmp/pgbouncer/certs

if [ -z "${CONNECTION_POOLER_CLIENT_TLS_CRT}" ]; then
openssl req -nodes -new -x509 -subj /CN=spilo.dummy.org \
-keyout /etc/pgbouncer/certs/pgbouncer.key \
-out /etc/pgbouncer/certs/pgbouncer.crt
-keyout /tmp/pgbouncer/certs/pgbouncer.key \
-out /tmp/pgbouncer/certs/pgbouncer.crt
# -keyout /etc/ssl/certs/pgbouncer.key \
# -out /etc/ssl/certs/pgbouncer.crt
else
ln -s ${CONNECTION_POOLER_CLIENT_TLS_CRT} /etc/pgbouncer/certs/pgbouncer.crt
ln -s ${CONNECTION_POOLER_CLIENT_TLS_KEY} /etc/pgbouncer/certs/pgbouncer.key
ln -s ${CONNECTION_POOLER_CLIENT_TLS_CRT} /tmp/pgbouncer/certs/pgbouncer.crt
ln -s ${CONNECTION_POOLER_CLIENT_TLS_KEY} /tmp/pgbouncer/certs/pgbouncer.key
if [ ! -z "${CONNECTION_POOLER_CLIENT_CA_FILE}" ]; then
ln -s ${CONNECTION_POOLER_CLIENT_CA_FILE} /etc/pgbouncer/certs/ca.crt
ln -s ${CONNECTION_POOLER_CLIENT_CA_FILE} /tmp/pgbouncer/certs/ca.crt
fi
# ln -s ${CONNECTION_POOLER_CLIENT_TLS_CRT} /etc/ssl/certs/pgbouncer.crt
# ln -s ${CONNECTION_POOLER_CLIENT_TLS_KEY} /etc/ssl/certs/pgbouncer.key
Expand All @@ -35,9 +37,9 @@ fi
if [ "$ADDITIONAL_PGBOUNCER_CONFIG" ]; then
bouncerConfigPath="$ADDITIONAL_PGBOUNCER_CONFIG"
else
envsubst < /etc/pgbouncer/pgbouncer.ini.tmpl > /etc/pgbouncer/pgbouncer.ini
envsubst < /etc/pgbouncer/auth_file.txt.tmpl > /etc/pgbouncer/auth_file.txt
bouncerConfigPath="/etc/pgbouncer/pgbouncer.ini"
envsubst < /etc/pgbouncer/pgbouncer.ini.tmpl > /tmp/pgbouncer/pgbouncer.ini
envsubst < /etc/pgbouncer/auth_file.txt.tmpl > /tmp/pgbouncer/auth_file.txt
bouncerConfigPath="/tmp/pgbouncer/pgbouncer.ini"
fi

./bin/pgbouncer $bouncerConfigPath
8 changes: 4 additions & 4 deletions scripts/pgbouncer/pgbouncer.ini.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ pool_mode = $CONNECTION_POOLER_MODE
listen_port = $CONNECTION_POOLER_PORT
listen_addr = *
auth_type = scram-sha-256
auth_file = /etc/pgbouncer/auth_file.txt
auth_file = /tmp/pgbouncer/auth_file.txt
auth_dbname = postgres
admin_users = $PGUSER
auth_query = SELECT * FROM $PGSCHEMA.user_lookup($1)
logfile = /dev/stdout
pidfile = /tmp/pgbouncer.pid

server_tls_sslmode = require
server_tls_ca_file = /etc/pgbouncer/certs/pgbouncer.crt
server_tls_ca_file = /tmp/pgbouncer/certs/pgbouncer.crt
server_tls_protocols = secure
client_tls_sslmode = require
client_tls_key_file = /etc/pgbouncer/certs/pgbouncer.key
client_tls_cert_file = /etc/pgbouncer/certs/pgbouncer.crt
client_tls_key_file = /tmp/pgbouncer/certs/pgbouncer.key
client_tls_cert_file = /tmp/pgbouncer/certs/pgbouncer.crt

log_connections = 0
log_disconnections = 0
Expand Down
35 changes: 35 additions & 0 deletions scripts/postgres/move_wal_dir.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

stopPostgreSQL(pgData){

}

startPostgreSQL(pgData){

}

moveWalDir(){
local oldPath=$1
local newPath=$2
local pgData=$3

# check if folder already exist
if [[ -d "$newPath" ]]; then
# Check if folder is empty
if [[ ! -z "$(ls -A "$newPath")" ]]; then
output_error "The defined new directory is not empty"
exit 1
else

fi
}

source "/scripts/postgres/shell_lib.sh"
output_info "The defined new directory is not empty"


if [[ -z "$WALDIR" && -z "$OLD_WALDIR" ]]; then
echo "Umgebungsvariable $env_name ist nicht gesetzt."
else
echo "Umgebungsvariable $env_name ist gesetzt auf: $env_value"
fi