1
0
forked from erp-dev/erp
This commit is contained in:
2025-12-24 23:28:50 +08:00
parent c895c3aa48
commit ed6ef67233
5 changed files with 81 additions and 20 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -23,17 +23,35 @@ services:
pgbouncer:
image: pgbouncer/pgbouncer:latest
container_name: pgbouncer
# 配置文件已包含所有配置,环境变量仅作为备用
# 使用环境变量配置,让镜像自动生成配置文件
environment:
DATABASES_HOST: postgres
DATABASES_PORT: "5432"
DATABASES_USER: postgres
DATABASES_PASSWORD: postgres
DATABASES_DBNAME: flower
# 数据库连接配置(格式:数据库名=host=主机 port=端口 dbname=数据库名 user=用户 password=密码)
DATABASES: flower=host=postgres port=5432 dbname=flower user=postgres password=postgres
# PgBouncer 基本配置
PGBOUNCER_LISTEN_ADDR: 0.0.0.0
PGBOUNCER_LISTEN_PORT: 6432
PGBOUNCER_AUTH_TYPE: trust
# 连接池配置
PGBOUNCER_POOL_MODE: transaction
PGBOUNCER_MAX_CLIENT_CONN: "100"
PGBOUNCER_DEFAULT_POOL_SIZE: "25"
PGBOUNCER_MIN_POOL_SIZE: "5"
PGBOUNCER_RESERVE_POOL_SIZE: "5"
PGBOUNCER_RESERVE_POOL_TIMEOUT: "3"
# 连接超时设置
PGBOUNCER_SERVER_CONNECT_TIMEOUT: "15"
PGBOUNCER_SERVER_IDLE_TIMEOUT: "600"
PGBOUNCER_QUERY_TIMEOUT: "0"
PGBOUNCER_QUERY_WAIT_TIMEOUT: "120"
# 日志配置
PGBOUNCER_LOG_CONNECTIONS: "1"
PGBOUNCER_LOG_DISCONNECTIONS: "1"
PGBOUNCER_LOG_POOLER_ERRORS: "1"
# 其他设置
PGBOUNCER_IGNORE_STARTUP_PARAMETERS: extra_float_digits
PGBOUNCER_APPLICATION_NAME_ADD_HOST: "1"
ports:
- "6432:6432"
volumes:
- ./pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
# 确保 postgres 完全启动后再启动 pgbouncer
depends_on:
postgres:

View File

@@ -26,9 +26,35 @@ services:
pgbouncer:
image: pgbouncer/pgbouncer:latest
container_name: pgbouncer
# 配置文件已包含所有配置,环境变量仅作为备用
volumes:
- ./pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
# 使用环境变量配置,让镜像自动生成配置文件
environment:
# 数据库连接配置(格式:数据库名=host=主机 port=端口 dbname=数据库名 user=用户 password=密码)
DATABASES: flower=host=postgres port=${POSTGRES_PORT:-5432} dbname=${POSTGRES_DB:-flower} user=${POSTGRES_USER:-postgres} password=${POSTGRES_PASSWORD:-postgres}
# PgBouncer 基本配置
PGBOUNCER_LISTEN_ADDR: 0.0.0.0
PGBOUNCER_LISTEN_PORT: 6432
PGBOUNCER_AUTH_TYPE: trust
# 连接池配置
PGBOUNCER_POOL_MODE: transaction
PGBOUNCER_MAX_CLIENT_CONN: "100"
PGBOUNCER_DEFAULT_POOL_SIZE: "25"
PGBOUNCER_MIN_POOL_SIZE: "5"
PGBOUNCER_RESERVE_POOL_SIZE: "5"
PGBOUNCER_RESERVE_POOL_TIMEOUT: "3"
# 连接超时设置
PGBOUNCER_SERVER_CONNECT_TIMEOUT: "15"
PGBOUNCER_SERVER_IDLE_TIMEOUT: "600"
PGBOUNCER_QUERY_TIMEOUT: "0"
PGBOUNCER_QUERY_WAIT_TIMEOUT: "120"
# 日志配置
PGBOUNCER_LOG_CONNECTIONS: "1"
PGBOUNCER_LOG_DISCONNECTIONS: "1"
PGBOUNCER_LOG_POOLER_ERRORS: "1"
# 其他设置
PGBOUNCER_IGNORE_STARTUP_PARAMETERS: extra_float_digits
PGBOUNCER_APPLICATION_NAME_ADD_HOST: "1"
ports:
- "${PGBOUNCER_PORT:-6432}:6432"
# 确保 postgres 完全启动后再启动 pgbouncer
depends_on:
postgres:

View File

@@ -23,18 +23,35 @@ services:
pgbouncer:
image: pgbouncer/pgbouncer:latest
container_name: pgbouncer
# 配置文件已包含所有配置,环境变量仅作为备用
# 使用环境变量配置,让镜像自动生成配置文件
environment:
# 如果镜像支持环境变量配置,这些可以作为备用
DATABASES_HOST: postgres
DATABASES_PORT: "5432"
DATABASES_USER: postgres
DATABASES_PASSWORD: postgres
DATABASES_DBNAME: flower
# 数据库连接配置(格式:数据库名=host=主机 port=端口 dbname=数据库名 user=用户 password=密码)
DATABASES: flower=host=postgres port=5432 dbname=flower user=postgres password=postgres
# PgBouncer 基本配置
PGBOUNCER_LISTEN_ADDR: 0.0.0.0
PGBOUNCER_LISTEN_PORT: 6432
PGBOUNCER_AUTH_TYPE: trust
# 连接池配置
PGBOUNCER_POOL_MODE: transaction
PGBOUNCER_MAX_CLIENT_CONN: "100"
PGBOUNCER_DEFAULT_POOL_SIZE: "25"
PGBOUNCER_MIN_POOL_SIZE: "5"
PGBOUNCER_RESERVE_POOL_SIZE: "5"
PGBOUNCER_RESERVE_POOL_TIMEOUT: "3"
# 连接超时设置
PGBOUNCER_SERVER_CONNECT_TIMEOUT: "15"
PGBOUNCER_SERVER_IDLE_TIMEOUT: "600"
PGBOUNCER_QUERY_TIMEOUT: "0"
PGBOUNCER_QUERY_WAIT_TIMEOUT: "120"
# 日志配置
PGBOUNCER_LOG_CONNECTIONS: "1"
PGBOUNCER_LOG_DISCONNECTIONS: "1"
PGBOUNCER_LOG_POOLER_ERRORS: "1"
# 其他设置
PGBOUNCER_IGNORE_STARTUP_PARAMETERS: extra_float_digits
PGBOUNCER_APPLICATION_NAME_ADD_HOST: "1"
ports:
- "6432:6432"
volumes:
- ./pgbouncer/pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
# 确保 postgres 完全启动后再启动 pgbouncer
depends_on:
postgres: