Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
901 lines (882 loc) · 49.3 KB
/
Copy pathdocker-compose.yml
File metadata and controls
901 lines (882 loc) · 49.3 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
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
# ottr compose topology: one host, the board (service server) + disposable workers.
#
# `docker compose up -d --build` builds ottr-worker:local (or OTTR_IMAGE) and starts the server
# plus worker-a/worker-b. Provider keys (ANTHROPIC_API_KEY, OPENAI_API_KEY, ...)
# must exist in the host shell — they are passed through, never baked.
# Worker containers are NEVER port-mapped to the host; only the board's
# UI port is exposed, on loopback.
name: ottr
# json-file never rotates; `local` rotates and compresses. 3 x 10m caps each container at 30 MB.
# Podman has no `local` driver: set OTTR_LOG_DRIVER=k8s-file there (README, Podman).
x-logging: &logging
driver: ${OTTR_LOG_DRIVER:-local}
options: { max-size: "10m", max-file: "3" }
x-worker: &worker
image: ${OTTR_IMAGE:-ottr-worker:local}
command: bun /app/src/worker.ts
restart: always
# tini as PID 1 reaps the orphans that omp and test runs leave behind: with bun as
# PID 1, worker-a held 5,434 zombies after 7 hours.
init: true
# `up -d --wait <worker>` (the rolling update) waits for this: the worker answers its
# own GET /healthz, so a recreated worker counts as done only when it is connected.
healthcheck: &worker-healthcheck
test:
- CMD
- bun
- -e
# Quoted: the plain scalar's " : " made YAML read this item as a mapping.
- "process.exit((await fetch('http://127.0.0.1:' + (process.env.WORKER_PORT || 8787) + '/healthz')).ok ? 0 : 1)"
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
logging: *logging
# ponytail: estimate (Chrome + bun test + agent turns), not a measured peak. Run
# `docker stats` under load and set about 2x the peak in the compose env file.
mem_limit: ${OTTR_WORKER_MEM_LIMIT:-8g}
# Run limits (docs/specs/turn-resource-limits.md): a private cgroup namespace with
# the container's own subtree writable (Docker Engine 28.0 and later), so each run
# gets its own CPU and process cap. Podman and an older Docker do not know
# writable-cgroups: remove that line there. Run cgroups then stay off, and the
# board shows the limits-off finding (docs/WORKERS.md, "Run limits").
cgroup: private
security_opt:
- writable-cgroups=true
# Stateless: task data for workers (sessions, logs, images) lives on the ottr-data
# volume, clones and worktrees on workspace. Both mount at the server's paths, so
# the absolute paths in a run request resolve the same. A dead worker is replaced
# by starting a new one.
volumes:
- workspace:/workspace
- ottr-data:/data
# Agent layer (rules, config, skills, plugins): alate provisions it here as layers
# under /root/.alate/layers/<id> and switches /root/.alate/current with one atomic
# rename (docs/specs/agent-layer-switch.md). A turn pins the layer it started with:
# its HOME and agent dir resolve once at spawn and stay there for the run's life.
# Shared state (agent.db, oauth, logs, caches, git/gh config) stays at its flat path
# and is linked into each layer. Since OTTR-994 a turn no longer runs as root with
# this home as HOME: it runs as its project's own uid with HOME at
# /turn-homes/<project> or that project's copy of the pinned layer, so a project's
# turn can plant only what its own project's turns later load (R5-1, see the server
# env). The board pins its git/gh config and its own omp agent dir to the
# server-only board-config volume and never copies from this home.
- home:/root
# OTTR-994 per-project turn homes: a turn runs as its project's own uid with
# HOME at /turn-homes/<project> (or its per-project layer copy under it), and
# the daemon provisions the project's tools, venv and caches there
# (docs/specs/worker-turn-uid-isolation.md). One dir per project, owned by the
# project's turn uid.
- turn-homes:/turn-homes
# Credentials stay on the host; the named home volume holds writable
# state and the oauth dir is mounted read-only over it.
- ${OTTR_OAUTH_DIR:?set OTTR_OAUTH_DIR to the host omp oauth dir}:/root/.omp/oauth:ro
# omp keeps provider auth in agent.db: one file for the stack, seeded once from the host
# db (VACUUM INTO) and never baked; the stack then logs in by itself (docs/WORKERS.md).
- ${OTTR_AGENT_DB:?set OTTR_AGENT_DB to a snapshot file of the host omp agent.db}:/root/.omp/agent/agent.db
# BuildKit sidecar (the `build` profile below, OTTR-785): the client certificate
# and CA only, read-only. Never the daemon key (buildkit-daemon-certs) or the CA
# key, which lives only inside the buildkit-certs one-off and dies with it. The
# volumes stay empty until the profile runs; a turn without the profile then has
# no client certificate, and buildctl is absent from the turn env.
- buildkit-client-certs:/certs/buildkit/client:ro
- buildkit-ca:/certs/buildkit/ca:ro
environment:
# Server-to-worker auth, required and random: turns share this network, so a known
# value would let them drive any worker (workers strip it from every turn's env).
OTTR_WORKER_TOKEN: ${OTTR_WORKER_TOKEN:?set OTTR_WORKER_TOKEN to a random secret}
# Fleet memory: the board derives the backend from this env at every omp
# spawn and passes a --config overlay (/data/omp-memory.yml). A non-empty
# HINDSIGHT_API_URL picks hindsight against the shared Hindsight server
# (set it in the compose env file or the host shell); an empty value keeps
# omp's mnemopi default. A URL saved under Settings -> Hindsight beats this
# env seed at the next boot. The tenant API key is set under Settings ->
# Hindsight: the key still travels as HINDSIGHT_API_TOKEN, so the board can
# save it; the key stays on the board (turns reach memory through the
# board's /hindsight proxy with per-run tokens, docs/specs/hindsight-bank-binding.md).
# An env file value only seeds it (and serves omp run by hand in a
# container).
HINDSIGHT_API_URL: ${HINDSIGHT_API_URL:-}
HINDSIGHT_API_TOKEN: # seed only: Settings -> Hindsight (server URL and key) replaces it, as in x-worker
# Isolated PostgreSQL tests only. Never pass the production OTTR_DATABASE_URL.
OTTR_TEST_PG_URL: ${OTTR_TEST_PG_URL:-}
OTTR_REQUIRE_PG_TESTS: ${OTTR_REQUIRE_PG_TESTS:-}
# No GitHub token here: workers run turns only, and push credentials stay on the
# server (D6). The worker daemon strips GH_TOKEN and every git host credential from
# each turn's env, so a token set here would never reach a turn.
# Project tools and env names come from the data repo instead
# (workers/<project>/tools.json and env.txt, docs/WORKERS.md).
# BuildKit sidecar (the `build` profile): empty keeps every turn without image
# builds. The compose env file sets all four together with COMPOSE_PROFILES=build
# (the OTTR_VM_RUNNER_URL pattern). buildctl reads the address from BUILDKIT_HOST;
# the TLS paths have no env form, so turns pass the BUILDKIT_TLS_* values as flags:
# buildctl --tlscacert "$BUILDKIT_TLS_CA" --tlscert "$BUILDKIT_TLS_CERT" \
# --tlskey "$BUILDKIT_TLS_KEY" build ...
# (docs/WORKERS.md "Image builds in turns", spec docs/specs/turn-image-builds.md).
BUILDKIT_HOST: ${BUILDKIT_HOST:-}
BUILDKIT_TLS_CA: ${BUILDKIT_TLS_CA:-}
BUILDKIT_TLS_CERT: ${BUILDKIT_TLS_CERT:-}
BUILDKIT_TLS_KEY: ${BUILDKIT_TLS_KEY:-}
# Every worker joins the buildkit network, so a build turn reaches the daemon over
# mTLS. The server never joins it: no route from the board's container (acceptance).
networks:
- default
- buildkit
services:
server:
build:
context: .
dockerfile: Dockerfile.worker
args:
OTTR_VERSION: ${OTTR_VERSION:-}
image: ${OTTR_IMAGE:-ottr-worker:local}
command: bun /app/src/server.ts
init: true # reaps orphans as on the workers (148 zombies here after 7 hours, 2026-10-12)
# With the bundled profile on, the boot-time Alate pull must wait for its listener.
# Keep external-Alate deployments valid when the optional service is disabled.
depends_on:
alate:
condition: service_healthy
required: false
logging: *logging
# Estimate: the board runs merge, release, and retro turns itself (bun test included).
mem_limit: ${OTTR_SERVER_MEM_LIMIT:-8g}
networks:
default:
aliases: [ottr] # turns file cards at http://ottr:<port> (OTTR_BOARD_URL below)
# Stable identity for the instance lock (src/dblock.ts): its rows carry this hostname (the
# running stack's, 2026-10-12), and a recreate under another one refuses to boot. Rows an
# earlier container left behind are taken over (their holder booted before this init).
# ponytail: a `docker compose run server` one-off gets the same identity and could take
# the lock; acceptable for this stack shape.
hostname: ottr-server
healthcheck:
test:
- CMD
- bun
- -e
# Quoted: the plain scalar's " : " made YAML read this item as a mapping.
- "process.exit((await fetch('http://127.0.0.1:' + process.env.PORT + '/api/boot')).ok ? 0 : 1)"
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
ports:
# Same port on both sides: the host guard and Origin allowlist accept the app's own
# port. The connection arrives from the Docker gateway, not loopback, so the board asks
# for the admin login. Loopback only: the guards read the Host header, which any LAN
# client can fake.
- "127.0.0.1:${OTTR_PORT:-8080}:${OTTR_PORT:-8080}"
# Sign-in callbacks (Settings -> Provider sign-in): the provider sends the browser to
# localhost:<port>, which on this machine reaches the board; it hands the address to the
# waiting `omp login`. Anthropic, then OpenAI Codex. Codex's port is fixed, so while the
# stack runs, `omp login openai-codex` on the host cannot bind it.
- "127.0.0.1:54545:${OTTR_PORT:-8080}"
- "127.0.0.1:1455:${OTTR_PORT:-8080}"
# Settings -> omp usage -> Launch omp stats dashboard: the board-guarded proxy to
# `omp stats`. Same port on both sides for its host guard. Like the board port, it
# asks for the admin login. Keep a real port number here: to disable the proxy, set
# the server's OTTR_OMP_STATS_PORT below to off and delete this line.
- "127.0.0.1:${OTTR_OMP_STATS_PORT:-3848}:${OTTR_OMP_STATS_PORT:-3848}"
restart: unless-stopped
volumes:
- workspace:/workspace
- ottr-data:/data # per-project task data for workers (OTTR_DATA_DIR): sessions, logs, images, handoffs
- home:/root
# R5-1: the board's pinned git/gh config and omp agent dir. Server-only: workers never
# mount it. Survives recreates. Only the trusted board-seed one-off fills the agent dir.
- board-config:/etc/ottr
- ottr-state:/app/.tasks # GlobalStore SQLite and the per-project tasks.db files. No worker mounts it.
# Daily snapshots of tracker.db and each tasks.db (docs/specs/db-backup.md). Server-only
# as ottr-state: a snapshot holds the same tokens. Set OTTR_BACKUP_MOUNT in the env file
# to a host path on another disk.
- ${OTTR_BACKUP_MOUNT:-ottr-backup}:/backup
# Same read-only credential mount as the workers.
- ${OTTR_OAUTH_DIR:?set OTTR_OAUTH_DIR to the host omp oauth dir}:/root/.omp/oauth:ro
- ${OTTR_AGENT_DB:?set OTTR_AGENT_DB to a snapshot file of the host omp agent.db}:/root/.omp/agent/agent.db
environment:
OMP_TRACKER_HOST: 0.0.0.0 # default is loopback, which dead-ports through the mapping
OMP_TRACKER_ROOTS: /workspace
OTTR_DATA_DIR: /data # task data outside the clones: /data/<project>
# Server-only project state (tasks.db with settings and task rows, fork caches) and
# the board-side omp --config overlays (plugin skills) on the ottr-state volume,
# which no worker mounts. /data keeps only what workers need.
OTTR_SERVER_DATA_DIR: /app/.tasks/projects
# Server-only ssh keys and known_hosts : on the ottr-state
# volume, which no worker mounts. /data and /root are worker-mounted, so never there.
OTTR_SSH_DIR: /app/.tasks/ssh
OTTR_BACKUP_DIR: /backup
OTTR_BACKUP_KEEP: ${OTTR_BACKUP_KEEP:-7} # snapshots to keep; 0 turns the backups off
# Test infrastructure only; no product PostgreSQL backend on this card.
OTTR_TEST_PG_URL: ${OTTR_TEST_PG_URL:-}
OTTR_REQUIRE_PG_TESTS: ${OTTR_REQUIRE_PG_TESTS:-}
OTTR_WORKER_URLS: http://worker-a:8787,http://worker-b:8787
# The microVM runner (the `vm` profile below): empty keeps every turn on the classic
# workers, and the board holds the work turns of a project with microVMs on (the
# card waits) instead of running them in a shared container. Set it to
# http://vm-runner:8787 when the profile runs (COMPOSE_PROFILES=vm in the env file).
OTTR_VM_RUNNER_URL: ${OTTR_VM_RUNNER_URL:-}
OTTR_WORKER_TOKEN: ${OTTR_WORKER_TOKEN:?set OTTR_WORKER_TOKEN to a random secret}
PORT: ${OTTR_PORT:-8080}
# The omp stats dashboard proxy port (docs/specs/omp-stats-dashboard.md); 0/off disables.
# Recreate the stack once after a change, so Docker publishes the new port.
OTTR_OMP_STATS_PORT: ${OTTR_OMP_STATS_PORT:-3848}
# Where turns file cards (create_task). Loopback in a worker is the worker itself; the
# board opens this host to card filing only, with the token it gives each turn.
OTTR_BOARD_URL: http://ottr:${OTTR_PORT:-8080}
# GitHub host pass-through (src/githubHost.ts): the board reads OTTR_GITHUB_HOST;
# empty keeps the default github.com. README "GitHub host" has the values.
OTTR_GITHUB_HOST: ${OTTR_GITHUB_HOST:-}
# Boot-report pass-through (docker/ottr-entry.sh logs them once, before its
# refusal checks): a stale OTTR_IMAGE or old host path left in the shell beats
# .env and silently keeps the previous release (README, Podman); the boot line
# shows the live values even when the entry refuses to start. Dedicated names:
# OTTR_OAUTH_DIR/OTTR_AGENT_DB must stay OUT of the container env, because the
# entry script's refusal checks fall back to the container-side fixed paths and
# a host path string in the env would fail them on every start.
OTTR_PINNED_IMAGE: ${OTTR_IMAGE:-}
OTTR_PINNED_OAUTH_DIR: ${OTTR_OAUTH_DIR:-}
OTTR_PINNED_AGENT_DB: ${OTTR_AGENT_DB:-}
# R5-1 config boundary: workers mount home:/root and workspace:/workspace read-write,
# so a turn can plant /root/.gitconfig, /root/.config/gh or a main checkout's
# .git/config for the board's own git and gh to execute (helper theft, insteadOf
# redirects, ext:: remotes). The board reads its global git config and its gh config
# only from the board-config volume, which no worker mounts. The entry script never
# copies from the shared home: an absent git config starts with the fixed Ottr
# identity only, gh starts empty on purpose (gh config can name commands). The main
# checkout's .git/config stays worker-writable by construction of linked worktrees —
# residual, docs/WORKERS.md.
GIT_CONFIG_GLOBAL: /etc/ottr/gitconfig
GH_CONFIG_DIR: /etc/ottr/gh
# R5-1 omp layer: the board's own omp agent dir (config.yml, agent.db, skills,
# extensions, sessions) lives on the board-config volume, which no worker mounts, so
# a turn cannot plant config or code the board's privileged turns (merge, release
# review, release) would read or execute. The entry script never copies it from the
# shared home: it starts empty and the entry script logs that it is unseeded while
# no layer seeds the board home either. The board-seed one-off fills the board home
# from the data repo; the board's own turns pin the current board-home layer at
# spawn, and HOME and this variable then point into the layer dir for that run
# (docs/specs/agent-layer-switch.md). This flat path stays the no-layer fallback and
# the location of the credential store, which every layer links. Settings sign-in
# runs one omp login for this store and a second one for the shared worker store, so
# each store keeps its own refresh token (docs/specs/provider-credentials.md).
PI_CODING_AGENT_DIR: /etc/ottr/home/.omp/agent
# R5-1: omp reads its plugins ($HOME/.omp/plugins) and the user skills and context
# files (~/.agents, ~/.claude, ...) from HOME, never from PI_CODING_AGENT_DIR, and HOME
# here is the worker-writable shared home. The board's own omp spawns (merge, release
# review, release, models, usage, sign-in) run with this server-only HOME instead,
# the one board-seed installs into: board-seed installs the agent layer here under
# .alate/layers/<id> and switches .alate/current with one atomic rename, and the
# board's spawns pin the layer the link names at spawn. The flat copy of the layer
# remains only as the no-layer fallback. The board's own reads of the shared home
# (apt lists, shared store) keep /root.
OTTR_BOARD_OMP_HOME: /etc/ottr/home
# One shared home volume carries one agent config. The server writes the
# memory overlay to OTTR_DATA_DIR=/data ($OTTR_DATA_DIR/omp-memory.yml);
# the workers resolve the same path, and the board passes it as --config
# at every spawn — server-side runs included.
# memory.backend is not agent-layer content (OTTR-453): the pin never
# rewrites a layer's config.yml.
HINDSIGHT_API_URL: ${HINDSIGHT_API_URL:-}
# Seed only: Settings -> Hindsight (server URL and key) replaces it. The key stays
# on the server: turns reach memory through the board's /hindsight proxy with
# per-run tokens bound to their project bank (docs/specs/hindsight-bank-binding.md).
HINDSIGHT_API_TOKEN:
# Alate pairing (the `alate` profile below): these seed Settings -> Alate while it
# holds no URL or key, and a value saved there wins at the next boot. With the
# profile on, http://alate:4570 is the bundled service. Never log the key.
COMPOSE_PROFILES: ${COMPOSE_PROFILES:-}
ALATE_URL: ${ALATE_URL:-}
ALATE_API_KEY: ${ALATE_API_KEY:-}
# Provider keys pass through from the host env. Extend this list for
# other providers (e.g. OPENROUTER_API_KEY, ZAI_API_KEY).
ANTHROPIC_API_KEY:
OPENAI_API_KEY:
worker-a:
<<: *worker
build:
context: .
dockerfile: Dockerfile.worker
worker-b:
<<: *worker
# Copy-paste this block for worker-c..h and add each to OTTR_WORKER_URLS.
# Do NOT use `compose --scale`: round-robin DNS breaks cancel routing —
# per-run addressability requires stable per-worker names.
# Disposable PostgreSQL 18 tests only (docs/development.md). Trust is an explicit
# isolated-test exception: no credentials, production data, or host port.
postgres-test:
image: docker.io/library/postgres:18.6@sha256:e3d24f6906d0760bf4da0dae872415391ededefad23fd471c47dc53b0ddf3c42
profiles: [pgtest]
logging: *logging
networks:
- default
tmpfs:
- /var/lib/postgresql
environment:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: postgres
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"]
interval: 5s
timeout: 5s
retries: 12
start_period: 10s
# Rootless BuildKit sidecar (OTTR-785, spec docs/specs/turn-image-builds.md): lets a
# work turn build container images (Dockerfile.worker, project Dockerfiles) with no
# host docker access, no host socket and no privileged mode. Off unless the env file
# sets COMPOSE_PROFILES=build together with the BUILDKIT_* values the x-worker anchor
# passes through. The daemon holds no credentials, publishes no port, and answers
# only workers that present the client certificate (mTLS). Podman has no
# systempaths=unconfined, so the profile is Docker-only (README, Podman).
buildkit:
# Digest-pinned 2026-11-28 (multiarch index). The image runs as uid 1000; its
# rootlesskit entrypoint sets up the user namespace, so build steps never run as
# real root on the host.
image: moby/buildkit:v0.35.1-rootless@sha256:7d02292556e66feea6d2d89b7ec143503b57e4f59a4efc6b7ece8547e4d3e5be
profiles: [build]
restart: unless-stopped
logging: *logging
# One build cannot starve turns: build steps run inside this cgroup.
mem_limit: ${OTTR_BUILDKIT_MEM_LIMIT:-8g}
cpus: "${OTTR_BUILDKIT_CPUS:-4}"
depends_on:
buildkit-certs:
condition: service_completed_successfully
# The BuildKit rootless docs' container mode (moby/buildkit docs/rootless.md):
# runc inside the daemon's user namespace needs unshare and mount (seccomp,
# apparmor), and each build step needs its own /proc (systempaths). The alternative
# the docs name, --oci-worker-no-process-sandbox, is discouraged there: it cannot
# kill build steps that fail to exit, and it lets a build step kill or ptrace daemon
# processes. This daemon runs untrusted build steps from agent turns, so the docs'
# primary mode wins, and the tradeoff lands on a secretless sidecar: uid 1000, no
# credentials, reachable only from workers over mTLS.
security_opt:
- seccomp=unconfined
- apparmor=unconfined
- systempaths=unconfined
networks:
- buildkit
volumes:
# The daemon key lives only here; no worker mounts this volume. The gc policy
# (OTTR_BUILDKIT_CACHE_CAP, default 20 GB) is in buildkit-config.
- buildkit-config:/config:ro
- buildkit-ca:/certs/ca:ro
- buildkit-daemon-certs:/certs/daemon:ro
- buildkit-state:/home/user/.local/share/buildkit
command:
# buildkitd flags (the image entrypoint is `rootlesskit buildkitd`): mTLS on tcp
# 1234 only, and the cache-cap config the one-off wrote. A partial config is safe:
# the rootless defaults (state under $HOME) come from the user namespace, not
# from the file.
- --config
- /config/buildkitd.toml
- --addr
- tcp://0.0.0.0:1234
- --tlscacert
- /certs/ca/ca.pem
- --tlscert
- /certs/daemon/cert.pem
- --tlskey
- /certs/daemon/key.pem
# One-shot seed of the BuildKit TLS material (the `build` profile): generates the CA,
# the daemon (server) cert and the one client cert, plus the cache-cap config, into
# the named volumes. Idempotent: with all six outputs present it chowns the state
# volume for the daemon user and exits 0, so `up` can rerun it. The CA key is
# generated in /tmp and discarded there: it never lands in a volume, so no container
# can mint more certificates. Rotation: remove the four cert volumes, then
# docker compose --profile build up -d --force-recreate buildkit worker-a worker-b
# (docs/WORKERS.md "Image builds in turns").
buildkit-certs:
image: ${OTTR_IMAGE:-ottr-worker:local}
profiles: [build]
restart: "no"
logging: *logging
mem_limit: ${OTTR_BUILDKIT_CERTS_MEM_LIMIT:-1g}
entrypoint:
- sh
- -c
- |
set -eu
openssl version
if [ -f /certs/ca/ca.pem ] && [ -f /certs/daemon/cert.pem ] && \
[ -f /certs/daemon/key.pem ] && [ -f /certs/client/cert.pem ] && \
[ -f /certs/client/key.pem ] && [ -f /config/buildkitd.toml ]; then
chown 1000:1000 /state
echo "buildkit certs and config exist; keeping them"
exit 0
fi
umask 077
mkdir -p /certs/ca /certs/daemon /certs/client /config /state
rm -f /certs/ca/ca.pem /certs/daemon/cert.pem /certs/daemon/key.pem \
/certs/client/cert.pem /certs/client/key.pem /config/buildkitd.toml
# CA. The key stays in /tmp and dies with the one-off container.
openssl genrsa -out /tmp/ca.key 4096
openssl req -x509 -new -sha256 -days 3650 -key /tmp/ca.key \
-subj /CN=ottr-buildkit-ca -out /certs/ca/ca.pem
# Daemon (server) cert: the compose DNS name is the SAN, so the workers'
# buildctl verifies the daemon it reached as "buildkit".
openssl genrsa -out /tmp/daemon.key 4096
openssl req -new -sha256 -key /tmp/daemon.key -subj /CN=buildkit -out /tmp/daemon.csr
printf 'basicConstraints=CA:FALSE\nkeyUsage=digitalSignature,keyEncipherment\nextendedKeyUsage=serverAuth\nsubjectAltName=DNS:buildkit,IP:127.0.0.1\n' > /tmp/daemon.ext
openssl x509 -req -sha256 -days 3650 -in /tmp/daemon.csr \
-CA /certs/ca/ca.pem -CAkey /tmp/ca.key -CAcreateserial \
-extfile /tmp/daemon.ext -out /certs/daemon/cert.pem
install -o 1000 -g 1000 -m 0400 /tmp/daemon.key /certs/daemon/key.pem
# Client cert: the one certificate a turn can hold. Workers run as root.
openssl genrsa -out /tmp/client.key 4096
openssl req -new -sha256 -key /tmp/client.key -subj /CN=ottr-buildctl -out /tmp/client.csr
printf 'basicConstraints=CA:FALSE\nkeyUsage=digitalSignature,keyEncipherment\nextendedKeyUsage=clientAuth\n' > /tmp/client.ext
openssl x509 -req -sha256 -days 3650 -in /tmp/client.csr \
-CA /certs/ca/ca.pem -CAkey /tmp/ca.key -CAcreateserial \
-extfile /tmp/client.ext -out /certs/client/cert.pem
install -m 0400 /tmp/client.key /certs/client/key.pem
chmod 0444 /certs/ca/ca.pem /certs/daemon/cert.pem /certs/client/cert.pem
openssl verify -CAfile /certs/ca/ca.pem /certs/daemon/cert.pem /certs/client/cert.pem
# One fleet-wide gc policy keeps the cache under the cap (default 20 GB).
# gcpolicy is an ARRAY of tables in buildkitd's config (upstream
# docs/buildkitd.toml.md): a single table is not the documented shape.
cat > /config/buildkitd.toml <<EOF
# Generated by buildkit-certs. Do not edit in place: rotate the cert volumes
# and rerun the one-off (docs/WORKERS.md "Image builds in turns").
[worker.oci]
gc = true
[[worker.oci.gcpolicy]]
reservedSpace = "4GB"
maxUsedSpace = "${OTTR_BUILDKIT_CACHE_CAP:-20GB}"
minFreeSpace = "5GB"
keepDuration = 172800
EOF
# The daemon runs as uid 1000: the config must be world-readable, or
# buildkitd exits with "failed to load config from /config/buildkitd.toml".
chmod 0444 /config/buildkitd.toml
chown 1000:1000 /state
rm -f /tmp/ca.key /tmp/daemon.key /tmp/client.key /tmp/daemon.csr \
/tmp/client.csr /tmp/daemon.ext /tmp/client.ext
echo "buildkit certs and config written"
volumes:
- buildkit-ca:/certs/ca
- buildkit-daemon-certs:/certs/daemon
- buildkit-client-certs:/certs/client
- buildkit-config:/config
- buildkit-state:/state
# The microVM runner (OTTR-532): runs every work turn of a project with microVMs on
# (Settings) in its own Firecracker microVM, so a turn sees its own clone and nothing of
# the other projects, the shared home or the credentials. It speaks the worker protocol
# to the board at http://vm-runner:8787 (server env OTTR_VM_RUNNER_URL). Off unless the
# env file sets COMPOSE_PROFILES=vm (also what scripts/update-image.ts needs to build and
# roll it); the host needs /dev/kvm (bare metal, a KVM VM with nested virtualisation, or
# WSL2 with nestedVirtualization). Its image is the worker image plus Firecracker and the
# guest kernel (Dockerfile.worker, target vm-runner), and the guests boot from its root.
vm-runner:
build:
context: .
dockerfile: Dockerfile.worker
target: vm-runner
args:
OTTR_VERSION: ${OTTR_VERSION:-}
image: ${OTTR_VM_IMAGE:-ottr-vm-runner:local}
profiles: [vm]
restart: always
init: true # reaps the firecracker processes and the image tools it runs, as on the workers
logging: *logging
healthcheck: *worker-healthcheck
# Guest memory is firecracker's own memory, counted in this container: the limit must
# cover OTTR_VM_MAX x OTTR_VM_MEM (10 x 8g by default) plus the runner and its disk
# builds, or the kernel kills a VM mid-turn. Raise it with either value.
mem_limit: ${OTTR_VM_RUNNER_MEM_LIMIT:-20g}
# The only privileges it gets, no `privileged`:
devices:
- /dev/kvm # firecracker runs each guest on KVM
- /dev/net/tun # one tap device per VM, its only network link
cap_add:
# Creates the taps and their addresses, and the iptables rules that let a VM reach
# the board and the internet but no other compose service, VM or this runner's API.
- NET_ADMIN
sysctls:
# Routes VM traffic out through this container. A per-container (netns) setting:
# the host's own forwarding stays as it is. /proc/sys is read-only in here.
net.ipv4.ip_forward: "1"
# No workspace, no credential mounts: a VM clones its branch from the board's git
# endpoint and reaches providers through the board's /llm proxy.
volumes:
- ottr-data:/data # copies a turn's task data in and its new files back out
- home:/root:ro # the pinned agent layer copy (read only); lists ride the vm dispatch
- vm-state:/var/lib/ottr-vm # base rootfs, project layers, scratch disks: large
environment:
# The same server-to-worker auth as the workers (x-otwr-token on every call).
OTTR_WORKER_TOKEN: ${OTTR_WORKER_TOKEN:?set OTTR_WORKER_TOKEN to a random secret}
# VMs at once; one more /run answers 503 busy, and the card waits for a free slot.
OTTR_VM_MAX: ${OTTR_VM_MAX:-10}
OTTR_VM_VCPUS: ${OTTR_VM_VCPUS:-2}
OTTR_VM_MEM: ${OTTR_VM_MEM:-8g} # per VM: 8g, 8192m or bytes
OTTR_VM_DISK: ${OTTR_VM_DISK:-20g} # per VM scratch disk (sparse)
# Copy-out byte budgets: one changed file, then the whole transfer. A guest
# above either ends the copy-out instead of filling the shared ottr-data volume.
OTTR_VM_COPY_OUT_MAX_FILE: ${OTTR_VM_COPY_OUT_MAX_FILE:-256m}
OTTR_VM_COPY_OUT_MAX_TOTAL: ${OTTR_VM_COPY_OUT_MAX_TOTAL:-1g}
# The board's compose name: the VM's /etc/hosts maps it to the board's address, so
# OTTR_BOARD_URL (http://ottr:<port>) works unchanged inside the VM.
OTTR_VM_BOARD_HOST: ottr
# R5-1 trusted seed of the board-config volume: a one-off of the Alate image. It restores
# the user layer from the data repo with the same SkillSpector scan as worker provisioning
# (fail-closed), then installs the rules. It installs into /etc/ottr/home/.alate/layers/<id>
# and switches /etc/ottr/home/.alate/current with one atomic rename, and keeps writing
# /etc/ottr/seed-commit next to the home (the paired alate change is ALAT-63). Safe while
# turns run: they keep the layer they pinned at spawn, and new turns pin the new layer, so
# a seed needs no restart. The profile keeps `docker compose up` from starting it. Usage:
# docker compose run --rm board-seed --repo <owner/name>
# docker compose run --rm -v <data-repo>:/data:ro board-seed --data /data
# then `docker compose restart server` (a restart re-derives the memory
# backend from the env).
# --force: the data repo wins over board-local edits. Plugins install into the layer the
# switch selects: the server's OTTR_BOARD_OMP_HOME tree, the HOME that the board's own
# omp reads plugins and user skills from.
board-seed:
image: ${ALATE_IMAGE:-ghcr.io/ottr-ai/alate:latest}
profiles: [seed]
logging: *logging
mem_limit: ${OTTR_SEED_MEM_LIMIT:-4g} # estimate: git clone, SkillSpector scan, installs
volumes:
- board-config:/etc/ottr
environment:
GH_TOKEN: ${GH_TOKEN:-} # clones a private data repo
entrypoint:
- sh
- -c
# install-user's exit alone no longer gates the rules sync: a per-item failure
# (exit 1, results file fatal false) still runs the flat rules sync with its own
# <results>.external-rules.json file, so the seed the update script classifies
# is complete. --layer makes the run layer mode (the switch the partial outcome
# needs); the update script's classifier fails on flat proof. The fatal guard is
# whitespace-tolerant: writeProvisionResults pretty-prints the JSON. A fatal
# refusal skips the sync (nothing was installed), and without the results env
# (a plain manual run) the old success-only sequence holds. The exit folds both
# scripts: non-zero when either failed. The external sync's result file is its
# own: install-user's nested sync already writes <results>.rules.json, and a
# classifier that could not tell the two apart would accept the nested file as
# the external sync's proof after an external crash. The scalar is single-
# quoted: the guard's ": *" would parse as a YAML alias in a plain scalar.
- 'node install-user.mjs --home /etc/ottr/home --layer --force "$$@"; rc=$$?; R="$${ALATE_PROVISION_RESULTS:-}"; if [ -n "$$R" ] && [ -f "$$R" ] && ! grep -q ''"fatal": *true'' "$$R"; then ALATE_PROVISION_RESULTS="$$R.external-rules.json" node sync.mjs /etc/ottr/home/.omp/agent/rules "$$@"; s=$$?; [ "$$s" -eq 0 ] || rc=$$s; elif [ "$$rc" -eq 0 ]; then node sync.mjs /etc/ottr/home/.omp/agent/rules "$$@"; s=$$?; [ "$$s" -eq 0 ] || rc=$$s; fi; exit $$rc'
- board-seed
# Repair for the empty agent.db folder: a wrong OTTR_AGENT_DB host path makes rootful
# Podman create an empty folder, and the home volume keeps it — the bind mount then
# fails on every recreate with `crun: mount ... agent.db: Not a directory`, because
# the folder is only reachable from a container that does NOT bind the failing path.
# This one-off mounts the home volume WITHOUT the agent.db bind and removes the empty
# folder (only an empty one; a non-empty folder or a real file is refused). The image
# entrypoint /ottr-entry.sh handles it: first argument repair-agent-db. Usage:
# docker compose run --rm home-repair
home-repair:
image: ${OTTR_IMAGE:-ottr-worker:local}
profiles: [repair]
logging: *logging
volumes:
- home:/root
command: [repair-agent-db]
# Optional package mirror (OTTR-1406, spec docs/specs/package-mirror.md): local
# pull-through caches for public npm and Maven packages. Off unless the env file
# sets COMPOSE_PROFILES=mirror (the build/vm/alate pattern), and with the profile
# off this block renders nothing: config byte-identical to a stack without it.
# No host ports, no credentials, no hosted packages: both services are proxy-only
# caches of public registries.
#
# npm is a transparent hosts-pinned TLS mirror: the turn keeps the public
# registry.npmjs.org hostname, so lockfiles hold today's exact public URLs.
# The turn-start wiring pins that name to verdaccio's IP in the turn's
# /etc/hosts and sets NODE_EXTRA_CA_CERTS to the CA this profile drops at
# <OTTR_DATA_DIR>/_mirror/ca.pem; verdaccio serves TLS on 443 for
# registry.npmjs.org and derives packument tarball URLs from the request Host
# header (verified on 7.1.3), so resolved URLs stay public. Maven/Gradle wire
# the classic way to http://reposilite:8080/central (init script, settings.xml
# mirrorOf central); their formats record no repository URLs. Lockfile hashes
# stay the trust anchor: the caches re-serve upstream bytes under the same
# names, and every hash a client checks is the public registry's hash.
verdaccio:
# Digest-pinned 2026-12-01 (multiarch index). The image runs as uid 10001
# (USER in the image config); its uid_entrypoint execs the CMD as that user.
image: verdaccio/verdaccio:7.1.3@sha256:f11a75a4fbdcde2fc515b7e8ab77ce0d18844788ee2988dd7c374322c49b3750
profiles: [mirror]
restart: unless-stopped
logging: *logging
mem_limit: ${OTTR_VERDACCIO_MEM_LIMIT:-1g}
depends_on:
mirror-certs:
condition: service_completed_successfully
environment:
# The image CMD is fixed: `verdaccio --config /verdaccio/conf/config.yaml
# --listen $VERDACCIO_PROTOCOL://$VERDACCIO_ADDRESS:$VERDACCIO_PORT`, so the
# listener comes from these env keys (a `listen:` key in the config would be
# dead; verified on 7.1.3). The TLS key/cert paths come from the `https:`
# block of docker/mirror/verdaccio.yaml.
VERDACCIO_PROTOCOL: "https"
VERDACCIO_ADDRESS: "0.0.0.0"
VERDACCIO_PORT: "443"
volumes:
- ./docker/mirror/verdaccio.yaml:/verdaccio/conf/config.yaml:ro
# Pull-through npm cache; mirror-janitor enforces the size cap on it.
- mirror-npm-data:/verdaccio/storage
# CA, server cert and key written by mirror-certs. The key is 0400 owned
# 10001:0 (the image USER), so this container reads it and nothing else can.
- mirror-tls:/tls:ro
healthcheck:
test:
- CMD
- sh
- -c
# NODE_EXTRA_CA_CERTS must be set before node starts, so the env prefix
# runs inside sh (healthchecks take no environment). The cert's SAN
# covers IP:127.0.0.1, so this exercises the exact CA path a pinned turn
# gets (verified: 200 with the CA, UNABLE_TO_VERIFY_LEAF_SIGNATURE without).
- 'NODE_EXTRA_CA_CERTS=/tls/ca.pem node -e "require(''node:https'').get(''https://127.0.0.1/-/ping'', r => process.exit(r.statusCode === 200 ? 0 : 1)).on(''error'', () => process.exit(1))"'
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
networks:
- default
reposilite:
# Digest-pinned 2026-12-01 (multiarch index). The image entrypoint creates
# uid 977 (PUID default) and runs the JVM as it; it ships its own healthcheck
# (curls the address file the JVM writes to /app/data/.local), so this
# service defines no healthcheck block.
image: dzikoysk/reposilite:3.6.8@sha256:89c331f3b0655fe8cb2825f524e433cb8f772f7683fc6f3c2ab32dcd90bcebd0
profiles: [mirror]
restart: unless-stopped
logging: *logging
mem_limit: ${OTTR_REPOSILITE_MEM_LIMIT:-1g}
depends_on:
mirror-certs:
condition: service_completed_successfully
environment:
# JVM heap cap inside the mem_limit (spec, Budgets).
JAVA_OPTS: -Xmx512m
# The entrypoint prepends --working-directory=/app/data (REPOSILITE_OPTS
# carries no --working-directory of its own). Both config files are tracked
# and read-only: --local-configuration points at the .cdn bind, and
# --local-configuration-mode=none stops reposilite from re-rendering it
# after every load (mode auto rewrites the file). --shared-configuration
# loads the proxied `central` repository from the tracked JSON instead of
# the sqlite settings table, so no dashboard edit can drift the mirror:
# changes are made in git and applied by recreation. Verified on 3.6.8.
REPOSILITE_OPTS: >-
--local-configuration=/app/configuration.cdn
--shared-configuration=/app/configuration.shared.json
--local-configuration-mode=none
volumes:
- ./docker/mirror/reposilite.cdn:/app/configuration.cdn:ro
- ./docker/mirror/reposilite-shared.json:/app/configuration.shared.json:ro
# Proxied artifacts and the sqlite db. mirror-certs pre-owns the volume
# root as 977:977, which makes the entrypoint skip its `chown -R /app`:
# that chown would hit the read-only config binds, fail, and (set -e)
# restart-loop the container.
- mirror-maven-data:/app/data
networks:
- default
# One-shot TLS material for the mirror (the `mirror` profile): generates the CA
# and the registry.npmjs.org server certificate into mirror-tls, copies the CA
# to <OTTR_DATA_DIR>/_mirror/ca.pem for the turn wiring, and pre-owns the
# Maven cache volume for reposilite's uid. Idempotent: with all four outputs
# present it exits 0, so `up` can rerun it. The CA key is generated in /tmp and
# discarded there: it never lands in a volume, so no container can mint more
# mirror certificates. Rotation: remove the mirror-tls volume and
# <OTTR_DATA_DIR>/_mirror/ca.pem, then rerun the profile
# (docs/WORKERS.md "The compose mirror profile").
mirror-certs:
image: ${OTTR_IMAGE:-ottr-worker:local}
profiles: [mirror]
restart: "no"
logging: *logging
mem_limit: ${OTTR_MIRROR_CERTS_MEM_LIMIT:-512m}
entrypoint:
- sh
- -c
- |
set -eu
openssl version
# The CA dir must survive closeRootProjectDirs: at every worker boot it
# hands every /data directory to the uid its name hashes to and closes
# it 0700, which would let that one uid replace the CA for everyone.
# The sweep itself skips a dir that is already root-owned with that
# same hashed gid at 0750, so the one-off owns the dir root:<gid> 0750
# on every run — the worker image carries the exact algorithm
# (projectTurnUid("_mirror").gid), and src/mirror.ts re-asserts the
# same shape at every turn start.
MIRROR_GID=$(bun -e 'const m = await import("/app/src/turnUid.ts"); process.stdout.write(String(m.projectTurnUid("_mirror").gid));')
mkdir -p /data/_mirror
chown 0:"$MIRROR_GID" /data/_mirror
chmod 0750 /data/_mirror
if [ -f /tls/ca.pem ] && [ -f /tls/cert.pem ] && \
[ -f /tls/key.pem ] && [ -f /data/_mirror/ca.pem ]; then
chown 0:"$MIRROR_GID" /data/_mirror/ca.pem
chmod 0444 /data/_mirror/ca.pem
echo "mirror certs exist; keeping them"
exit 0
fi
umask 077
mkdir -p /tls
rm -f /tls/ca.pem /tls/cert.pem /tls/key.pem
# CA. The key stays in /tmp and dies with the one-off container.
openssl genrsa -out /tmp/mirror-ca.key 4096
openssl req -x509 -new -sha256 -days 3650 -key /tmp/mirror-ca.key \
-subj /CN=ottr-mirror-ca -out /tls/ca.pem
# Server cert: the SAN carries the pinned public hostname the turns see
# and 127.0.0.1 for the verdaccio healthcheck, like buildkit-certs.
openssl genrsa -out /tmp/mirror.key 4096
openssl req -new -sha256 -key /tmp/mirror.key \
-subj /CN=registry.npmjs.org -out /tmp/mirror.csr
printf 'basicConstraints=CA:FALSE\nkeyUsage=digitalSignature,keyEncipherment\nextendedKeyUsage=serverAuth\nsubjectAltName=DNS:registry.npmjs.org,IP:127.0.0.1\n' > /tmp/mirror.ext
openssl x509 -req -sha256 -days 3650 -in /tmp/mirror.csr \
-CA /tls/ca.pem -CAkey /tmp/mirror-ca.key -CAcreateserial \
-extfile /tmp/mirror.ext -out /tls/cert.pem
# The verdaccio image USER is uid 10001 (group 0), so the key gets that
# owner and 0400; the certs are world-readable, like buildkit-ca.
install -o 10001 -g 0 -m 0400 /tmp/mirror.key /tls/key.pem
chmod 0444 /tls/ca.pem /tls/cert.pem
openssl verify -CAfile /tls/ca.pem /tls/cert.pem
# The CA copy the turn wiring reads (see the dir ownership above):
# root:<gid> 0444, so no project uid can replace it and the root
# daemons read it regardless. The path matches the workers'
# OTTR_DATA_DIR mount.
install -o 0 -g "$MIRROR_GID" -m 0444 /tls/ca.pem /data/_mirror/ca.pem
# Maven cache volume: pre-own the root for reposilite's PUID default
# (977). This one-off runs first (reposilite depends_on it), so the
# fresh volume takes the ownership and the entrypoint skips its chown
# -R /app (which would fail on the read-only config binds).
mkdir -p /data-maven
chown 977:977 /data-maven
chmod 0755 /data-maven
rm -f /tmp/mirror-ca.key /tmp/mirror.key /tmp/mirror.csr /tmp/mirror.ext
echo "mirror certs written"
volumes:
- mirror-tls:/tls
- ottr-data:/data
- mirror-maven-data:/data-maven
# Cache-cap enforcement (the `mirror` profile): unlinks the oldest-mtime files
# of each cache volume when it exceeds its cap, every six hours (spec,
# Budgets). Same pinned verdaccio image (node on PATH), but with the entrypoint
# replaced to run as root: the image USER is 10001, and the janitor must unlink
# files two different uids wrote (verdaccio 10001, reposilite 977). Cached
# artifacts are re-fetchable, so deletion is safe.
mirror-janitor:
image: verdaccio/verdaccio:7.1.3@sha256:f11a75a4fbdcde2fc515b7e8ab77ce0d18844788ee2988dd7c374322c49b3750
user: "0"
entrypoint: [node]
command: [/janitor.mjs]
profiles: [mirror]
restart: unless-stopped
logging: *logging
mem_limit: ${OTTR_MIRROR_JANITOR_MEM_LIMIT:-256m}
environment:
JANITOR_NPM_DIR: /data-npm
JANITOR_MAVEN_DIR: /data-maven
OTTR_MIRROR_NPM_MAX_MB: ${OTTR_MIRROR_NPM_MAX_MB:-10240}
OTTR_MIRROR_MAVEN_MAX_MB: ${OTTR_MIRROR_MAVEN_MAX_MB:-20480}
volumes:
- ./scripts/mirror-janitor.mjs:/janitor.mjs:ro
# Read-write: the janitor deletes from both caches.
- mirror-npm-data:/data-npm
- mirror-maven-data:/data-maven
networks:
- default
# Memory lives in the shared Hindsight server named by HINDSIGHT_API_URL
# (tenant-key auth on the board only; turns get per-run tokens,
# docs/specs/hindsight-bank-binding.md); set the URL in the compose env file
# or in Settings.
# Alate, the provisioning side of the pair, bundled for the quick start: the profile
# keeps the service off unless the env sets COMPOSE_PROFILES=alate, so a user whose
# Alate server already runs keeps today's setup. The board reaches it at
# http://alate:4570 on the default network; the dashboard is loopback-only on the
# host. ALATE_URL and ALATE_API_KEY (server env above) seed Settings -> Alate, and a
# value saved there wins. Startup logs never print the key. Alate provisions the agent
# layer as layers under /root/.alate/layers/<id> and switches /root/.alate/current
# with one atomic rename; it reads /root/.alate/in-use.json (the board's registry of
# layers that live runs pinned) before a clean-up, which keeps the current layer, the
# one before it, and every layer in the registry (docs/specs/agent-layer-switch.md).
alate:
image: ${ALATE_IMAGE:-ghcr.io/ottr-ai/alate:latest}
profiles: [alate]
# Podman injects the host proxy env (HTTP_PROXY/HTTPS_PROXY/NO_PROXY) into every
# container; its NO_PROXY names no compose services, so http://alate:4570 and
# http://ottr:<port> from the board would bounce off the corporate proxy. The image
# is external and carries no ottr entry script, so bind-mount one and source it.
entrypoint:
- sh
- -c
- . /no-proxy.sh && exec node server.ts --host 0.0.0.0 --config /state/server-config.json --db /state/alate.db
restart: unless-stopped
healthcheck:
test:
- CMD
- node
- --input-type=module
- -e
- "try { process.exit((await fetch('http://127.0.0.1:4570/health', { redirect: 'error', signal: AbortSignal.timeout(4000) })).ok ? 0 : 1); } catch { process.exit(1); }"
interval: 5s
timeout: 5s
retries: 12
start_period: 10s
logging: *logging
volumes:
- ./docker/no-proxy.sh:/no-proxy.sh:ro
- home:/root # alate provisions the workers' shared agent layer here
- alate-state:/state
# install-projects.mjs writes the files that agent-data projects/projects.json
# lists into the project checkouts. Without this mount /workspace does not
# exist in the container, alate refuses a projectsRoot of /workspace as not a
# directory, and the step prints "install-projects: no --root; project files
# not provisioned". Same volume as the workers', so the checkouts are shared.
- workspace:/workspace
environment:
# The key alate itself requires on every request.
ALATE_API_KEY: ${ALATE_API_KEY:-}
# Layer mode on (docs/specs/agent-layer-switch.md): layers with an atomic switch, not the flat home.
ALATE_LAYER: "1"
# R5-1: the workers share the home volume and can plant /root/.gitconfig. This
# service holds ALATE_API_KEY, which the board strips from every turn's env
# (src/runner.ts, src/workers.ts), so a planted credential helper, insteadOf
# redirect or protocol allowance must not run here. The home holds no legit git
# config (the entry script never copies from it), so the pin removes only the
# plant vector.
GIT_CONFIG_GLOBAL: /dev/null
# The dashboard shares the cookie host with the board on 127.0.0.1. Open it on
# http://localhost:4570 instead: browser cookies ignore ports, so a cookie
# scoped to the board's hostname rides along to the same hostname on this port.
ports:
- "127.0.0.1:4570:4570"
# The buildkit network belongs to the `build` profile (services above). Not compose-
# internal on purpose: buildkitd pulls base images from docker.io, and an internal
# network has no egress. Isolation still holds: only the workers join it besides the
# daemon, and Docker isolates bridge networks from each other, so the server (default
# network only) has no route to buildkit.
# `default` is declared only so podman-compose sees it (it raises "missing networks"
# on a service network absent from this block); Docker Compose adds it implicitly.
networks:
default: {}
buildkit: {}
volumes:
workspace:
home:
# Per-project turn homes (OTTR-994): one dir per project, owned by the project's
# turn uid. Persists the per-project tool, venv and cache installs across worker
# recreations; the daemon creates the dir itself when the mount is absent.
turn-homes:
ottr-state:
ottr-backup:
ottr-data:
board-config:
alate-state:
vm-state:
# BuildKit TLS material and state (the `build` profile). The CA key is never stored:
# buildkit-certs signs in /tmp and discards it.
buildkit-ca:
buildkit-daemon-certs:
buildkit-client-certs:
buildkit-config:
buildkit-state:
# Optional package mirror (the `mirror` profile): verdaccio TLS material, the
# npm cache and the Maven cache (plus the sqlite settings db). The mirror CA
# key is never stored: mirror-certs signs in /tmp and discards it, like
# buildkit-certs.
mirror-tls:
mirror-npm-data:
mirror-maven-data: