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