From 9701734c2fd26bc9f168d7d4377201d53a009fb2 Mon Sep 17 00:00:00 2001 From: Cullen Taylor Date: Tue, 4 Jan 2022 16:56:53 -0500 Subject: [PATCH] Add support for 3 new pgbouncer.ini config options This will add support to configure stats_users, server_reset_query, and server_idle_timeout parameters with environment variables. --- .../1/debian-10/rootfs/opt/bitnami/scripts/libpgbouncer.sh | 3 +++ .../1/debian-10/rootfs/opt/bitnami/scripts/pgbouncer-env.sh | 6 ++++++ bitnami/pgbouncer/README.md | 3 +++ 3 files changed, 12 insertions(+) diff --git a/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/libpgbouncer.sh b/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/libpgbouncer.sh index 3edf3c700c21..eaa83bf53816 100644 --- a/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/libpgbouncer.sh +++ b/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/libpgbouncer.sh @@ -226,6 +226,7 @@ pgbouncer_initialize() { "pidfile:${PGBOUNCER_PID_FILE}" "logfile:${PGBOUNCER_LOG_FILE}" "admin_users:${POSTGRESQL_USERNAME}" + "stats_users:${PGBOUNCER_STATS_USERS}" "client_tls_sslmode:${PGBOUNCER_CLIENT_TLS_SSLMODE}" "server_tls_sslmode:${PGBOUNCER_SERVER_TLS_SSLMODE}" "query_wait_timeout:${PGBOUNCER_QUERY_WAIT_TIMEOUT}" @@ -233,6 +234,8 @@ pgbouncer_initialize() { "max_client_conn:${PGBOUNCER_MAX_CLIENT_CONN}" "max_db_connections:${PGBOUNCER_MAX_DB_CONNECTIONS}" "idle_transaction_timeout:${PGBOUNCER_IDLE_TRANSACTION_TIMEOUT}" + "server_idle_timeout:${PGBOUNCER_SERVER_IDLE_TIMEOUT}" + "server_reset_query:${PGBOUNCER_SERVER_RESET_QUERY}" "default_pool_size:${PGBOUNCER_DEFAULT_POOL_SIZE}" "min_pool_size:${PGBOUNCER_MIN_POOL_SIZE}" "reserve_pool_size:${PGBOUNCER_RESERVE_POOL_SIZE}" diff --git a/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/pgbouncer-env.sh b/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/pgbouncer-env.sh index 64b58549c945..91c07c738fb5 100644 --- a/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/pgbouncer-env.sh +++ b/bitnami/pgbouncer/1/debian-10/rootfs/opt/bitnami/scripts/pgbouncer-env.sh @@ -27,6 +27,7 @@ pgbouncer_env_vars=( PGBOUNCER_AUTH_USER PGBOUNCER_AUTH_QUERY PGBOUNCER_AUTH_TYPE + PGBOUNCER_STATS_USERS PGBOUNCER_POOL_MODE PGBOUNCER_INIT_SLEEP_TIME PGBOUNCER_INIT_MAX_RETRIES @@ -34,6 +35,8 @@ pgbouncer_env_vars=( PGBOUNCER_MAX_CLIENT_CONN PGBOUNCER_MAX_DB_CONNECTIONS PGBOUNCER_IDLE_TRANSACTION_TIMEOUT + PGBOUNCER_SERVER_IDLE_TIMEOUT + PGBOUNCER_SERVER_RESET_QUERY PGBOUNCER_DEFAULT_POOL_SIZE PGBOUNCER_MIN_POOL_SIZE PGBOUNCER_RESERVE_POOL_SIZE @@ -93,6 +96,7 @@ export PGBOUNCER_LISTEN_ADDRESS="${PGBOUNCER_LISTEN_ADDRESS:-0.0.0.0}" export PGBOUNCER_AUTH_USER="${PGBOUNCER_AUTH_USER:-}" export PGBOUNCER_AUTH_QUERY="${PGBOUNCER_AUTH_QUERY:-}" export PGBOUNCER_AUTH_TYPE="${PGBOUNCER_AUTH_TYPE:-md5}" +export PGBOUNCER_STATS_USERS="${PGBOUNCER_STATS_USERS:-}" export PGBOUNCER_POOL_MODE="${PGBOUNCER_POOL_MODE:-}" export PGBOUNCER_INIT_SLEEP_TIME="${PGBOUNCER_INIT_SLEEP_TIME:-10}" export PGBOUNCER_INIT_MAX_RETRIES="${PGBOUNCER_INIT_MAX_RETRIES:-10}" @@ -105,6 +109,8 @@ export PGBOUNCER_MIN_POOL_SIZE="${PGBOUNCER_MIN_POOL_SIZE:-}" export PGBOUNCER_RESERVE_POOL_SIZE="${PGBOUNCER_RESERVE_POOL_SIZE:-}" export PGBOUNCER_IGNORE_STARTUP_PARAMETERS="${PGBOUNCER_IGNORE_STARTUP_PARAMETERS:-}" export PGBOUNCER_EXTRA_FLAGS="${PGBOUNCER_EXTRA_FLAGS:-}" +export PGBOUNCER_SERVER_IDLE_TIMOUT="${PGBOUNCER_SERVER_IDLE_TIMOUT:-}" +export PGBOUNCER_SERVER_RESET_QUERY="${PGBOUNCER_SERVER_RESET_QUERY:-}" # Client TLS settings export PGBOUNCER_CLIENT_TLS_SSLMODE="${PGBOUNCER_CLIENT_TLS_SSLMODE:-disable}" diff --git a/bitnami/pgbouncer/README.md b/bitnami/pgbouncer/README.md index 32cc920e3b68..5a25258ac9cb 100644 --- a/bitnami/pgbouncer/README.md +++ b/bitnami/pgbouncer/README.md @@ -127,6 +127,9 @@ To expose the same database name as the backend, set `PGBOUNCER_DATABASE="$POSTG - `PGBOUNCER_MIN_POOL_SIZE` : PgBouncer has at least this amount of open connections. Default: **0 (disabled)**. - `PGBOUNCER_RESERVE_POOL_SIZE` : PgBouncer allows this amount of additional connections. Default: **0 (disabled)**. - `PGBOUNCER_IGNORE_STARTUP_PARAMETERS`: you can use this to set `ignore_startup_parameters` in the auto-generated `pgbouncer.ini`. This can be useful for solving certain connection issues. See https://www.pgbouncer.org/config.html for more details. +- `PGBOUNCER_SERVER_IDLE_TIMEOUT`: PgBouncer maximum time in seconds a server connection can be idle. If 0 then the timeout is disabled. Default: **600** +- `PGBOUNCER_SERVER_RESET_QUERY`: PgBouncer query sent to server on connection release before making it available to other clients. Default: **DISCARD ALL** +- `PGBOUNCER_STATS_USERS`: PgBouncer comma-separated list of database users that are allowed to connect and run read-only queries. No defaults. ### Initializing a new instance