add pgpool user
This commit is contained in:
@@ -25,9 +25,9 @@ RUN apt-get update && \
|
||||
chmod 700 /var/lib/postgresql/.ssh && \
|
||||
chown postgres: /var/lib/postgresql/.ssh && \
|
||||
chmod g-w,o-w /var/lib/postgresql
|
||||
COPY --chmod=600 --chown=postgres:postgres authorized_keys id_ed25519 /var/lib/postgresql/.ssh/
|
||||
|
||||
COPY --chmod=644 --chown=postgres profile /var/lib/postgresql/.profile
|
||||
COPY --chmod=600 --chown=postgres authorized_keys id_ed25519 /var/lib/postgresql/.ssh/
|
||||
COPY --chmod=644 --chown=postgres:postgres profile /var/lib/postgresql/.profile
|
||||
|
||||
COPY --chmod=755 entrypoint.sh /usr/local/bin/
|
||||
|
||||
|
||||
@@ -132,17 +132,10 @@ if [ "$(id -u)" = '0' ]; then
|
||||
exec gosu postgres "$BASH_SOURCE"
|
||||
fi
|
||||
|
||||
# convert to lowercase
|
||||
REPMGR_NODE_ROLE="${REPMGR_NODE_ROLE,,}"
|
||||
|
||||
if [[ ! -s "$PGDATA/PG_VERSION" ]]; then
|
||||
repmgr_setup_conf
|
||||
|
||||
if [[ -n $REPMGR_UPSTREAM ]] && [[ -z $REPMGR_NODE_ROLE ]]; then
|
||||
REPMGR_NODE_ROLE="standby"
|
||||
fi
|
||||
|
||||
if [[ $REPMGR_NODE_ROLE != "standby" ]]; then
|
||||
if [[ -z $REPMGR_UPSTREAM ]]; then
|
||||
docker_init_database_dir
|
||||
pg_setup_conf
|
||||
pg_setup_hba_conf
|
||||
@@ -154,7 +147,15 @@ if [[ ! -s "$PGDATA/PG_VERSION" ]]; then
|
||||
psql -c "CREATE DATABASE repmgr WITH OWNER repmgr;"
|
||||
psql -c 'ALTER USER repmgr SET search_path TO repmgr, "$user", public;'
|
||||
|
||||
if [[ -n $PGPOOL_PASSWORD ]]; then
|
||||
psql -c "CREATE USER pgpool WITH ENCRYPTED PASSWORD '${PGPOOL_PASSWORD}';"
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
|
||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr/repmgr.conf primary register
|
||||
|
||||
|
||||
else
|
||||
until /usr/lib/postgresql/15/bin/repmgr -h $REPMGR_UPSTREAM -U repmgr -f /etc/repmgr/repmgr.conf standby clone --dry-run &> /dev/null
|
||||
do
|
||||
@@ -164,20 +165,9 @@ if [[ ! -s "$PGDATA/PG_VERSION" ]]; then
|
||||
echo "Upstream host found..."
|
||||
/usr/lib/postgresql/15/bin/repmgr -h $REPMGR_UPSTREAM -U repmgr -f /etc/repmgr/repmgr.conf standby clone
|
||||
docker_temp_server_start
|
||||
fi
|
||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr/repmgr.conf standby register --force
|
||||
|
||||
case "$REPMGR_NODE_ROLE" in
|
||||
standby )
|
||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr/repmgr.conf standby register --force
|
||||
;;
|
||||
witness )
|
||||
echo "Witness Server not supported for this configuration!"
|
||||
exit 100
|
||||
;;
|
||||
* )
|
||||
/usr/lib/postgresql/15/bin/repmgr -f /etc/repmgr/repmgr.conf primary register
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
docker_temp_server_stop
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user