-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
244 lines (235 loc) · 6.31 KB
/
docker-compose.prod.yml
File metadata and controls
244 lines (235 loc) · 6.31 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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# Docker Compose for LSI Ecosystem - Production
# This configuration is optimized for production deployment
version: '3.9'
services:
# ========================================================================
# LSI Production Service
# ========================================================================
lsi:
image: lsi-ecosystem:latest
container_name: lsi-prod
restart: always
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- LSI_LOG_LEVEL=info
- ZHIPU_API_KEY=${ZHIPU_API_KEY}
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- VECTOR_DB_TYPE=${VECTOR_DB_TYPE:-chroma}
- CHROMA_HOST=chroma
- CHROMA_PORT=8000
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=${POSTGRES_USER:-lsi}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB:-lsi_db}
- REDIS_HOST=redis
- REDIS_PORT=6379
- LSI_DATA_PATH=/app/data
volumes:
- lsi_data:/app/data
- lsi_logs:/app/logs
- lsi_cartridges:/app/cartridges
networks:
- lsi-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
chroma:
condition: service_healthy
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ========================================================================
# PostgreSQL Production Database
# ========================================================================
postgres:
image: postgres:15-alpine
container_name: lsi-postgres-prod
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER:-lsi}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB:-lsi_db}
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_prod:/var/lib/postgresql/data
networks:
- lsi-network
deploy:
resources:
limits:
cpus: '1'
memory: 1G
reservations:
cpus: '0.25'
memory: 256M
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-lsi}"]
interval: 10s
timeout: 5s
retries: 5
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ========================================================================
# Redis Production Cache
# ========================================================================
redis:
image: redis:7-alpine
container_name: lsi-redis-prod
restart: always
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_prod:/data
networks:
- lsi-network
command: >
redis-server
--appendonly yes
--appendfsync everysec
--maxmemory 256mb
--maxmemory-policy allkeys-lru
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.1'
memory: 128M
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ========================================================================
# Chroma Vector Database Production
# ========================================================================
chroma:
image: chromadb/chroma:latest
container_name: lsi-chroma-prod
restart: always
ports:
- "${CHROMA_PORT:-8000}:8000"
volumes:
- chroma_prod:/chroma/chroma
environment:
- ANONYMIZED_TELEMETRY=False
- CHROMA_SERVER_AUTH_CREDENTIALS_FILE=/chroma/auth.toml
- CHROMA_SERVER_AUTH_PROVIDER=chromadb.auth.token.TokenAuthServerProvider
- CHROMA_SERVER_AUTH_CREDENTIALS=${CHROMA_TOKEN:-}
- PERSIST_DIRECTORY=/chroma/chroma
networks:
- lsi-network
deploy:
resources:
limits:
cpus: '1'
memory: 1G
reservations:
cpus: '0.25'
memory: 256M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/heartbeat"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ========================================================================
# Nginx Reverse Proxy (optional)
# ========================================================================
nginx:
image: nginx:alpine
container_name: lsi-nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
- ./nginx/logs:/var/log/nginx
networks:
- lsi-network
depends_on:
- lsi
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 64M
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# ========================================================================
# Watchtower - Auto-update containers
# ========================================================================
watchtower:
image: containrrr/watchtower
container_name: lsi-watchtower
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_POLL_INTERVAL=86400
- WATCHTOWER_LABEL_ENABLE=auto-update
networks:
- lsi-network
networks:
lsi-network:
driver: bridge
volumes:
lsi_data:
driver: local
lsi_logs:
driver: local
lsi_cartridges:
driver: local
postgres_prod:
driver: local
redis_prod:
driver: local
chroma_prod:
driver: local