-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
210 lines (202 loc) · 5.01 KB
/
docker-compose.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
version: '3.8'
services:
backend:
build:
context: .
dockerfile: Dockerfile.backend
args:
BUILDKIT_INLINE_CACHE: 1
cache_from:
- type=local,src=/tmp/.buildx-cache
- type=local,src=/tmp/.buildx-cache-new
ports:
- "8000:8000"
environment:
- IN_DOCKER=true
- POSTGRES_SERVER=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=file_upload_embeddings
- REDIS_URL=redis://redis:6379/0
- OPENAI_API_KEY=${OPENAI_API_KEY}
- AZURE_OPENAI_API_KEY=${AZURE_OPENAI_API_KEY:-}
- AZURE_OPENAI_API_BASE=${AZURE_OPENAI_API_BASE:-}
- AZURE_OPENAI_API_VERSION=${AZURE_OPENAI_API_VERSION:-}
- AZURE_OPENAI_DEPLOYMENT_NAME=${AZURE_OPENAI_DEPLOYMENT_NAME:-}
- REDIS_POOL_SIZE=20
- REDIS_POOL_TIMEOUT=30
- SQLALCHEMY_POOL_SIZE=10
- SQLALCHEMY_MAX_OVERFLOW=20
- MODEL_CACHE_DIR=/app/.cache
- TRANSFORMERS_CACHE=/app/.cache/huggingface
- SENTENCE_TRANSFORMERS_HOME=/app/.cache/sentence_transformers
- TORCH_HOME=/app/.cache/torch
- PYTHONPATH=/app
deploy:
resources:
limits:
cpus: '1.0'
memory: 2G
reservations:
cpus: '0.5'
memory: 1G
volumes:
- ./app:/app/app
- ./config:/app/config
- ./logs:/app/logs
- ./uploads:/app/uploads
- ./temp:/app/temp
- ml-model-cache:/app/.cache
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
ports:
- "8501:8501"
environment:
- BACKEND_URL=http://backend:8000
deploy:
resources:
limits:
cpus: '0.5'
memory: 1G
reservations:
cpus: '0.25'
memory: 512M
volumes:
- ./app:/app/app
- ./config:/app/config
depends_on:
- backend
networks:
- app-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8501/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
postgres:
build:
context: ./postgres
dockerfile: Dockerfile
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=file_upload_embeddings
volumes:
- postgres-data:/var/lib/postgresql/data
- ./scripts:/docker-entrypoint-initdb.d
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
deploy:
resources:
limits:
cpus: '2.0'
memory: 4G
reservations:
cpus: '1.0'
memory: 2G
networks:
- app-network
redis:
image: redis:7-alpine
command: redis-server --maxmemory 768mb --maxmemory-policy allkeys-lru --save 900 1 --save 300 10
volumes:
- redis-data:/data
deploy:
resources:
limits:
cpus: '0.5'
memory: 768M
reservations:
cpus: '0.25'
memory: 384M
networks:
- app-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
prometheus:
image: prom/prometheus:latest
volumes:
- ./monitoring/prometheus:/etc/prometheus
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- "9090:9090"
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
networks:
- app-network
healthcheck:
test: ["CMD", "wget", "-q", "--tries=1", "--spider", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
grafana:
image: grafana/grafana:latest
ports:
- "3001:3000"
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
volumes:
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning
- grafana-data:/var/lib/grafana
networks:
- app-network
healthcheck:
test: ["CMD", "wget", "-q", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
app-network:
driver: bridge
volumes:
postgres-data:
redis-data:
prometheus-data:
grafana-data:
ml-model-cache:
driver: local