-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
223 lines (215 loc) · 6.21 KB
/
docker-compose.yml
File metadata and controls
223 lines (215 loc) · 6.21 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
services:
netcortex:
build:
context: .
dockerfile: docker/Dockerfile
args:
EXTRAS: "all" # includes aws + vault + celery
image: netcortex:latest
container_name: netcortex
ports:
- "8000:8000"
env_file:
- .env
environment:
# Peer containers — override URLs here
REDIS_URL: redis://redis:6379/0
NEO4J_URI: bolt://neo4j:7687
NATS_URL: nats://nats:4222
depends_on:
redis:
condition: service_healthy
neo4j:
condition: service_healthy
nats:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=4)",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
restart: unless-stopped
volumes:
- netcortex_data:/app/data
netcortex-worker:
build:
context: .
dockerfile: docker/Dockerfile
args:
EXTRAS: "all"
image: netcortex:latest
container_name: netcortex-worker
command: ["python", "-m", "netcortex.worker"]
env_file:
- .env
environment:
REDIS_URL: redis://redis:6379/0
NEO4J_URI: bolt://neo4j:7687
NATS_URL: nats://nats:4222
SYNC_BACKEND: celery
# INGEST_MODE: "stream" # uncomment + enable ingest profile below
depends_on:
redis:
condition: service_healthy
neo4j:
condition: service_healthy
nats:
condition: service_healthy
netcortex:
condition: service_healthy
# Worker has no HTTP server — override the image HEALTHCHECK with a TCP check
healthcheck:
test: ["CMD", "python", "-c", "import socket; socket.create_connection(('neo4j', 7687), 2).close()"]
interval: 30s
timeout: 5s
start_period: 30s
retries: 3
restart: unless-stopped
deploy:
replicas: 1
# Optional sharded SNMP poller (Phase E). Enable with:
# docker compose --profile snmp-poller up -d
# Scale horizontally with:
# docker compose --profile snmp-poller up -d --scale netcortex-snmp-poller=4
# Each replica consistent-hashes its target list across the live cohort,
# so adding more replicas spreads load automatically.
netcortex-snmp-poller:
build:
context: .
dockerfile: docker/Dockerfile
args:
EXTRAS: "all"
image: netcortex:latest
command: ["python", "-m", "netcortex.snmp.poller"]
env_file:
- .env
environment:
REDIS_URL: redis://redis:6379/0
NEO4J_URI: bolt://neo4j:7687
depends_on:
redis:
condition: service_healthy
neo4j:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import socket; socket.create_connection(('redis', 6379), 2).close()"]
interval: 30s
timeout: 5s
start_period: 30s
retries: 3
restart: unless-stopped
profiles:
- snmp-poller
# Optional decoupled ingest worker (Phase C). Enable with:
# INGEST_MODE=stream docker compose --profile ingest up -d
# Scale horizontally with: docker compose --profile ingest up -d --scale netcortex-ingest=3
netcortex-ingest:
build:
context: .
dockerfile: docker/Dockerfile
args:
EXTRAS: "all"
image: netcortex:latest
command: ["python", "-m", "netcortex.ingest.worker"]
env_file:
- .env
environment:
REDIS_URL: redis://redis:6379/0
NEO4J_URI: bolt://neo4j:7687
depends_on:
redis:
condition: service_healthy
neo4j:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import socket; socket.create_connection(('neo4j', 7687), 2).close()"]
interval: 30s
timeout: 5s
start_period: 30s
retries: 3
restart: unless-stopped
profiles:
- ingest
redis:
image: redis:7-alpine
container_name: netcortex-redis
command: redis-server --save 60 1 --loglevel warning
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
restart: unless-stopped
neo4j:
image: neo4j:5-community
container_name: netcortex-neo4j
ports:
- "7474:7474" # Neo4j Browser UI
- "7687:7687" # Bolt protocol
environment:
NEO4J_AUTH: neo4j/netcortex
NEO4J_PLUGINS: "[]"
NEO4J_dbms_memory_pagecache_size: "512M"
NEO4J_dbms_memory_heap_max__size: "512M"
volumes:
- neo4j_data:/data
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:7474"]
interval: 15s
timeout: 10s
retries: 5
start_period: 30s
restart: unless-stopped
# NATS — thalamus / typed event bus (0.8.0+). Sensory adapters publish
# SensoryEvents here; reflex handlers, the correlator, and (later) the
# stream bridge for external agents all subscribe. See
# docs/architecture/brain.md for the brain-mapped architecture.
#
# JetStream enabled with file-backed store so durable consumers (episodic
# memory in 0.9.0) survive container restart. Monitoring on 8222 for the
# healthcheck; client traffic on 4222.
nats:
image: nats:2.11-alpine
container_name: netcortex-nats
command: ["-js", "-sd", "/data/jetstream", "-m", "8222"]
ports:
- "4222:4222" # client
- "8222:8222" # monitoring (/healthz, /varz, /connz)
volumes:
- nats_data:/data
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8222/healthz"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
restart: unless-stopped
volumes:
netcortex_data:
redis_data:
neo4j_data:
nats_data:
# ------------------------------------------------------------
# Example: override for local dev (docker-compose.override.yml)
# ------------------------------------------------------------
# services:
# netcortex:
# volumes:
# - .:/app # live-reload source
# command: uvicorn netcortex.main:app --reload --host 0.0.0.0 --port 8000
#
# localstack: # AWS SM mock for dev
# image: localstack/localstack:latest
# ports:
# - "4566:4566"
# environment:
# SERVICES: secretsmanager