forked from BigNathan1/CoopLumen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
110 lines (105 loc) · 3.12 KB
/
Copy pathdocker-compose.yml
File metadata and controls
110 lines (105 loc) · 3.12 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
version: '3.9'
services:
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: cooplumen
POSTGRES_PASSWORD: cooplumen
POSTGRES_DB: cooplumen
ports:
- '5432:5432'
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U cooplumen']
interval: 5s
timeout: 5s
retries: 10
pgbouncer:
image: bitnami/pgbouncer:latest
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
# PostgreSQL backend connection
POSTGRESQL_HOST: db
POSTGRESQL_PORT: 5432
POSTGRESQL_USERNAME: cooplumen
POSTGRESQL_PASSWORD: cooplumen
POSTGRESQL_DATABASE: cooplumen
# PgBouncer configuration
PGBOUNCER_DATABASE: cooplumen
PGBOUNCER_POOL_MODE: transaction # transaction|session|statement
PGBOUNCER_MAX_CLIENT_CONN: 100 # Maximum client connections
PGBOUNCER_DEFAULT_POOL_SIZE: 20 # Default pool size per database
PGBOUNCER_MAX_DB_CONNECTIONS: 50 # Maximum backend connections to PostgreSQL
PGBOUNCER_MIN_POOL_SIZE: 5 # Minimum pool size
ports:
- '6432:6432' # PgBouncer default port
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -p 6432 -U cooplumen']
interval: 5s
timeout: 5s
retries: 10
backend:
build:
context: ./backend
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
db:
condition: service_healthy
pgbouncer:
condition: service_healthy
environment:
NODE_ENV: development
PORT: 4000
# Connect through PgBouncer for connection pooling (development: transaction mode)
DATABASE_URL: postgresql://cooplumen:cooplumen@pgbouncer:6432/cooplumen
# Direct database connection (fallback/compatibility)
DATABASE_DIRECT_URL: postgresql://cooplumen:cooplumen@db:5432/cooplumen
# PostgreSQL Pool Configuration
PGPOOL_MAX: ${PGPOOL_MAX:-10}
PGPOOL_IDLE_TIMEOUT: ${PGPOOL_IDLE_TIMEOUT:-30000}
PGPOOL_CONNECTION_TIMEOUT: ${PGPOOL_CONNECTION_TIMEOUT:-2000}
STELLAR_NETWORK: testnet
STELLAR_HORIZON_URL: https://horizon-testnet.stellar.org
FRONTEND_URL: http://localhost:3000
LOG_LEVEL: info
ports:
- '4000:4000'
volumes:
- ./backend/src:/app/src
command: npm run dev
healthcheck:
test: ['CMD-SHELL', 'wget -qO- http://localhost:4000/health || exit 1']
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
environment:
NEXT_PUBLIC_API_URL: http://localhost:4000
NEXT_PUBLIC_STELLAR_NETWORK: TESTNET
ports:
- '3000:3000'
volumes:
- ./frontend/src:/app/src
command: npm run dev
healthcheck:
test: ['CMD-SHELL', 'wget -qO- http://localhost:3000/api/health || exit 1']
interval: 15s
timeout: 5s
retries: 5
start_period: 60s
volumes:
pg_data: