Implement conf lock file check (#116)

It will make sure that the conf file will only be generated once
for a given container.
pull/117/head
Rizky Maulana Nugraha 2019-02-01 21:16:59 +07:00 zatwierdzone przez mazano
rodzic 2cb86dc2c6
commit 42be2693c5
4 zmienionych plików z 25 dodań i 1 usunięć

1
.dockerignore 120000
Wyświetl plik

@ -0,0 +1 @@
.gitignore

Wyświetl plik

@ -2,6 +2,11 @@
source /env-data.sh
SETUP_LOCKFILE="${ROOT_CONF}/.postgresql.conf.lock"
if [ -f "${SETUP_LOCKFILE}" ]; then
return 0
fi
# This script will setup necessary configuration to enable replications
# Refresh configuration in case environment settings changed.
@ -32,3 +37,5 @@ EOF
echo "kernel.shmmax=543252480" >> /etc/sysctl.conf
echo "kernel.shmall=2097152" >> /etc/sysctl.conf
# Put lock file to make sure conf was not reinitialized
touch ${SETUP_LOCKFILE}

Wyświetl plik

@ -2,6 +2,11 @@
source /env-data.sh
SETUP_LOCKFILE="${ROOT_CONF}/.pg_hba.conf.lock"
if [ -f "${SETUP_LOCKFILE}" ]; then
return 0
fi
# This script will setup pg_hba.conf
# Reconfigure pg_hba if environment settings changed
@ -46,3 +51,6 @@ if [[ -z "$REPLICATE_FROM" ]]; then
echo "Add rule to pg_hba: replication user"
echo "host replication all 0.0.0.0/0 $authMethod" >> ${ROOT_CONF}/pg_hba.conf
fi
# Put lock file to make sure conf was not reinitialized
touch ${SETUP_LOCKFILE}

Wyświetl plik

@ -2,6 +2,11 @@
source /env-data.sh
SETUP_LOCKFILE="${ROOT_CONF}/.ssl.conf.lock"
if [ -f "${SETUP_LOCKFILE}" ]; then
return 0
fi
# This script will setup default SSL config
# /etc/ssl/private can't be accessed from within container for some reason
@ -23,4 +28,7 @@ echo "ssl = true" >> $CONF
echo "ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'" >> $CONF
echo "ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'" >> $CONF
#echo "ssl_ca_file = '' # (change requires restart)" >> $CONF
#echo "ssl_crl_file = ''" >> $CONF
#echo "ssl_crl_file = ''" >> $CONF
# Put lock file to make sure conf was not reinitialized
touch ${SETUP_LOCKFILE}