Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
665 lines (650 loc) · 34 KB
/
Copy pathdocker-compose.yml
File metadata and controls
665 lines (650 loc) · 34 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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# AgentSwarms — self-hosted via Docker.
#
# 1. cp .env.example .env (fill in your Supabase project + keys)
# 2. Apply the database migrations once: supabase link && supabase db push
# 3. docker compose up -d --build
# 4. Open http://localhost:8080
#
# EVERY SERVICE STARTS. There are no profiles and nothing to opt into: the
# Developer-workspace Python runtime and its egress proxy, the lakehouse
# catalog and its object store, the vector store, the feature store, the Spark
# cluster, the Office renderer and the JS sandbox all come up with the app, and
# .env.example points the app at every one of them. A product whose features
# depend on which flag the installer was given is a product most installs never
# see — and the support question "is X installed?" has one answer now.
#
# What that costs: about 5 GB of images and roughly 8 GB of RAM for the whole
# set (docs/SYSTEM_REQUIREMENTS.md). `scripts/setup.sh --dev` runs the app on
# the host for development and starts the same services beside it.
#
# The Developer-workspace runtime still needs ONE switch after install — Admin →
# Developer runtime — because it lets people run code; the containers are here
# and waiting. MCP Builder (Build → MCP Builder) runs on that same runtime.
#
# Compose reads .env automatically and hands all of it to the app at runtime
# (env_file below). That includes the browser's settings, VITE_* and PUBLIC_*:
# the server reads them when it starts and gives them to the page (R464), so
# the image is built with none of them and is the same image a release
# publishes (R469). Change one and restart; there is nothing to rebuild.
#
# WHICH IMAGES (R470). Every image this repository builds is named
# ${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/<image>:${AGENTSWARMS_VERSION:-local}
# - AGENTSWARMS_VERSION unset: the tag is `local`, which no release ever
# publishes, so `docker compose up -d --build` builds from this checkout,
# as it always has.
# - AGENTSWARMS_VERSION=1.7.0: the release's published, signed images.
# `docker compose pull && docker compose up -d --no-build`. Going back is
# the previous version, the same two commands (docs/DEPLOYMENT.md,
# "Upgrades"). Never `--build` with a version set: that builds this
# checkout and tags it as the release (Monitoring then says "built from
# source").
# - AGENTSWARMS_REGISTRY: your mirror of them (air-gapped installs).
# Until R470 the images were named agentswarms/<image>:latest, which is a
# Docker Hub name nobody here owns: a `docker compose pull` would have run
# whatever anyone published under it.
services:
agentswarms:
build:
context: .
image: ${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/agentswarms:${AGENTSWARMS_VERSION:-local}
env_file: .env
environment:
# The sandbox image the app starts kernels from: the one the
# notebook-runtime-image service below builds or pulls. A value in .env
# (an older install's agentswarms/notebook-runtime:latest) still wins,
# and that service builds under the same name.
NOTEBOOK_RUNTIME_IMAGE: ${NOTEBOOK_RUNTIME_IMAGE:-${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/notebook-runtime:${AGENTSWARMS_VERSION:-local}}
ports:
- "8080:8080"
# The egress allow-list edited in Admin -> Developer runtime is written
# here; the squid service mounts the same directory read-only. Without this
# the setting saves but never reaches the proxy.
volumes:
- ./deploy/notebooks/egress:/etc/agentswarms/egress
# Self-hosted Supabase runs as its own compose project, so the app reaches
# it across the host gateway rather than by service name. Docker Desktop
# resolves host.docker.internal on its own; Linux needs this mapping, and
# without it a SUPABASE_URL pointing at the host does not resolve at all.
# Harmless when Supabase is hosted -- nothing looks the name up then.
extra_hosts:
- "host.docker.internal:host-gateway"
# nb-internal lets notebook kernels call back for governed model/KB access;
# js-internal lets the app reach the (optional) JS sandbox by service name.
networks: [default, nb-internal, js-internal, docker-api]
restart: unless-stopped
# On `docker compose up -d` / `down` the app drains: open requests (a chat
# reply mid-stream) get DRAIN_TIMEOUT_MS, 25 s, to finish. Compose's own
# default is 10 s before SIGKILL, which would cut them anyway (R463). A
# process with nothing open still exits at once.
stop_grace_period: 30s
# `restart` covers a process that EXITS. It does nothing for one that is
# running and wedged, which is the failure an operator actually meets — so
# every service that can answer for itself does. `node -e` rather than curl
# or wget: the runtime image ships neither, and a health check that depends
# on a tool the image lacks reports unhealthy for ever.
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://127.0.0.1:8080/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 30s
timeout: 10s
retries: 3
# The first boot runs migrations and warms the engine; failing it during
# that would only make `docker ps` lie about a healthy start.
start_period: 90s
# ── Developer-workspace server runtime ─────────
# Build-only helper so `--build` produces (and `pull` fetches) the kernel
# image the orchestrator launches. It never really runs (entrypoint exits
# immediately).
notebook-runtime-image:
build:
context: ./docker/notebook-runtime
image: ${NOTEBOOK_RUNTIME_IMAGE:-${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/notebook-runtime:${AGENTSWARMS_VERSION:-local}}
entrypoint: ["/bin/true"]
restart: "no"
# Authenticated websocket bridge (browser ⇄ per-session kernel).
notebook-gateway:
build:
context: ./services/notebook-gateway
image: ${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/notebook-gateway:${AGENTSWARMS_VERSION:-local}
environment:
PORT: "8090"
SUPABASE_URL: ${SUPABASE_URL}
SUPABASE_SERVICE_ROLE_KEY: ${SUPABASE_SERVICE_ROLE_KEY}
# Optional: only if you manage the signing secret yourself. Otherwise the
# gateway reads the server-generated one from the database.
NOTEBOOK_RUNTIME_SECRET: ${NOTEBOOK_RUNTIME_SECRET:-}
NOTEBOOK_CELL_TIMEOUT_SECONDS: ${NOTEBOOK_CELL_TIMEOUT_SECONDS:-120}
KERNEL_CREATE_TIMEOUT_MS: ${KERNEL_CREATE_TIMEOUT_MS:-28000}
# Idle keep-alive window, as for the app: above any balancer's (R463).
HTTP_KEEPALIVE_TIMEOUT_MS: ${HTTP_KEEPALIVE_TIMEOUT_MS:-75000}
ports:
- "8090:8090"
networks: [default, nb-internal, nb-dev]
restart: unless-stopped
# Least-privilege Docker API: only container create/inspect/logs + write verbs
# are exposed to the app (never the raw /var/run/docker.sock). Built from
# tecnativa/docker-socket-proxy, pinned by digest, with Alpine's security
# updates on top (docker/socket-proxy/Dockerfile, R407).
notebook-docker-proxy:
build:
context: ./docker/socket-proxy
image: ${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/docker-socket-proxy:${AGENTSWARMS_VERSION:-local}
environment:
# Only the API sections the orchestrator needs: create/inspect/stop/remove
# containers, plus read access to images and networks (preflight verifies
# the kernel image and network exist). Everything else — exec, volumes,
# swarm, secrets, system — stays denied by default.
#
# These are coarse: with CONTAINERS and POST on, a caller can create a
# container with any settings (privileged, host mounts) and pull any
# image, which is the host. So what actually guards the socket is who can
# reach this proxy: the app, on the internal docker-api network, and
# nothing else (VA-40).
CONTAINERS: "1"
IMAGES: "1"
NETWORKS: "1"
POST: "1"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
# No published port, not even on loopback. Docker accepts traffic for a
# published port from every non-internal network, by the container's IP:
# with 127.0.0.1:2375 here, spark-connect reached the proxy by IP from
# `default` (measured, R408). An app on the host (`npm run dev`) starts
# its own proxy instead; DEPLOYMENT.md has the command.
# Seen live: the proxy's HAProxy wedged a thread ("ha_stuck_warning" in its
# own log) and answered nothing on either address, so every sandbox start
# failed with "Cannot reach the Docker socket-proxy" until it was
# recreated. A health check makes that state visible — `docker compose ps`
# and Observability → Monitoring — rather than discovered from a failed
# run; `docker compose restart notebook-docker-proxy` is the fix.
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:2375/_ping >/dev/null 2>&1 || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# Only the app shares this network. On `default` the proxy answered every
# service there, spark-connect included, which runs Spark pipelines'
# Python UDFs and is on the kernels' network (VA-40, R408).
networks: [docker-api]
restart: unless-stopped
# Every third-party image in this file is pinned as tag@sha256:<index digest>
# (VA-24). The engine pulls by the digest, so the image cannot change under
# the same name; the tag is there for people. Dependabot proposes new pins
# (.github/dependabot.yml); a `:latest` would mean `docker compose pull` runs
# whatever was pushed last.
#
# Default-deny egress proxy — the kernels' only route to the internet.
notebook-egress:
image: ubuntu/squid:6.6-24.04_beta@sha256:6a097f68bae708cedbabd6188d68c7e2e7a38cedd05a176e1cc0ba29e3bbe029
# Fixed name so the app can locate and restart it when an administrator
# saves a new egress allow-list (squid re-reads ACL files only on start,
# and the docker socket proxy deliberately denies `exec`).
#
# The SAME variable the app reads (egressApply.server.ts), so the two agree
# by construction. A fixed literal here meant two instances on one host
# collided on the name — found running a second install beside a first.
container_name: ${NOTEBOOK_EGRESS_CONTAINER:-agentswarms-notebook-egress}
volumes:
- ./deploy/notebooks/egress/squid.conf:/etc/squid/squid.conf:ro
# The DIRECTORY, not the two ACL files individually. allowed_domains and
# allowed_ips are generated (the app rewrites them on every admin save) and
# therefore untracked — and Docker silently creates a *directory* at a
# bind-mount source that does not exist. Mounting them by name meant a
# fresh clone that skipped setup.sh got two directories in its working
# tree and a squid that would not start. The directory itself is always
# present: squid.conf and the .default templates live in it.
- ./deploy/notebooks/egress:/etc/squid/egress:ro
networks: [default, nb-internal, nb-dev]
restart: unless-stopped
# ── Lakehouse catalog ──────────────────────────
# The DuckLake transactional catalog: schemas, table manifests and snapshots
# live here while table DATA lives as Parquet in object storage. Any
# Postgres 12+ works; this one exists so a single-host deployment has zero
# extra moving parts. Point LAKEHOUSE_CATALOG_URL at it (or at your own).
lakehouse-catalog:
image: postgres:16.15@sha256:1beaa3084eee2676f20a9cd9928f0bf2c5bf674f8e49f81017912183d377c61c
# 55432, not 5432: a developer's own Postgres is usually on 5432 and a
# port clash here reads as "the catalog is broken".
ports:
- "127.0.0.1:55432:5432"
environment:
POSTGRES_USER: ${LAKEHOUSE_CATALOG_USER:-lakehouse}
POSTGRES_PASSWORD: ${LAKEHOUSE_CATALOG_PASSWORD:-change-me}
POSTGRES_DB: lakehouse_catalog
volumes:
- lakehouse-catalog-data:/var/lib/postgresql/data
# `default` only: the app is the catalog's one client (VA-42, R412). It
# used to sit on nb-internal too, when an ETL run attached DuckLake from
# inside its kernel with the catalog's own connection string. Since
# sandboxLake.server.ts a sandbox holds no lakehouse credential: the app
# runs its declared reads and commits its staged writes. On nb-internal
# the catalog was only a Postgres every notebook could reach, and an
# install that kept the `change-me` default handed it the lakehouse's
# metadata. Kubernetes never let kernel pods reach it
# (deploy/k8s/notebooks: kernels-default-deny).
networks: [default]
restart: unless-stopped
# An unclean stop makes Postgres replay its WAL on the next start, which on
# a large catalog is minutes of "the database system is starting up". This
# is what tells you the difference between still recovering and broken.
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U $${POSTGRES_USER:-lakehouse} -d $${POSTGRES_DB:-lakehouse_catalog}",
]
interval: 15s
timeout: 5s
retries: 5
start_period: 300s
# ── Object store for the lakehouse ────────────────────────────────────────
# The catalog (above) records which Parquet files make up a table; the files
# themselves live here. Both are needed, which is why both start: a catalog
# with nowhere to write is a lakehouse that fails on its first table.
#
# SILO, a maintained fork of the MinIO server (github.com/pgsty/silo,
# AGPL-3.0, like MinIO itself), since R418. MinIO stopped publishing images
# anyone can pull: Docker Hub's minio/minio is gone and quay.io answers 401
# to an anonymous pull, so a fresh install failed here (VA-2026-10-25-35).
# SILO keeps the S3 API, the MINIO_* settings, the /minio/health paths and
# the on-disk format. Measured on a volume MinIO wrote (multipart objects,
# versions, tags, a public bucket, a user, a policy, a service account):
# SILO opened it and answered every one identically. The service keeps its
# name, `minio`, so `minio:9000` in an existing .env, the `lake-data`
# volume and `docker compose up -d` all carry on as they were.
#
# Any S3-compatible store replaces it — AWS S3, R2, GCS — by pointing
# LAKEHOUSE_S3_* at that instead. This one is here so an install has a
# working lakehouse without an account anywhere.
minio:
image: pgsty/silo:RELEASE.2026-10-26T00-00-00Z@sha256:7bb2aff6b89efe1cb1303c10fc21d579447434ed06649ac9ec05a5e2dbf30ad7
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${LAKEHOUSE_S3_KEY_ID:-agentswarms}
MINIO_ROOT_PASSWORD: ${LAKEHOUSE_S3_SECRET:-agentswarms-lake-dev}
# The console is published on loopback only; the API is in-network.
MINIO_BROWSER_REDIRECT_URL: http://localhost:9001
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:9001:9001"
volumes:
- lake-data:/data
healthcheck:
# `mc ready local`, the server image's own client (SILO ships it as
# mcli with an `mc` alias), so "healthy" means it answers rather than
# that a port is open.
#
# The grace is wide because the FIRST start formats the pool, and the
# first start of an AgentSwarms install is also when eleven other
# containers are starting and several images are still building. At
# 20s + 5 x 15s a loaded laptop missed it, minio-init refused to run
# ("dependency failed to start: container minio is unhealthy") and the
# install stopped with no bucket. Idle, it is ready in about 30s.
test: ["CMD", "mc", "ready", "local"]
interval: 15s
timeout: 10s
retries: 20
start_period: 60s
# One-shot: create the bucket. Nothing in the app creates it — a missing
# bucket surfaces as a write error on the first table, which is a poor way to
# learn that a container never ran.
minio-init:
# SILO's client, the fork of mc that goes with the server above.
image: pgsty/mc:RELEASE.2026-10-26T00-00-00Z@sha256:ce62c9053c69ce12a527a322345b5ad9f44b5f8a7b8189f82e516f2e3f30f1d8
depends_on:
minio: { condition: service_healthy }
# MC_HOST_<alias> is mc's own way to carry a target's credentials. The first
# version ran `mc alias set …` through a folded shell string, where YAML
# turned the line continuations into spaces and mc read the access key as a
# command: "agentswarms: command not found", and no bucket.
environment:
MC_HOST_lake: http://${LAKEHOUSE_S3_KEY_ID:-agentswarms}:${LAKEHOUSE_S3_SECRET:-agentswarms-lake-dev}@minio:9000
entrypoint: ["mc", "mb", "--ignore-existing", "lake/lakehouse"]
restart: "no"
# ── Qdrant vector store ───────────────────────
# Where knowledge-base embeddings are searched; .env.example selects it
# (VECTOR_STORE=qdrant), and the installers wire an older .env that predates
# that (R417). Postgres keeps every vector too, as a column on its chunk
# row, so the app fills this index from Postgres by itself — on a fresh
# volume, after a lost one, or on an install just switched to it — and
# searches Postgres's copy of a collection until the index has all of it.
#
# It holds VECTORS AND TWO IDS. The chunk text, the document and the
# permissions stay in Postgres, so a Qdrant that loses this volume costs a
# few minutes of copying and nothing else — which is why there is no backup
# guidance here and why losing it is not a data-loss event.
#
# ONE NODE IS NOT HIGH AVAILABILITY. This is the single-node shape for a
# laptop or a small install; a deployment that needs retrieval to survive
# losing a node runs a Qdrant cluster and sets QDRANT_REPLICATION to at
# least 2. The admin page reports the replication the collection ACTUALLY
# has, so the difference is visible rather than assumed.
qdrant:
# A release opens storage from the previous minor only: moving this pin
# across minors needs `node scripts/upgrade-qdrant.mjs` first (the
# installers run it), and the minor it leaves added to that script's path.
image: qdrant/qdrant:v1.20.0@sha256:9bfc89f9914fc14876a88c05270685921a55b8877b254a98bcc1cc2f0a424cd2
# Loopback only, so `scripts/setup.sh --dev` (app on the host) reaches the
# same service the containerised app does rather than running without it.
ports:
- "127.0.0.1:6333:6333"
environment:
# PASS-THROUGH, and it has to be. Written as
# `QDRANT__SERVICE__API_KEY: ${QDRANT_API_KEY:-}` this variable is always
# SET, just empty — and Qdrant reads an empty key as "API-key auth is on,
# and the key is the empty string". Every request without one then gets
# `401 Must provide an API key`, which is a server that refuses to work
# out of the box and blames your credentials for it. The list form below
# is omitted entirely when the variable is unset, which leaves auth off.
#
# To secure it, set BOTH in .env: QDRANT__SERVICE__API_KEY for the server
# here, and QDRANT_API_KEY for what the app sends. They are two settings
# because most deployments point at a Qdrant this file did not start.
- QDRANT__SERVICE__API_KEY
volumes:
- qdrant-data:/qdrant/storage
restart: unless-stopped
# The image ships no curl and no wget, so the check opens the port itself.
# `bash` explicitly, not CMD-SHELL: /dev/tcp is a bash feature and the
# image's /bin/sh is dash, where the same line is a file-not-found and the
# service reports unhealthy for ever while serving perfectly.
healthcheck:
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/6333"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
# ── Online feature store ─────────────────
# Where a feature view's latest row per key is kept FOR SERVING.
#
# MEASURED, which is why it exists. Every governed lakehouse statement costs
# ~130 ms before it reads a single row (min of 300 audited statements; p50
# 336 ms), because the access check ahead of it is a round trip to a hosted
# Postgres. That is a fair price for a dashboard and a poor one for a
# prediction, which needs the same handful of rows every time.
#
# VALKEY, NOT REDIS, and for a licence rather than a preference: Redis moved
# to RSALv2/SSPL, which this project cannot ship inside its own stack. Valkey
# is the BSD-3 fork of the same server and speaks the same protocol, so an
# operator who already runs Redis can point FEATURE_STORE_URL at it instead.
#
# NO VOLUME, DELIBERATELY. Everything in here is a copy of rows the lakehouse
# already holds, and a refresh rebuilds it. Persisting it would create a
# second source of truth with a restore path of its own — and a feature store
# that can be restored to a state the lake never had is worse than one that
# starts empty, because empty is visibly empty.
#
# PASSWORD (R411, VA-41). It was open to anything on the Compose network,
# spark-connect included, where Spark pipelines' Python UDFs run: one pipeline
# author could read or overwrite every user's online features. The installers
# generate VALKEY_PASSWORD; the app sends it (FEATURE_STORE_URL's own
# credentials win, for a managed Redis). Left empty, valkey runs without one,
# as before. Published on loopback only, for an app on the host (--dev).
valkey:
image: valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a
ports:
- "127.0.0.1:6379:6379"
command:
- valkey-server
# Persistence off on both mechanisms. `--save ""` is the documented way
# to disable snapshots; leaving the default would write an RDB into the
# container's writable layer, which is neither durable nor wanted.
- --save
- ""
- --appendonly
- "no"
- --maxmemory
- ${FEATURE_STORE_MAXMEMORY:-256mb}
# LRU rather than noeviction: a full store that starts REFUSING writes
# fails a refresh, while one that drops its coldest keys serves what it
# has and sends the rest to the lakehouse — slower, never wrong. The
# refresh records how many keys it wrote, so a store that cannot hold the
# whole view says so rather than implying it is complete.
- --maxmemory-policy
- allkeys-lru
# Empty means no password: valkey treats `--requirepass ""` as none.
- --requirepass
- ${VALKEY_PASSWORD:-}
environment:
VALKEY_PASSWORD: ${VALKEY_PASSWORD:-}
restart: unless-stopped
# The image's own client, like the catalog's pg_isready — a check that
# speaks the server's protocol is the only one that can tell "listening"
# from "answering".
# PONG, not the exit code: valkey-cli exits 0 on a NOAUTH reply too.
healthcheck:
test:
[
"CMD-SHELL",
'valkey-cli $${VALKEY_PASSWORD:+-a "$$VALKEY_PASSWORD" --no-auth-warning} ping | grep -q PONG',
]
interval: 15s
timeout: 5s
retries: 5
start_period: 10s
# ── Spark Connect server ────────────────────────
# The Spark engine's STATIC-ENDPOINT provider for one host: driver and
# executors in one JVM (local[*]). Enough to run every Spark-engine pipeline
# against MinIO and the lakehouse on a laptop; production points
# SPARK_CONNECT_URL at a real cluster instead. Kernels reach it on
# nb-internal, the same way they reach the lakehouse catalog: gRPC cannot go
# through the HTTP egress proxy. The first start downloads the S3, Delta,
# Iceberg and JDBC jars (several hundred MB) into the spark-ivy volume; later
# starts are fast.
#
# ONE VERSION SET (R459). Spark 4.1, not 4.2: Iceberg publishes a Spark
# runtime for 4.0 and 4.1 only (iceberg-spark-runtime-4.2_2.13 is not on Maven
# Central, checked 2026-11-08), so 4.2 meant Spark without Iceberg. On 4.1.4
# every piece has a build for the same Spark: Delta 4.4.1 (its _4.1 artifact),
# Iceberg 1.12.0, hadoop-aws equal to the image's own Hadoop (3.4.2; a
# different one fails at the first s3a:// read), and the sandbox image's
# pyspark-client 4.1.4. Move them together: tests/unit/sparkVersionSet.test.ts
# holds every place that names one to the same set.
#
# NO SPARK UI (R459). Spark Connect makes each request's plan the job's call
# site, and a plan carries a read's data-source options, which is where the
# S3 keys are passed (per call, so no session holds another's). The UI's job
# list showed those keys for every run to anything that could reach :4040,
# code on the cluster included. Measured on 4.2.0 and 4.1.4 alike.
#
# AUTH + non-root (VA-23). A Spark-engine pipeline runs arbitrary code on the
# driver, and this endpoint sits on nb-internal where notebook kernels live,
# so two things matter: the driver must not be root, and an unauthenticated
# kernel must not be able to drive it. The container therefore starts as root
# ONLY long enough to chown the first-boot ivy cache, then drops to the image's
# unprivileged `spark` user (uid 185) for the JVM via gosu; and the server
# enforces a pre-shared token (SPARK_CONNECT_AUTHENTICATE_TOKEN) whenever
# SPARK_CONNECT_TOKEN is set — which setup.sh generates for a new install and
# the app hands to every run as the SAME value, so the two agree by
# construction. Empty/unset SPARK_CONNECT_TOKEN = no auth, so an existing
# deployment keeps working unchanged.
spark-connect:
image: apache/spark:4.1.4-python3@sha256:847f91f8bb2f28d632064dfe632d423020f8fd60b27c7704c0e5bf5b0c6432c7
ports:
- "127.0.0.1:15002:15002"
# root only for the one-shot chown in the command below; the JVM runs as 185.
user: root
environment:
SPARK_NO_DAEMONIZE: "true"
HOME: /tmp
SPARK_CONNECT_TOKEN: ${SPARK_CONNECT_TOKEN:-}
# `$$` keeps the shell variable for container runtime; Compose would expand a
# single `$`. The stat-gate runs the recursive chown only once (the boot
# after an upgrade, when the cache is still root-owned), so later starts stay
# fast.
command:
- bash
- -c
- |
if [ "$$(stat -c %u /tmp/ivy)" != "185" ]; then chown -R spark:spark /tmp/ivy; fi
if [ -n "$$SPARK_CONNECT_TOKEN" ]; then export SPARK_CONNECT_AUTHENTICATE_TOKEN="$$SPARK_CONNECT_TOKEN"; fi
exec gosu spark /opt/spark/sbin/start-connect-server.sh \
--packages org.apache.hadoop:hadoop-aws:3.4.2,io.delta:delta-spark_4.1_2.13:4.4.1,org.apache.iceberg:iceberg-spark-runtime-4.1_2.13:1.12.0,org.apache.iceberg:iceberg-aws-bundle:1.12.0,org.postgresql:postgresql:42.7.13,com.mysql:mysql-connector-j:9.7.0,org.xerial:sqlite-jdbc:3.53.4.0 \
--conf spark.jars.ivy=/tmp/ivy \
--conf spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension,org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions \
--conf spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog \
--conf spark.driver.memory=${SPARK_CONNECT_DRIVER_MEMORY:-2g} \
--conf spark.ui.enabled=false \
--conf spark.connect.grpc.binding.port=15002
volumes:
- spark-ivy:/tmp/ivy
networks: [default, nb-internal, nb-dev]
restart: unless-stopped
# ── Server-side Office renderer ───────────────────
# python-pptx (native editable charts/tables, slides rendered by LibreOffice
# for Deep mode's review), python-docx (multi-page Word) and openpyxl (Excel
# with LibreOffice formula recalc). No env wiring needed — the app probes `docgen:8099` (in-network) and
# `localhost:8099` (published below) and uses whichever answers, falling back
# to the in-browser generators when neither does.
docgen:
build:
context: ./docgen-service
image: ${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/docgen:${AGENTSWARMS_VERSION:-local}
# No model key: Deep mode's slide review runs in the app, as the user, on
# the images this service renders (R405).
environment:
# Optional shared secret; if set, also put it in the app's DOCGEN_TOKEN.
DOCGEN_TOKEN: ${DOCGEN_TOKEN:-}
expose:
- "8099"
# Also published on the LOOPBACK interface only, so `npm run dev` on the
# host can reach it at http://localhost:8099. Without this the renderer is
# only addressable from inside the compose network, and Deep mode silently
# falls back to the browser build during local development. Bound to
# 127.0.0.1 rather than 0.0.0.0 because the service has no auth unless
# DOCGEN_TOKEN is set.
ports:
- "127.0.0.1:8099:8099"
restart: unless-stopped
# LibreOffice can wedge on a bad render; the process stays up and stops
# answering, which is exactly what `restart` cannot see.
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8099/health', timeout=5).status == 200 else 1)",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# ── JS sandbox for headless custom code ─────────
# Runs Function and custom-component snippets for DEPLOYED (API-key) and
# SCHEDULED swarm runs. The canvas keeps using the in-browser Worker sandbox;
# this exists so the same node also works unattended.
#
# It is a separate container because the app process holds the service-role
# key and provider credentials — user JavaScript must never share a realm
# with those. Everything below is the isolation, and it is deliberately
# stricter than the notebook runtime because a snippet needs nothing:
# js-internal no route to the internet AND none back to the app
# read_only nothing on disk can be modified
# cap_drop ALL no privileged syscalls
# no-new-privileges a setuid binary cannot escalate
# pids/mem/cpu limits a runaway snippet cannot starve the host
# Inside the process each request additionally gets a fresh V8 realm in a
# worker thread that is terminated afterwards (services/js-sandbox).
#
# Enable with:
# docker compose up -d --build
# JS_SANDBOX_URL=http://js-sandbox:8091 (in .env; already the default
# the app tries, so this line is only needed if you rename/move it)
js-sandbox:
build:
context: ./services/js-sandbox
image: ${AGENTSWARMS_REGISTRY:-ghcr.io/agentswarms-fyi}/js-sandbox:${AGENTSWARMS_VERSION:-local}
environment:
PORT: "8091"
# Shared secret with the app: INTERNAL_RUN_SECRET (setup.sh generates
# one). An install without it still works: the service gets the
# service-role key instead, KIND says so (empty = the key), and both
# sides derive the same secret from it, so the key itself never travels
# in a request header (R463).
INTERNAL_RUN_SECRET: ${INTERNAL_RUN_SECRET:-${SUPABASE_SERVICE_ROLE_KEY}}
INTERNAL_RUN_SECRET_KIND: ${INTERNAL_RUN_SECRET:+own}
JS_SANDBOX_MAX_TIMEOUT_MS: ${JS_SANDBOX_MAX_TIMEOUT_MS:-5000}
JS_SANDBOX_MAX_CONCURRENT: ${JS_SANDBOX_MAX_CONCURRENT:-4}
JS_SANDBOX_MEM_MB: ${JS_SANDBOX_MEM_MB:-128}
expose:
- "8091"
# Loopback-scoped, never 0.0.0.0: this endpoint executes code, and its only
# guard is the shared secret.
#
# NOTE this binding does not take effect as long as the service sits only on
# `js-internal` (internal: true) below — Docker publishes no host port from
# an internal-only network, and you get NetworkSettings.Ports "8091/tcp":[].
# That is intended: under Compose the app reaches the sandbox in-network as
# js-sandbox:8091 and no host port is wanted. It is kept as a safety net, so
# that if the network is ever made routable the port lands on loopback
# rather than every interface. To reach the sandbox from `npm run dev` on
# the host, run the service directly instead — see docs/DEPLOYMENT.md.
ports:
- "127.0.0.1:8091:8091"
networks: [js-internal]
read_only: true
security_opt:
- no-new-privileges:true
cap_drop: [ALL]
pids_limit: 128
mem_limit: 512m
cpus: 1.0
tmpfs:
- /tmp:size=16m,mode=1777
restart: unless-stopped
# A snippet that pins the event loop leaves the process up and deaf. The
# image is node:22-slim, so node itself is the only client available.
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://127.0.0.1:8091/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
# Network topology for the runtime (egress control):
# nb-internal — internal:true, so kernels have NO direct internet. Members:
# app, gateway, egress proxy, and the per-session kernels.
# default — has internet. Members: app, gateway, egress, docker-proxy.
# Kernels sit on nb-internal ONLY: they can reach the app (callbacks) and the
# egress proxy, but the only route off-box is the allowlisted proxy.
networks:
default: {}
# The JS sandbox sits here alone: internal:true means no internet, and the
# app reaches it because the app joins this network too (see below). The
# sandbox itself can initiate nothing — it only answers.
js-internal:
name: agentswarms_js-internal
internal: true
nb-internal:
name: agentswarms_nb-internal
internal: true
# Used only when the app runs on the HOST (npm run dev): kernels need a route
# back to the host, which an `internal` network cannot provide. Same DNS and
# gateway reachability, weaker egress isolation — dev only.
nb-dev:
name: agentswarms_nb-dev
# The Docker socket proxy and the app, and nothing else (VA-40). Internal,
# because only an internal network keeps other networks out: a container on
# a routable one was reachable by IP from other networks whenever it
# published a port (measured on Docker Desktop, R408).
docker-api:
name: agentswarms_docker-api
internal: true
volumes:
lakehouse-catalog-data:
lake-data:
spark-ivy:
qdrant-data: