-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
109 lines (102 loc) · 2.55 KB
/
docker-compose.yml
File metadata and controls
109 lines (102 loc) · 2.55 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
version: '3.8'
services:
# FastAPI Application Service
app:
build:
context: .
dockerfile: Dockerfile
container_name: financial_analyst_app
# This section is critical for enabling GPU access inside the container.
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
ports:
- "8000:8000"
volumes:
# Mounts the local Data directory (models, vector databases) into the container.
- ./Data:/app/Data
env_file:
- .env
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
pgbouncer:
condition: service_started
networks:
- financial-analyst-net
restart: unless-stopped
# PostgreSQL Database Service
postgres:
image: postgres:16
container_name: financial_analyst_postgres
environment:
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: mydatabase
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- financial-analyst-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U myuser -d mydatabase"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# Redis Cache Service
redis:
image: redis/redis-stack:7.2.0-v13
container_name: financial_analyst_redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- financial-analyst-net
restart: unless-stopped
# PgBouncer Connection Pooler Service
pgbouncer:
image: bitnami/pgbouncer:1.21.0
container_name: financial_analyst_pgbouncer
ports:
- "6432:6432"
environment:
POSTGRESQL_HOST: postgres
POSTGRESQL_PORT: 5432
POSTGRESQL_USERNAME: myuser
POSTGRESQL_PASSWORD: mypassword
POSTGRESQL_DATABASE: mydatabase
PGBOUNCER_DATABASE: mydatabase
PGBOUNCER_USERNAME: myuser
PGBOUNCER_PASSWORD: mypassword
PGBOUNCER_PORT: 6432
PGBOUNCER_POOL_MODE: session
PGBOUNCER_DEFAULT_POOL_SIZE: 20
PGBOUNCER_MAX_CLIENT_CONN: 1000
PGBOUNCER_MAX_DB_CONN: 100
PGBOUNCER_AUTH_TYPE: md5
depends_on:
postgres:
condition: service_healthy
networks:
- financial-analyst-net
restart: unless-stopped
volumes:
postgres_data:
redis_data:
networks:
financial-analyst-net:
driver: bridge