-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
512 lines (489 loc) · 18.1 KB
/
Copy pathdocker-compose.yml
File metadata and controls
512 lines (489 loc) · 18.1 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# Shared backend config (DRY)
x-backend-common: &backend-common
image: ${DOCKER_REGISTRY:-ghcr.io/}${DOCKER_IMAGE_NAMESPACE:-2233admin}/opencli-admin-api:${IMAGE_TAG:-0.4.0}
env_file:
- path: .env
required: false
volumes:
- db_data:/data
restart: unless-stopped
services:
# ── Infrastructure (only needed for TASK_EXECUTOR=celery) ─────────────────
redis:
profiles: ["celery", "odp", "nas"]
image: ${DOCKER_REGISTRY:-}redis:7-alpine
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
postgres:
image: ${DOCKER_REGISTRY:-}postgres:16-alpine
profiles: ["postgres", "odp", "nas"]
# Host port optional — default off to avoid clashing with NAS Postgres on :5432
ports:
- "${POSTGRES_PUBLISH_PORT:-}:5432"
environment:
POSTGRES_DB: ${POSTGRES_DB:-opencli_admin}
POSTGRES_USER: ${POSTGRES_USER:-opencli}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-opencli_secret}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-opencli}"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
# ── Self-hosted RSS generators ───────────────────────────────────────────
# docker compose --profile rss up -d rsshub rss-bridge
rsshub:
profiles: ["rss"]
image: diygod/rsshub:latest
ports:
- "${RSSHUB_PORT:-1200}:1200"
environment:
NODE_ENV: production
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:1200/healthz"]
interval: 10s
timeout: 5s
retries: 12
start_period: 20s
restart: unless-stopped
rss-bridge:
profiles: ["rss"]
image: rssbridge/rss-bridge:latest
ports:
- "${RSS_BRIDGE_PORT:-3001}:80"
restart: unless-stopped
# ── Dify workflow compatibility runtime ──────────────────────────────────
# Pure-logic workflows run in this pinned Graphon sidecar. Code, tools, and
# outbound network remain blocked unless their explicit runtime is configured.
dify-graphon-runtime:
profiles: ["dify", "nas"]
build:
context: ./compat/dify_graphon_runtime
dockerfile: Dockerfile
environment:
DIFY_GRAPHON_MAX_REQUEST_BYTES: ${DIFY_GRAPHON_MAX_REQUEST_BYTES:-1048576}
DIFY_GRAPHON_MAX_OUTPUT_BYTES: ${DIFY_GRAPHON_MAX_OUTPUT_BYTES:-1048576}
DIFY_GRAPHON_EXECUTION_TIMEOUT_SECONDS: ${DIFY_GRAPHON_EXECUTION_TIMEOUT_SECONDS:-120}
DIFY_GRAPHON_MAX_CONCURRENT_RUNS: ${DIFY_GRAPHON_MAX_CONCURRENT_RUNS:-2}
DIFY_GRAPHON_MAX_STORED_RUNS: ${DIFY_GRAPHON_MAX_STORED_RUNS:-512}
DIFY_GRAPHON_RUN_RETENTION_SECONDS: ${DIFY_GRAPHON_RUN_RETENTION_SECONDS:-3600}
DIFY_GRAPHON_SLIM_PATH: ${DIFY_GRAPHON_SLIM_PATH:-}
DIFY_GRAPHON_SLIM_PLUGIN_FOLDER: /tmp/dify-graphon/slim/plugins
DIFY_SANDBOX_ENDPOINT: ${DIFY_SANDBOX_ENDPOINT:-}
DIFY_SANDBOX_API_KEY: ${DIFY_SANDBOX_API_KEY:-}
ports:
- "127.0.0.1:${DIFY_GRAPHON_PORT:-8095}:8095"
networks:
- dify_runtime
- dify_egress
read_only: true
tmpfs:
- /tmp:size=${DIFY_GRAPHON_TMPFS_SIZE:-64m},mode=1777
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
pids_limit: 256
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://localhost:8095/health', timeout=3)"
interval: 10s
timeout: 5s
retries: 6
start_period: 20s
restart: unless-stopped
# ── Kats time-series compatibility runtime ───────────────────────────────
# Kats pins a legacy NumPy/Pandas/Statsmodels stack, so it stays isolated
# from the Python 3.13 API process while retaining its complete optional set.
kats-runtime:
profiles: ["kats", "nas"]
build:
context: ./compat/kats_runtime
dockerfile: Dockerfile
ports:
- "127.0.0.1:${KATS_RUNTIME_PORT:-8096}:8096"
networks:
- kats_runtime
read_only: true
tmpfs:
- /tmp:size=${KATS_RUNTIME_TMPFS_SIZE:-256m},mode=1777
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
pids_limit: 512
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://localhost:8096/health', timeout=3)"
interval: 10s
timeout: 5s
retries: 12
start_period: 60s
restart: unless-stopped
# ── Backend API ───────────────────────────────────────────────────────────
api:
<<: *backend-common
# Run as root so the API can manage Docker containers (agent pool) via
# the mounted socket. Acceptable for a self-hosted admin panel.
user: root
environment:
DATABASE_URL: ${DATABASE_URL:-sqlite+aiosqlite:////data/opencli_admin.db}
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/1
REDIS_URL: redis://redis:6379/0
DEBUG: ${DEBUG:-false}
SECRET_KEY: ${SECRET_KEY:-change-me-in-production}
API_AUTH_TOKEN: ${API_AUTH_TOKEN:?Set API_AUTH_TOKEN in .env or run scripts/install.sh}
BOOTSTRAP_ADMIN_TOKEN: ${BOOTSTRAP_ADMIN_TOKEN:?Set BOOTSTRAP_ADMIN_TOKEN in .env or run scripts/install.sh}
OPENCLI_MCP_ALLOWED_HOSTS: ${OPENCLI_MCP_ALLOWED_HOSTS:-}
OPENCLI_MCP_ALLOWED_ORIGINS: ${OPENCLI_MCP_ALLOWED_ORIGINS:-}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
# Built-in interactive browser endpoint.
# For COLLECTION_MODE=local this is pre-loaded into the browser pool.
OPENCLI_CDP_ENDPOINT: ${OPENCLI_CDP_ENDPOINT:-http://agent-1:19222}
# Multi-instance pool: overrides OPENCLI_CDP_ENDPOINT when set
AGENT_POOL_ENDPOINTS: ${AGENT_POOL_ENDPOINTS:-}
# Collection mode: "local" (default browser) or "agent" (distributed edge nodes)
COLLECTION_MODE: ${COLLECTION_MODE:-local}
# Public-facing URL for install scripts and agent registration links.
# Set to the URL remote agents will use to reach this center (e.g. http://192.168.1.1:8031).
PUBLIC_URL: ${PUBLIC_URL:-}
# Passed to the agent pool manager so it can name containers/networks correctly
COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME:-opencli-admin}
CHROME_IMAGE: ${DOCKER_REGISTRY:-ghcr.io/}${DOCKER_IMAGE_NAMESPACE:-2233admin}/opencli-admin-chrome:${IMAGE_TAG:-0.4.0}
NOVNC_BASE_PORT: ${NOVNC_BASE_PORT:-6080}
# NAS + III: cron 由 III schedule-bootstrap 驱动,API 不再跑内置 scheduler
COLLECTION_ORCHESTRATOR: ${COLLECTION_ORCHESTRATOR:-admin}
ODP_INGEST_URL: ${ODP_INGEST_URL:-}
III_URL: ${III_URL:-}
DIFY_GRAPHON_RUNTIME_URL: ${DIFY_GRAPHON_RUNTIME_URL:-http://dify-graphon-runtime:8095}
KATS_RUNTIME_URL: ${KATS_RUNTIME_URL:-http://kats-runtime:8096}
INVOKEAI_ENABLED: ${INVOKEAI_ENABLED:-false}
INVOKEAI_BASE_URL: http://invokeai:9090
INVOKEAI_API_TOKEN: ${INVOKEAI_API_TOKEN:-}
IMAGE_ASSET_STORAGE_PATH: /data/image-studio/assets
volumes:
- db_data:/data
# Docker socket: lets the API start/stop agent pool containers
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "${API_PORT:-8031}:8000"
networks:
- default
- dify_runtime
- kats_runtime
- invokeai-private
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
depends_on:
agent-1:
condition: service_healthy
# ── Next.js operator console ─────────────────────────────────────────────
frontend:
image: ${DOCKER_REGISTRY:-ghcr.io/}${DOCKER_IMAGE_NAMESPACE:-2233admin}/opencli-admin-frontend:${IMAGE_TAG:-0.4.0}
environment:
BACKEND_URL: http://api:8000
ports:
- "${FRONTEND_PORT:-3010}:3010"
depends_on:
api:
condition: service_healthy
healthcheck:
test:
- CMD
- node
- -e
- "fetch('http://localhost:3010/login').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"
interval: 10s
timeout: 5s
retries: 6
start_period: 20s
restart: unless-stopped
# ── Celery Worker (only needed for TASK_EXECUTOR=celery) ─────────────────
worker:
profiles: ["celery"]
<<: *backend-common
command: celery -A backend.worker.celery_app worker --loglevel=info --concurrency=4
environment:
DATABASE_URL: ${DATABASE_URL:-sqlite+aiosqlite:////data/opencli_admin.db}
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/1
REDIS_URL: redis://redis:6379/0
RUN_MIGRATIONS: "false"
SECRET_KEY: ${SECRET_KEY:-change-me-in-production}
API_AUTH_TOKEN: ${API_AUTH_TOKEN:-}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
OPENCLI_CDP_ENDPOINT: ${OPENCLI_CDP_ENDPOINT:-http://agent-1:19222}
AGENT_POOL_ENDPOINTS: ${AGENT_POOL_ENDPOINTS:-}
KATS_RUNTIME_URL: ${KATS_RUNTIME_URL:-http://kats-runtime:8096}
INVOKEAI_ENABLED: ${INVOKEAI_ENABLED:-false}
INVOKEAI_BASE_URL: http://invokeai:9090
INVOKEAI_API_TOKEN: ${INVOKEAI_API_TOKEN:-}
IMAGE_ASSET_STORAGE_PATH: /data/image-studio/assets
depends_on:
redis:
condition: service_healthy
api:
condition: service_healthy
networks:
- default
- kats_runtime
- invokeai-private
# ── Private image-generation data plane ─────────────────────────────────
# No host port is published. Only the API/worker adapter can reach this
# service over the internal network. The digest is intentionally immutable;
# upgrades require the upstream/API/schema/GPU gates in ADR-0026.
invokeai:
profiles: ["image-studio"]
# Deliberately invalid fallback: default Compose remains parseable, while
# starting this profile still requires an explicitly attested image.
image: ${INVOKEAI_ATTESTED_IMAGE:-invalid.invalid/opencli/invokeai-attested-image-required@sha256:0000000000000000000000000000000000000000000000000000000000000000}
read_only: true
security_opt:
- no-new-privileges:true
environment:
INVOKEAI_ROOT: /invokeai
volumes:
- invokeai_data:/invokeai
tmpfs:
- /tmp
networks:
- invokeai-private
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
restart: unless-stopped
# ── Celery Beat (only needed for TASK_EXECUTOR=celery) ───────────────────
beat:
profiles: ["celery"]
<<: *backend-common
command: celery -A backend.worker.celery_app beat --loglevel=info
environment:
DATABASE_URL: ${DATABASE_URL:-sqlite+aiosqlite:////data/opencli_admin.db}
CELERY_BROKER_URL: redis://redis:6379/0
CELERY_RESULT_BACKEND: redis://redis:6379/1
REDIS_URL: redis://redis:6379/0
RUN_MIGRATIONS: "false"
SECRET_KEY: ${SECRET_KEY:-change-me-in-production}
API_AUTH_TOKEN: ${API_AUTH_TOKEN:-}
depends_on:
redis:
condition: service_healthy
api:
condition: service_healthy
# ── Built-in interactive browser ─────────────────────────────────────────
# noVNC is loopback-only by default; use an SSH tunnel for remote servers.
agent-1:
image: ${DOCKER_REGISTRY:-ghcr.io/}${DOCKER_IMAGE_NAMESPACE:-2233admin}/opencli-admin-chrome:${IMAGE_TAG:-0.4.0}
environment:
CHROME_HOSTNAME: agent-1
volumes:
- agent_profile_1:/home/chrome/.config/chromium
ports:
- "127.0.0.1:${NOVNC_PORT:-6080}:6080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9222/json/version"]
interval: 10s
timeout: 5s
retries: 6
start_period: 30s
restart: unless-stopped
# Additional browser instances are managed dynamically via the API
# (节点管理 → 新增实例)
# ── Remote agent (all-in-one: Chrome + agent server) ─────────────────────
# For deploying on a REMOTE node that should register with the center.
# Usage:
# On the remote machine:
# docker run -d --restart=unless-stopped \
# -e CENTRAL_API_URL=http://<center-ip>:8031 \
# -e AGENT_REGISTER=ws \
# -p 19823:19823 \
# ghcr.io/2233admin/opencli-admin-agent:0.4.0
#
# Or start the bundled agent profile (local network):
# docker compose --profile agent up agent
agent:
profiles: ["agent"]
image: ${DOCKER_REGISTRY:-ghcr.io/}${DOCKER_IMAGE_NAMESPACE:-2233admin}/opencli-admin-agent:${IMAGE_TAG:-0.4.0}${CHROME_SUFFIX:-}
environment:
CENTRAL_API_URL: ${CENTRAL_API_URL:-}
AGENT_ADVERTISE_URL: ${AGENT_ADVERTISE_URL:-}
AGENT_PORT: ${AGENT_PORT:-19823}
AGENT_MODE: ${AGENT_MODE:-cdp}
AGENT_LABEL: ${AGENT_LABEL:-}
AGENT_REGISTER: ${AGENT_REGISTER:-http}
OPENCLI_TIMEOUT: ${OPENCLI_TIMEOUT:-120}
API_AUTH_TOKEN: ${API_AUTH_TOKEN:-}
AGENT_API_TOKEN: ${AGENT_API_TOKEN:-}
HTTP_PROXY: ${HTTP_PROXY:-}
HTTPS_PROXY: ${HTTPS_PROXY:-}
volumes:
- agent_profile:/home/agent/.config/chromium
ports:
- "${AGENT_PORT:-19823}:19823"
restart: unless-stopped
# ── ODP data plane (Rust hot path) — docker compose --profile odp up
odp-ingest:
profiles: ["odp", "nas"]
build:
context: ./odp-rs
dockerfile: Dockerfile.ingest
environment:
ODP_INGEST_HOST: 0.0.0.0
ODP_INGEST_PORT: 8040
ODP_REDIS_URL: redis://redis:6379/2
RUST_LOG: info,odp_ingest=debug
ports:
- "${ODP_INGEST_PORT:-8040}:8040"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8040/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
depends_on:
redis:
condition: service_healthy
restart: unless-stopped
odp-store:
profiles: ["odp", "nas"]
build:
context: ./odp-rs
dockerfile: Dockerfile.store
environment:
ODP_REDIS_URL: redis://redis:6379/2
ODP_DATABASE_URL: postgresql://${POSTGRES_USER:-opencli}:${POSTGRES_PASSWORD:-opencli_secret}@postgres:5432/${POSTGRES_DB:-opencli_admin}
ODP_STORE_BATCH_SIZE: ${ODP_STORE_BATCH_SIZE:-500}
RUST_LOG: info,odp_store=debug
# odp-store has no HTTP/TCP listener (pure Redis-stream consumer loop), so
# this is a process-liveness probe, not a readiness probe: it confirms the
# binary hasn't crashed, not that Postgres/Redis connectivity is healthy.
healthcheck:
test: ["CMD", "pgrep", "-x", "odp-store"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
odp-ingest:
condition: service_healthy
restart: unless-stopped
# ── III control plane (M0+M1) — docker compose --profile iii --profile odp up
iii-engine:
profiles: ["iii", "nas"]
image: ${DOCKER_REGISTRY:-}iiidev/iii:latest
ports:
- "${III_WS_PORT:-49134}:49134"
- "${III_HTTP_PORT:-3111}:3111"
- "${III_STREAM_PORT:-3112}:3112"
volumes:
- ./iii/config.yaml:/app/config.yaml:ro
environment:
RUST_LOG: info
III_EXECUTION_CONTEXT: docker
restart: unless-stopped
iii-odp-ingest-bridge:
profiles: ["iii", "nas"]
build:
context: ./iii
dockerfile: workers/odp-ingest-bridge/Dockerfile
environment:
III_URL: ws://iii-engine:49134
ODP_INGEST_URL: http://odp-ingest:8040
depends_on:
iii-engine:
condition: service_started
odp-ingest:
condition: service_healthy
restart: unless-stopped
iii-schedule-bootstrap:
profiles: ["iii", "nas"]
build:
context: ./iii
dockerfile: workers/schedule-bootstrap/Dockerfile
environment:
III_URL: ws://iii-engine:49134
DISCORD_SCHEDULES_PATH: /app/schedules/discord.yaml
OPENCLI_SCHEDULES_PATH: /app/schedules/opencli.yaml
volumes:
- ./iii/schedules:/app/schedules:ro
depends_on:
iii-engine:
condition: service_started
restart: unless-stopped
iii-collector-opencli:
profiles: ["iii", "nas"]
build:
context: ./iii
dockerfile: workers/collector-opencli/Dockerfile
environment:
III_URL: ws://iii-engine:49134
OPENCLI_MODE: ${OPENCLI_MODE:-bridge}
OPENCLI_DAEMON_HOST: agent-1
OPENCLI_DAEMON_PORT: ${OPENCLI_DAEMON_PORT:-19825}
OPENCLI_TIMEOUT: ${OPENCLI_TIMEOUT:-120}
depends_on:
iii-engine:
condition: service_started
agent-1:
condition: service_started
restart: unless-stopped
# Discord auth lives on the host — run collector-discord locally when using discord-cli.
# Uncomment on NAS only if discord-cli + token are baked into the image/volume.
# iii-collector-discord:
# profiles: ["iii"]
# build:
# context: ./iii
# dockerfile: workers/collector-discord/Dockerfile
# environment:
# III_URL: ws://iii-engine:49134
# DISCORD_CLI_BIN: discord
# depends_on:
# iii-engine:
# condition: service_started
# restart: unless-stopped
networks:
dify_runtime:
internal: true
kats_runtime:
internal: true
# Dedicated outbound network: the Graphon sidecar can reach server-owned
# sandbox/model endpoints without becoming reachable from sibling services.
dify_egress:
invokeai-private:
internal: true
volumes:
redis_data:
postgres_data:
db_data:
agent_profile_1:
agent_profile:
invokeai_data: