#!/usr/bin/env bash 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. cat $CONF.template > $CONF # This script will setup necessary configuration to optimise for PostGIS and to enable replications cat >> $CONF <> $CONF # Optimise PostgreSQL shared memory for PostGIS # shmall units are pages and shmmax units are bytes(?) equivalent to the desired shared_buffer size set in setup_conf.sh - in this case 500MB 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}