diff --git a/.env.example b/.env.example index 3771b6cc89b2fdb22e618ed6e5cfe879586a9f9c..d9c7e1dba2e6ae947ab1eab11d3c70180d17641f 100644 --- a/.env.example +++ b/.env.example @@ -307,6 +307,9 @@ PUBLIC_HOSTNAME="your.hostname.com" # (Requires PostgreSQL 17+ client with libpq 17+) # - Port 5433 (Plain TCP): postgresql://user:pass@hostname:5433/haf_block_log # (Works with all PostgreSQL versions, but NOT encrypted) +# Can change the default ports of the above connection methods: +# HAFSQL_PUBLIC_PORT_SSL=5432 +# HAFSQL_PUBLIC_PORT_TCP=5433 # HAFSQL_PUBLIC_CONNECTION_LIMIT=5 # Maximum concurrent connections for public users # HafSQL diff --git a/pgbouncer/docker-entrypoint.sh b/pgbouncer/docker-entrypoint.sh index e7d038cb5a4dca1fd02577cd741c1b20827cce2b..4a8f792316208e277782e17b6ac151f2601d9eb3 100644 --- a/pgbouncer/docker-entrypoint.sh +++ b/pgbouncer/docker-entrypoint.sh @@ -95,6 +95,7 @@ tcp_keepalive = ${PGBOUNCER_TCP_KEEPALIVE:-1} tcp_keepcnt = ${PGBOUNCER_TCP_KEEPCNT:-3} tcp_keepidle = ${PGBOUNCER_TCP_KEEPIDLE:-60} tcp_keepintvl = ${PGBOUNCER_TCP_KEEPINTVL:-10} +ignore_startup_parameters = ${PGBOUNCER_IGNORE_STARTUP_PARAMETERS:-extra_float_digits} ;; Logging log_connections = ${PGBOUNCER_LOG_CONNECTIONS:-0} diff --git a/postgres-public/compose.postgres-public.yml b/postgres-public/compose.postgres-public.yml index 11a879b382644e0f58f5e558869ac4e2ced9aa28..a1144c04df1c89eb3087af511fddf02b7e289dd7 100644 --- a/postgres-public/compose.postgres-public.yml +++ b/postgres-public/compose.postgres-public.yml @@ -6,8 +6,8 @@ services: # Extend caddy service to expose PostgreSQL ports caddy: ports: - - 5432:5432 # TLS port for PostgreSQL 17+ clients (sslnegotiation=direct) - - 5433:5433 # Plain TCP port for all PostgreSQL clients + - ${HAFSQL_PUBLIC_PORT_SSL:-5432}:5432 # TLS port for PostgreSQL 17+ clients (sslnegotiation=direct) + - ${HAFSQL_PUBLIC_PORT_TCP:-5433}:5433 # Plain TCP port for all PostgreSQL clients volumes: - type: bind source: ./caddy/layer4-postgres-snippets @@ -19,8 +19,8 @@ services: environment: PG_ACCESS_PGBOUNCER_PUBLIC: " # Allow pgbouncer-public to connect as public user(s)\n - # Trust connection from pgbouncer-public container - authentication happens at PgBouncer level\n - host haf_block_log ${HAFSQL_PUBLIC_USERNAME:-hafsql_public} ${COMPOSE_PROJECT_NAME}-pgbouncer-public-1.${NETWORK_NAME} trust\n + # Trust connection from all containers on this compose (samenet)\n + host haf_block_log ${HAFSQL_PUBLIC_USERNAME:-hafsql_public} samenet trust\n # To add more users, extend this environment variable with additional lines\n " # This service provides a separate pgbouncer instance for public users @@ -51,6 +51,8 @@ services: PGBOUNCER_QUERY_WAIT_TIMEOUT: 60 PGBOUNCER_CLIENT_IDLE_TIMEOUT: 0 PGBOUNCER_CLIENT_LOGIN_TIMEOUT: 30 + # Ignore unsupported startup parameters to prevent connection errors + PGBOUNCER_IGNORE_STARTUP_PARAMETERS: extra_float_digits # Logging PGBOUNCER_LOG_CONNECTIONS: 1 PGBOUNCER_LOG_DISCONNECTIONS: 1