-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
221 lines (214 loc) · 5.29 KB
/
Copy pathdocker-compose.yml
File metadata and controls
221 lines (214 loc) · 5.29 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
version: '3.8'
services:
# Kosmos AI Scientist application
kosmos:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: kosmos-app
profiles: ["prod"]
ports:
- "8000:8000" # API/Health endpoints
environment:
# Load from .env file
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- CLAUDE_MODEL=${CLAUDE_MODEL:-claude-3-5-sonnet-20241022}
- DATABASE_URL=postgresql://kosmos:kosmos-dev-password@postgres:5432/kosmos
- REDIS_ENABLED=true
- REDIS_URL=redis://redis:6379/0
- NEO4J_URI=bolt://neo4j:7687
- NEO4J_USER=neo4j
- NEO4J_PASSWORD=kosmos-password
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- ENABLE_CONCURRENT_OPERATIONS=${ENABLE_CONCURRENT_OPERATIONS:-false}
- ENABLE_PROFILING=${ENABLE_PROFILING:-false}
volumes:
- ./logs:/app/logs
- ./results:/app/results
- ./.chroma_db:/app/.chroma_db
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "python3 -c 'import requests; requests.get(\"http://localhost:8000/health\")' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- kosmos-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
deploy:
resources:
limits:
cpus: '4'
memory: 4G
reservations:
cpus: '2'
memory: 2G
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# PostgreSQL database for SQLAlchemy ORM
postgres:
image: postgres:15-alpine
container_name: kosmos-postgres
profiles: ["dev", "prod"]
ports:
- "5432:5432"
environment:
- POSTGRES_DB=kosmos
- POSTGRES_USER=kosmos
- POSTGRES_PASSWORD=kosmos-dev-password
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C
volumes:
- ./postgres_data:/var/lib/postgresql/data
- ./scripts/init_db.sql:/docker-entrypoint-initdb.d/init.sql
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U kosmos -d kosmos"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- kosmos-network
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '1'
memory: 512M
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Redis cache for performance optimization
redis:
image: redis:7-alpine
container_name: kosmos-redis
profiles: ["dev", "prod"]
ports:
- "6379:6379"
command: >
redis-server
--maxmemory 256mb
--maxmemory-policy allkeys-lru
--save 60 1000
--appendonly yes
volumes:
- ./redis_data:/data
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
start_period: 5s
networks:
- kosmos-network
deploy:
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Neo4j graph database for knowledge graphs
neo4j:
image: neo4j:5.14-community
container_name: kosmos-neo4j
profiles: ["dev", "prod"]
ports:
- "7474:7474" # HTTP (Web UI)
- "7687:7687" # Bolt protocol
environment:
- NEO4J_AUTH=neo4j/kosmos-password
- NEO4J_PLUGINS=["apoc"]
- NEO4J_dbms_memory_pagecache_size=512M
- NEO4J_dbms_memory_heap_initial__size=512M
- NEO4J_dbms_memory_heap_max__size=1G
volumes:
- ./neo4j_data:/data
- ./neo4j_logs:/logs
- ./neo4j_import:/var/lib/neo4j/import
- ./neo4j_plugins:/plugins
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://localhost:7474 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- kosmos-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '1'
memory: 1G
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# pgAdmin for PostgreSQL management (development only)
pgadmin:
image: dpage/pgadmin4:latest
container_name: kosmos-pgadmin
profiles: ["dev"]
ports:
- "5050:80"
environment:
- PGADMIN_DEFAULT_EMAIL=admin@kosmos.local
- PGADMIN_DEFAULT_PASSWORD=admin
- PGADMIN_CONFIG_SERVER_MODE=False
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
volumes:
- ./pgadmin_data:/var/lib/pgadmin
restart: unless-stopped
networks:
- kosmos-network
depends_on:
- postgres
networks:
kosmos-network:
name: kosmos-network
driver: bridge
volumes:
postgres_data:
driver: local
redis_data:
driver: local
neo4j_data:
driver: local
neo4j_logs:
driver: local
neo4j_import:
driver: local
neo4j_plugins:
driver: local
pgadmin_data:
driver: local