From 6e1ddcc289724595f0e5b127df8939059721a670 Mon Sep 17 00:00:00 2001 From: Bernhard Radermacher Date: Fri, 27 Feb 2026 14:09:18 +0100 Subject: [PATCH] wip --- entrypoint.sh | 73 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 954ca8f..6dde648 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,7 +28,7 @@ docker_setup_env() { } if [ "$(id -u)" = '0' ]; then -# sudo service ssh start + service ssh start chown -R postgres /etc/pgpool2 exec gosu postgres "$BASH_SOURCE" fi @@ -39,43 +39,42 @@ chmod 600 /var/lib/postgresql/.ssh/* docker_setup_env -#{ -# printf "%s:" "$PGPOOL_ADMIN_USERNAME" -# pg_md5 "$PGPOOL_ADMIN_PASSWORD" -# printf "\n" -#} > /etc/pgpool2/pcp.conf -#{ -# printf "localhost:9898:%s:%s\n" "$PGPOOL_ADMIN_USERNAME" "$PGPOOL_ADMIN_PASSWORD" -# printf "pgpool:9898:%s:%s\n" "$PGPOOL_ADMIN_USERNAME" "$PGPOOL_ADMIN_PASSWORD" -#} > ~/.pcppass -#chmod 600 /etc/pgpool2/pcp.conf ~/.pcppass -# -#{ -# printf "listen_addresses = '*'\n" -# printf "port = 5432\n" -## printf "unix_socket_directories = '/run'\n" -## printf "pcp_socket_dir = '/run'\n" -# printf "enable_pool_hba = off\n" -# printf "allow_clear_text_frontend_auth = on\n" -# printf "process_management_mode = 'dynamic'\n" -# printf "backend_clustering_mode = 'raw'\n" -# printf "health_check_timeout = 5\n" -# printf "health_check_period = 5\n" -# printf "health_check_user = 'pgpool'\n" -# printf "health_check_password = '%s'\n" "$PGPOOL_PASSWORD" -# -# IFS=':' -# n=0 -# for backend in $PGPOOL_BACKEND -# do -# printf "backend_hostname%d = '%s'\n" $n $backend -# printf "backend_port%d = 5432\n" $n -# ((n+=1)) -# done -#} > /etc/pgpool2/pgpool.conf -# +{ + printf "%s:" "$PGPOOL_ADMIN_USERNAME" + pg_md5 "$PGPOOL_ADMIN_PASSWORD" + printf "\n" +} > /etc/pgpool2/pcp.conf +{ + printf "localhost:9898:%s:%s\n" "$PGPOOL_ADMIN_USERNAME" "$PGPOOL_ADMIN_PASSWORD" + printf "pgpool:9898:%s:%s\n" "$PGPOOL_ADMIN_USERNAME" "$PGPOOL_ADMIN_PASSWORD" +} > ~/.pcppass +chmod 600 /etc/pgpool2/pcp.conf ~/.pcppass -#/usr/sbin/pgpool +{ + printf "listen_addresses = '*'\n" + printf "port = 5432\n" +# printf "unix_socket_directories = '/run'\n" +# printf "pcp_socket_dir = '/run'\n" + printf "enable_pool_hba = off\n" + printf "allow_clear_text_frontend_auth = on\n" + printf "process_management_mode = 'dynamic'\n" + printf "backend_clustering_mode = 'raw'\n" + printf "health_check_timeout = 5\n" + printf "health_check_period = 5\n" + printf "health_check_user = 'pgpool'\n" + printf "health_check_password = '%s'\n" "$PGPOOL_PASSWORD" + + IFS=':' + n=0 + for backend in $PGPOOL_BACKEND + do + printf "backend_hostname%d = '%s'\n" $n $backend + printf "backend_port%d = 5432\n" $n + ((n+=1)) + done +} > /etc/pgpool2/pgpool.conf + +/usr/sbin/pgpool while true do