-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.pgbouncer.yml
More file actions
71 lines (55 loc) · 2.01 KB
/
docker-compose.pgbouncer.yml
File metadata and controls
71 lines (55 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
version: '3.8'
services:
pgbouncer:
image: edoburu/pgbouncer:latest
container_name: pgbouncer-normalization
environment:
# Database connection (will be passed from .env)
- DATABASE_URL=${DATABASE_URL}
# Connection pooling mode
# - session: one connection per client session (safest, but less efficient)
# - transaction: one connection per transaction (recommended for most apps)
# - statement: one connection per statement (most aggressive, use with caution)
- POOL_MODE=transaction
# Maximum number of client connections allowed
- MAX_CLIENT_CONN=1000
# Default pool size per database/user pair
# This is the number of persistent connections to the database
- DEFAULT_POOL_SIZE=20
# Minimum pool size (keep connections warm)
# Ensures this many connections are always open
- MIN_POOL_SIZE=5
# Reserve pool for urgent connections
# Additional connections available when default pool is exhausted
- RESERVE_POOL_SIZE=5
# Maximum connections per database
- MAX_DB_CONNECTIONS=25
# Maximum connections per user
- MAX_USER_CONNECTIONS=25
# Server connection settings
- SERVER_IDLE_TIMEOUT=600
- SERVER_LIFETIME=3600
- SERVER_CONNECT_TIMEOUT=15
# Query timeouts (0 = disabled)
- QUERY_TIMEOUT=0
- QUERY_WAIT_TIMEOUT=120
# Logging
- LOG_CONNECTIONS=1
- LOG_DISCONNECTIONS=1
- LOG_POOLER_ERRORS=1
ports:
# Expose PgBouncer on port 6432
# Your app should connect to localhost:6432 instead of the database directly
- "6432:5432"
restart: unless-stopped
# Health check to ensure PgBouncer is running
healthcheck:
test: ["CMD", "pg_isready", "-h", "localhost", "-p", "5432"]
interval: 10s
timeout: 5s
retries: 5
networks:
- normalization-network
networks:
normalization-network:
driver: bridge