Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
839 lines (820 loc) · 31.3 KB
/
Copy pathdocker-compose.yml
File metadata and controls
839 lines (820 loc) · 31.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
# AutoBot Docker Compose — Single-Node Deployment (#1809)
# All core services on one machine. Frontend at /, SLM at /slm.
# Requires Docker Compose v2+ for resource limits (deploy.resources).
#
# Usage (works out of the box — no manual secret step):
# docker compose up -d --build # Start all core services
# docker compose --profile monitoring up -d
# docker compose --profile ollama up -d
#
# SECRETS (GH#9775, GH#9905): AUTOBOT_JWT_SECRET / SECRET_KEY have NO committed
# fallback — a shared committed signing secret allows token forgery. On first
# `up`, the `autobot-secrets-init` service auto-generates UNIQUE per-deployment
# secrets into the shared `autobot_secrets` volume (never in git, reused across
# restarts); with-secrets.sh loads them into backend/worker/slm at runtime.
# To pin your own (production), set AUTOBOT_JWT_SECRET / SECRET_KEY in the
# environment or root .env, or run docker/generate-secrets.sh + --env-file —
# an explicit value always overrides the auto-generated one.
#
# NOTE: --env-file docker/.env.docker is required when the root .env contains
# fleet-specific paths (e.g. AUTOBOT_TLS_CERT_DIR=infrastructure/shared/certs)
# that are invalid in a Docker context. See #2458.
#
# Healthcheck convention (#7456):
# - Default to ``["CMD", ...]`` (exec form) — no shell, no env-var
# expansion, no I/O redirection. Faster + safer.
# - Use ``["CMD-SHELL", "..."]`` ONLY when the check needs a shell
# feature: ``${VAR}`` expansion, ``$HOSTNAME`` reference, redirection
# (``>/dev/null 2>&1``), or piped commands. Audit confirmed all 3
# current CMD-SHELL uses (postgres, celery, ollama) are justified.
#
# AutoBot - AI-Powered Automation Platform
# Copyright (c) 2025 mrveiss
# Author: mrveiss
x-default-logging: &default-logging
driver: json-file
options:
max-size: "50m"
max-file: "5"
services:
# ---- Data Layer ----
autobot-redis:
image: redis/redis-stack:7.4.0-v1
container_name: autobot-redis
restart: unless-stopped
ports:
- "${AUTOBOT_REDIS_PORT:-6379}:6379"
- "127.0.0.1:8001:8001" # RedisInsight UI (localhost only)
volumes:
- redis_data:/data
environment:
- REDIS_ARGS=--appendonly yes --save 60 1 --maxmemory 512mb --maxmemory-policy allkeys-lru
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- DAC_OVERRIDE
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.10
autobot-data:
autobot-postgres:
image: postgres:16-bookworm
container_name: autobot-postgres
restart: unless-stopped
ports:
- "127.0.0.1:5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres/init-databases.sql:/docker-entrypoint-initdb.d/init-databases.sql
environment:
- POSTGRES_USER=${AUTOBOT_DB_USER:-autobot}
- POSTGRES_PASSWORD=${AUTOBOT_DB_PASSWORD:-autobot}
- POSTGRES_DB=${AUTOBOT_DB_NAME:-autobot_slm}
healthcheck:
# -d targets an existing DB; without it pg_isready connects to db=user
# ("autobot"), which is never created → FATAL spam every interval (#9713).
test: ["CMD-SHELL", "pg_isready -U ${AUTOBOT_DB_USER:-autobot} -d ${AUTOBOT_DB_NAME:-autobot_slm}"]
interval: 10s
timeout: 3s
retries: 5
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- DAC_OVERRIDE
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.11
autobot-data:
autobot-chromadb:
# Match the v1 client (chromadb>=1.5.9 in autobot-backend/requirements.txt).
# The old 0.5.23 server couldn't parse v1 client requests → KeyError '_type'
# spam (#9717). v1.x persists to /data (was /chroma/chroma in 0.5.x).
image: chromadb/chroma:1.5.9
container_name: autobot-chromadb
restart: unless-stopped
ports:
- "127.0.0.1:8100:8000"
volumes:
- chroma_data:/data
environment:
- ANONYMIZED_TELEMETRY=False
- IS_PERSISTENT=TRUE
# #12513: CHROMA_SERVER_AUTHN_* token auth, driven by a SINGLE knob
# (AUTOBOT_CHROMADB_AUTH_TOKEN — same var name as the ssot_config field
# and the client-side env var below) via Compose's "${VAR:+alt}"
# substitution operator. This is deliberately atomic: the provider line
# only ever gets a value when the token is also set, so it's never
# possible to have the provider configured with empty credentials
# (chroma crashes at boot on that combination) or a token sent by
# clients while the server silently stays unauthenticated. Unset token
# = both lines empty = auth disabled, matching pre-#12513 behaviour
# (dev/local, unauthenticated HttpClient). To enable: set
# AUTOBOT_CHROMADB_AUTH_TOKEN in the root .env (never commit real
# values) — both lines below populate together.
- CHROMA_SERVER_AUTHN_PROVIDER=${AUTOBOT_CHROMADB_AUTH_TOKEN:+chromadb.auth.token_authn.TokenAuthenticationServerProvider}
- CHROMA_SERVER_AUTHN_CREDENTIALS=${AUTOBOT_CHROMADB_AUTH_TOKEN:-}
healthcheck:
# The chroma 1.x image is minimal (no curl/wget); use bash /dev/tcp to hit
# the v2 heartbeat and confirm a 200 (#9717).
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/localhost/8000; printf 'GET /api/v2/heartbeat HTTP/1.0\r\n\r\n' >&3; grep -q '200 OK' <&3"]
interval: 15s
timeout: 5s
retries: 3
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- DAC_OVERRIDE
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.12
autobot-data:
# ---- Application Layer ----
# GH#9905: auto-provision per-deployment signing secrets into the shared
# autobot_secrets volume so `docker compose up` works out of the box with no
# committed secret. Runs once, idempotently; all app services wait for it.
autobot-secrets-init:
image: alpine:3.20
container_name: autobot-secrets-init
restart: "no"
volumes:
- autobot_secrets:/secrets
- ./docker/secrets-init.sh:/secrets-init.sh:ro
command: ["/bin/sh", "/secrets-init.sh"]
networks:
- autobot-mgmt
autobot-backend:
build:
context: .
dockerfile: docker/backend/Dockerfile
# claude CLI version pin (GH#9950): optional exact package version for a
# reproducible build (e.g. 2.1.89). Empty default = current stable-channel
# build from Anthropic's signed apt repo (integrity verified by apt).
args:
CLAUDE_CLI_VERSION: "${CLAUDE_CLI_VERSION:-}"
image: autobot/backend:latest
container_name: autobot-backend
restart: unless-stopped
# GH#9905: load the shared auto-generated signing secret, then chain the
# image's own entrypoint (/app/entrypoint.sh), which runs Alembic
# migrations for Postgres-backed user modes before exec'ing the app
# (#9759). NB: overriding entrypoint clears the image CMD, so the command
# is re-declared here (kept in sync with docker/backend/Dockerfile).
entrypoint: ["/bin/sh", "/usr/local/bin/with-secrets.sh", "/app/entrypoint.sh"]
command: ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001", "--workers", "1", "--app-dir", "/app/autobot-backend"]
env_file:
- docker/.env.docker
volumes:
- backend_data:/app/data
- backend_logs:/app/logs
- autobot_secrets:/secrets:ro
- ./docker/with-secrets.sh:/usr/local/bin/with-secrets.sh:ro
environment:
- AUTOBOT_ENVIRONMENT=production
- AUTOBOT_DEPLOYMENT_MODE=local
# #14081/#14110 security review: with no AUTOBOT_BASE_DIR set, the
# canonical secrets-store/JWT-key/project-state location
# (ssot_config.path.data_path) resolved to /opt/autobot/data — the
# container's ephemeral writable layer, NOT the persistent
# backend_data volume mounted at /app/data below. The one-time
# migration was moving real secrets OFF the volume and deleting the
# source, so the next recreate destroyed them. Pinning this to the
# volume's mount point makes canonical == legacy for this service, so
# the migration correctly no-ops instead of relocating anything.
- AUTOBOT_DATA_DIR=${AUTOBOT_DATA_DIR:-/app/data}
# No AI Stack VM ships with compose — disable the poll to stop the per-boot
# connection-error warning flood (#9782). Set to true if you run an AI Stack.
- AUTOBOT_AI_STACK_ENABLED=${AUTOBOT_AI_STACK_ENABLED:-false}
- AUTOBOT_LOG_LEVEL=${AUTOBOT_LOG_LEVEL:-INFO}
- AUTOBOT_REDIS_HOST=autobot-redis
- AUTOBOT_REDIS_PORT=6379
- AUTOBOT_OLLAMA_HOST=${AUTOBOT_OLLAMA_HOST:-autobot-ollama}
- AUTOBOT_OLLAMA_PORT=11434
- AUTOBOT_OLLAMA_ENDPOINT=http://${AUTOBOT_OLLAMA_HOST:-autobot-ollama}:11434
- AUTOBOT_BACKEND_HOST=0.0.0.0
- AUTOBOT_BACKEND_PORT=8001
- AUTOBOT_LLM_PROVIDER=${AUTOBOT_LLM_PROVIDER:-ollama}
- AUTOBOT_DEFAULT_LLM_MODEL=${AUTOBOT_DEFAULT_LLM_MODEL:-qwen3.5:9b}
- AUTOBOT_EMBEDDING_MODEL=${AUTOBOT_EMBEDDING_MODEL:-nomic-embed-text:latest}
- AUTOBOT_LLM_FAILSAFE_PROVIDER=${AUTOBOT_LLM_PROVIDER:-ollama}
- AUTOBOT_LLM_FAILSAFE_ENDPOINT=http://${AUTOBOT_OLLAMA_HOST:-autobot-ollama}:11434
- AUTOBOT_CHROMADB_HOST=autobot-chromadb
- AUTOBOT_CHROMADB_PORT=8000
# #12513: shared secret for CHROMA_SERVER_AUTHN_* token auth on the
# autobot-chromadb service above — empty by default (auth disabled,
# dev/local); ssot_config.misc.chromadb_auth_token omits client auth
# settings entirely when unset, matching an unauthenticated server.
- AUTOBOT_CHROMADB_AUTH_TOKEN=${AUTOBOT_CHROMADB_AUTH_TOKEN:-}
- AUTOBOT_LLAMAINDEX_LLM_ENDPOINT=http://${AUTOBOT_OLLAMA_HOST:-autobot-ollama}:11434
- AUTOBOT_LLAMAINDEX_EMBEDDING_ENDPOINT=http://${AUTOBOT_OLLAMA_HOST:-autobot-ollama}:11434
- AUTOBOT_AUDIT_LOG_FILE=/app/logs/audit.log
# User mode defaults to single_user (no Postgres schema bootstrap needed).
# RBAC (single_company → first user becomes admin) is wired and ready —
# setting AUTOBOT_USER_MODE=single_company is now a single-var flip: the
# entrypoint bootstraps the schema via `alembic upgrade head` (#9759).
- AUTOBOT_USER_MODE=${AUTOBOT_USER_MODE:-single_user}
- AUTOBOT_POSTGRES_HOST=autobot-postgres
- AUTOBOT_POSTGRES_PORT=5432
- AUTOBOT_POSTGRES_DB=${AUTOBOT_USERS_DB_NAME:-autobot_users}
- AUTOBOT_POSTGRES_USER=${AUTOBOT_DB_USER:-autobot}
- AUTOBOT_POSTGRES_PASSWORD=${AUTOBOT_DB_PASSWORD:-autobot}
- AUTOBOT_ENCRYPTION_KEY=${AUTOBOT_ENCRYPTION_KEY:-}
# config.slm_url builds from AUTOBOT_SLM_HOST/PORT. The 127.0.0.1 default
# left the node unable to reach SLM → connection spam + host shown offline
# in the SLM dashboard. Point it at the service name (#9715).
- AUTOBOT_SLM_HOST=autobot-slm
- AUTOBOT_SLM_PORT=8000
# Which fleet node hosts Redis (colocated on the SLM manager in compose) so
# backend Redis service routing can target it instead of an empty id (#9761).
- REDIS_NODE_ID=${REDIS_NODE_ID:-00-SLM-Manager}
# Shared signing secrets — must match SLM so the node JWT verifies (#9715)
# GH#9905: no parse-time fail. If unset, with-secrets.sh loads a unique
# per-deployment secret auto-generated by secrets-init into the shared
# autobot_secrets volume. An explicit value here (prod) still wins.
- AUTOBOT_JWT_SECRET=${AUTOBOT_JWT_SECRET:-}
- SECRET_KEY=${SECRET_KEY:-}
# LLC subprocess agent CLIs (GH#9793): the spawned claude / gh process
# inherits os.environ from the backend process, so these must be present
# in the container environment. All three default to empty so the image
# boots without them; set real values in the root .env or host shell.
- LLC_AGENT_API_BASE_URL=http://localhost:8001/api
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- GH_TOKEN=${GH_TOKEN:-}
depends_on:
autobot-secrets-init:
condition: service_completed_successfully
autobot-redis:
condition: service_healthy
autobot-chromadb:
condition: service_healthy
# Startup migrations (#9759) need Postgres reachable before the
# entrypoint runs `alembic upgrade head`.
autobot-postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/api/system/health"]
interval: 20s
timeout: 10s
retries: 5
start_period: 120s
deploy:
resources:
limits:
memory: 2G
cpus: '2.0'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- NET_BIND_SERVICE
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.13
autobot-data:
autobot-app:
autobot-worker:
build:
context: .
dockerfile: docker/backend/Dockerfile
# claude CLI version pin (GH#9950): optional exact package version for a
# reproducible build (e.g. 2.1.89). Empty default = current stable-channel
# build from Anthropic's signed apt repo (integrity verified by apt).
args:
CLAUDE_CLI_VERSION: "${CLAUDE_CLI_VERSION:-}"
image: autobot/backend:latest
container_name: autobot-worker
restart: unless-stopped
# GH#9905: load the shared secret, then exec celery. Exec-form command so it
# survives the with-secrets.sh entrypoint's `exec "$@"` as proper argv.
entrypoint: ["/bin/sh", "/usr/local/bin/with-secrets.sh"]
command:
- python3.14
- -m
- celery
- -A
- celery_app
- worker
- --loglevel=info
# provisioning/services queues removed — no tasks route to them since
# deployment tasks moved to the SLM server (#729, cleanup #11608).
# #11631: memory + analytics added — task_routes sends memory write-path
# and background-analytics tasks there; with no consumer they sat in
# Redis until eviction. Must stay a superset of the queues task_routes
# targets (SSOT: task_queues in autobot-backend/celery_app.py; guarded
# by autobot-backend/celery_queue_coverage_test.py).
- --queues=celery,deployments,memory,analytics
- --concurrency=2
working_dir: /app/autobot-backend
env_file:
- docker/.env.docker
volumes:
- backend_data:/app/data
- backend_logs:/app/logs
- autobot_secrets:/secrets:ro
- ./docker/with-secrets.sh:/usr/local/bin/with-secrets.sh:ro
environment:
- AUTOBOT_ENVIRONMENT=production
- AUTOBOT_DEPLOYMENT_MODE=local
# #14081/#14110 security review: this service's working_dir differs
# from autobot-backend's, so its own legacy CWD-relative resolver
# would disagree with the backend's — pinning canonical here too
# means both converge on the same persistent backend_data volume
# (see autobot-backend's AUTOBOT_DATA_DIR comment above for the full
# data-loss mechanism this closes).
- AUTOBOT_DATA_DIR=${AUTOBOT_DATA_DIR:-/app/data}
# No AI Stack VM ships with compose — disable the poll to stop the per-boot
# connection-error warning flood (#9782). Set to true if you run an AI Stack.
- AUTOBOT_AI_STACK_ENABLED=${AUTOBOT_AI_STACK_ENABLED:-false}
- AUTOBOT_LOG_LEVEL=${AUTOBOT_LOG_LEVEL:-INFO}
- AUTOBOT_REDIS_HOST=autobot-redis
- AUTOBOT_REDIS_PORT=6379
- CELERY_BROKER_URL=redis://autobot-redis:6379/${AUTOBOT_REDIS_DB_CELERY_BROKER:-14}
- CELERY_RESULT_BACKEND=redis://autobot-redis:6379/${AUTOBOT_REDIS_DB_CELERY_RESULTS:-15}
- AUTOBOT_CHROMADB_HOST=autobot-chromadb
- AUTOBOT_CHROMADB_PORT=8000
# #12513: shared secret for CHROMA_SERVER_AUTHN_* token auth on the
# autobot-chromadb service above — empty by default (auth disabled,
# dev/local); ssot_config.misc.chromadb_auth_token omits client auth
# settings entirely when unset, matching an unauthenticated server.
- AUTOBOT_CHROMADB_AUTH_TOKEN=${AUTOBOT_CHROMADB_AUTH_TOKEN:-}
- AUTOBOT_AUDIT_LOG_FILE=/app/logs/audit.log
# User-mgmt/RBAC tasks need the same Postgres + mode wiring as the backend.
# Defaults to single_user; the backend entrypoint bootstraps the schema
# on flip (#9759), so no manual migration step is needed here.
- AUTOBOT_USER_MODE=${AUTOBOT_USER_MODE:-single_user}
- AUTOBOT_POSTGRES_HOST=autobot-postgres
- AUTOBOT_POSTGRES_PORT=5432
- AUTOBOT_POSTGRES_DB=${AUTOBOT_USERS_DB_NAME:-autobot_users}
- AUTOBOT_POSTGRES_USER=${AUTOBOT_DB_USER:-autobot}
- AUTOBOT_POSTGRES_PASSWORD=${AUTOBOT_DB_PASSWORD:-autobot}
- AUTOBOT_ENCRYPTION_KEY=${AUTOBOT_ENCRYPTION_KEY:-}
- AUTOBOT_SLM_HOST=autobot-slm
- AUTOBOT_SLM_PORT=8000
# Which fleet node hosts Redis (colocated on the SLM manager in compose) so
# backend Redis service routing can target it instead of an empty id (#9761).
- REDIS_NODE_ID=${REDIS_NODE_ID:-00-SLM-Manager}
# Shared signing secrets — must match SLM so the node JWT verifies (#9715)
# GH#9905: no parse-time fail. If unset, with-secrets.sh loads a unique
# per-deployment secret auto-generated by secrets-init into the shared
# autobot_secrets volume. An explicit value here (prod) still wins.
- AUTOBOT_JWT_SECRET=${AUTOBOT_JWT_SECRET:-}
- SECRET_KEY=${SECRET_KEY:-}
healthcheck:
# $$HOSTNAME (escaped) expands inside the container at runtime. A single
# $HOSTNAME is interpolated by Compose at parse time to an empty string,
# making --destination "celery@" match no node → false unhealthy (#9714).
test: ["CMD-SHELL", "python3.14 -m celery -A celery_app inspect ping --destination celery@$$HOSTNAME --timeout 5"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
depends_on:
autobot-secrets-init:
condition: service_completed_successfully
autobot-redis:
condition: service_healthy
autobot-chromadb:
condition: service_healthy
# The backend entrypoint runs the schema migrations (#9759); waiting for
# it to be healthy stops worker tasks hitting a not-yet-migrated DB on
# first boot in Postgres-backed user modes.
autobot-backend:
condition: service_healthy
deploy:
resources:
limits:
memory: 2G
cpus: '2.0'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- NET_BIND_SERVICE
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.14
autobot-data:
autobot-app:
autobot-celery-beat:
image: autobot/backend:latest
container_name: autobot-celery-beat
restart: unless-stopped
# NB: inherits the image ENTRYPOINT (/app/entrypoint.sh, #9759). Migrations
# stay skipped here because AUTOBOT_USER_MODE is deliberately NOT set for
# beat — do not add it, or beat and the backend would run
# `alembic upgrade head` concurrently (alembic takes no advisory lock).
command: >
python3.14 -m celery -A celery_app beat
--loglevel=info
--scheduler celery.beat.PersistentScheduler
--schedule /app/data/celerybeat-schedule
working_dir: /app/autobot-backend
env_file:
- docker/.env.docker
volumes:
# Schedule db lives on the writable backend_data volume. The old
# /var/lib/autobot mount was root-owned → gdbm EACCES crash loop (#9712).
- backend_data:/app/data
- backend_logs:/app/logs
environment:
- AUTOBOT_ENVIRONMENT=production
- AUTOBOT_DEPLOYMENT_MODE=local
# #14081/#14110 security review: kept consistent with autobot-backend
# and autobot-worker so any secrets-store access this process makes
# (task modules it loads may import services.secrets_service)
# resolves to the same persistent backend_data volume, not the
# container's ephemeral writable layer.
- AUTOBOT_DATA_DIR=${AUTOBOT_DATA_DIR:-/app/data}
# No AI Stack VM ships with compose — disable the poll to stop the per-boot
# connection-error warning flood (#9782). Set to true if you run an AI Stack.
- AUTOBOT_AI_STACK_ENABLED=${AUTOBOT_AI_STACK_ENABLED:-false}
- AUTOBOT_LOG_LEVEL=${AUTOBOT_LOG_LEVEL:-INFO}
- AUTOBOT_REDIS_HOST=autobot-redis
- AUTOBOT_REDIS_PORT=6379
- CELERY_BROKER_URL=redis://autobot-redis:6379/${AUTOBOT_REDIS_DB_CELERY_BROKER:-14}
- CELERY_RESULT_BACKEND=redis://autobot-redis:6379/${AUTOBOT_REDIS_DB_CELERY_RESULTS:-15}
- AUTOBOT_CHROMADB_HOST=autobot-chromadb
- AUTOBOT_CHROMADB_PORT=8000
# #12513: shared secret for CHROMA_SERVER_AUTHN_* token auth on the
# autobot-chromadb service above — empty by default (auth disabled,
# dev/local); ssot_config.misc.chromadb_auth_token omits client auth
# settings entirely when unset, matching an unauthenticated server.
- AUTOBOT_CHROMADB_AUTH_TOKEN=${AUTOBOT_CHROMADB_AUTH_TOKEN:-}
depends_on:
autobot-redis:
condition: service_healthy
autobot-chromadb:
condition: service_healthy
healthcheck:
# Beat serves no HTTP port, so it can't use the backend image's inherited
# curl healthcheck (which always failed → false "unhealthy"). Check the
# beat process (PID 1) is alive via procfs — no extra tools needed.
test: ["CMD-SHELL", "grep -q celery /proc/1/cmdline"]
interval: 30s
timeout: 5s
start_period: 20s
retries: 3
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.15
autobot-data:
autobot-slm:
build:
context: .
dockerfile: docker/slm/Dockerfile
image: autobot/slm:latest
container_name: autobot-slm
restart: unless-stopped
# GH#9905: load the shared secret, then chain the image's own entrypoint
# (/app/entrypoint.sh) so SLM startup is unchanged. Overriding entrypoint
# clears the image CMD, so it is re-declared here (kept in sync with
# docker/slm/Dockerfile); /app/entrypoint.sh runs migrations then exec "$@".
entrypoint: ["/bin/sh", "/usr/local/bin/with-secrets.sh", "/app/entrypoint.sh"]
command: ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1", "--app-dir", "/app/autobot-slm-backend"]
volumes:
- slm_data:/app/data
- slm_logs:/app/logs
- autobot_secrets:/secrets:ro
- ./docker/with-secrets.sh:/usr/local/bin/with-secrets.sh:ro
environment:
- AUTOBOT_ENVIRONMENT=production
- AUTOBOT_LOG_LEVEL=${AUTOBOT_LOG_LEVEL:-INFO}
- AUTOBOT_REDIS_HOST=autobot-redis
- AUTOBOT_REDIS_PORT=6379
- SLM_DATABASE_URL=postgresql+asyncpg://${AUTOBOT_DB_USER:-autobot}:${AUTOBOT_DB_PASSWORD:-autobot}@autobot-postgres:5432/${AUTOBOT_DB_NAME:-autobot_slm}
- SLM_USERS_DATABASE_URL=postgresql+asyncpg://${AUTOBOT_DB_USER:-autobot}:${AUTOBOT_DB_PASSWORD:-autobot}@autobot-postgres:5432/slm_users
- SLM_POSTGRES_HOST=autobot-postgres
- SLM_ADMIN_PASSWORD=${SLM_ADMIN_PASSWORD:-admin}
- SLM_DATA_DIR=/app/data
# Point LoggingManager at the writable slm_logs volume so read_only: true
# in the hardened overlay doesn't fail with EROFS when mkdir("logs") is
# called relative to the /app/autobot-slm-backend working directory (#11574).
- AUTOBOT_LOGS_DIR=/app/logs
# Surface each compose service container as a fleet node (#9761). Off by
# default so production/Ansible VM fleets are unaffected; on for compose.
- SLM_COMPOSE_NODES=${SLM_COMPOSE_NODES:-true}
# Shared signing secrets so the backend node's JWT verifies on SLM —
# without a shared secret each service generates its own and SLM rejects
# the node WS with 401, leaving the host shown offline (#9715). CHANGE in
# production via AUTOBOT_JWT_SECRET / SECRET_KEY / SLM_SECRET_KEY.
# GH#9905: no parse-time fail. If unset, with-secrets.sh loads a unique
# per-deployment secret auto-generated by secrets-init into the shared
# autobot_secrets volume. An explicit value here (prod) still wins.
# GH#9852: SLM_SECRET_KEY must equal SECRET_KEY so the backend-minted
# service JWT passes auth_service.decode_token on the SLM side.
- AUTOBOT_JWT_SECRET=${AUTOBOT_JWT_SECRET:-}
- SECRET_KEY=${SECRET_KEY:-}
- SLM_SECRET_KEY=${SLM_SECRET_KEY:-}
depends_on:
autobot-secrets-init:
condition: service_completed_successfully
autobot-redis:
condition: service_healthy
autobot-postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
interval: 20s
timeout: 10s
retries: 5
# #11283: SLM (FastAPI + model/registry init) can exceed 60s on a busy CI
# runner, so it was intermittently marked unhealthy before ready, failing
# smoke-test's compose startup ~60% of the time. Match autobot-backend's 120s.
start_period: 120s
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- NET_BIND_SERVICE
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.16
autobot-data:
autobot-app:
autobot-frontend:
build:
context: .
dockerfile: docker/frontend/Dockerfile
image: autobot/frontend:latest
container_name: autobot-frontend
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
# nginx config: HTTP-only by default.
# For TLS: set AUTOBOT_DOCKER_NGINX_CONF=./docker/nginx/nginx-ssl.conf
# Uses AUTOBOT_DOCKER_* prefix to avoid conflict with fleet .env vars (#2458)
- ${AUTOBOT_DOCKER_NGINX_CONF:-./docker/nginx/nginx.conf}:/etc/nginx/nginx.conf:ro
- ./docker/nginx/nginx-common.conf:/etc/nginx/nginx-common.conf:ro
- ./docker/nginx/nginx-locations.conf:/etc/nginx/nginx-locations.conf:ro
# TLS certificates directory (mounted read-only)
# Generate dev certs: bash docker/certs/generate-self-signed.sh
- ./docker/certs:/etc/nginx/certs:ro
depends_on:
autobot-backend:
condition: service_healthy
autobot-slm:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost/health"]
interval: 30s
timeout: 5s
retries: 3
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
logging: *default-logging
read_only: true
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- NET_BIND_SERVICE
tmpfs:
- /tmp
- /var/run
- /var/cache/nginx
- /var/lib/nginx
# nginx opens its compiled-in default error log before parsing config;
# on a read_only rootfs this path must be writable or it alerts (#9718).
- /var/log/nginx
security_opt:
- no-new-privileges:true
networks:
autobot-mgmt:
ipv4_address: 172.30.0.17
autobot-app:
# ---- Optional: Local LLM ----
autobot-ollama:
image: ollama/ollama:latest
container_name: autobot-ollama
restart: unless-stopped
ports:
- "127.0.0.1:11434:11434"
volumes:
- ollama_data:/root/.ollama
environment:
- OLLAMA_ORIGINS=*
healthcheck:
test: ["CMD-SHELL", "ollama list >/dev/null 2>&1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 8G # 7B models need ~5.5GB; increase for larger models
cpus: '4.0'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
- autobot-mgmt
- autobot-app
profiles:
- ollama
# ---- Optional: Monitoring ----
autobot-prometheus:
image: prom/prometheus:v2.53.0
container_name: autobot-prometheus
restart: unless-stopped
ports:
- "127.0.0.1:9090:9090"
volumes:
- prometheus_data:/prometheus
# Whole directory, not just prometheus.yml: the alerts-*.yml rule files
# sit beside it and were otherwise absent from the container (#12460).
- ./autobot-monitoring:/etc/prometheus:ro
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --storage.tsdb.retention.time=15d
- --web.enable-lifecycle
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 5s
retries: 3
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
logging: *default-logging
cap_drop:
- ALL
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
networks:
- autobot-mgmt
- autobot-app
profiles:
- monitoring
autobot-grafana:
image: grafana/grafana:11.1.0
container_name: autobot-grafana
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000"
volumes:
- grafana_data:/var/lib/grafana
- ./autobot-monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-autobot}
- GF_USERS_ALLOW_SIGN_UP=false
depends_on:
autobot-prometheus:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 5s
retries: 3
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
logging: *default-logging
cap_drop:
- ALL
cap_add:
- CHOWN
- SETUID
- SETGID
- NET_BIND_SERVICE
tmpfs:
- /tmp
- /var/run
security_opt:
- no-new-privileges:true
networks:
- autobot-mgmt
- autobot-app
profiles:
- monitoring
volumes:
autobot_secrets:
postgres_data:
redis_data:
chroma_data:
backend_data:
backend_logs:
slm_data:
slm_logs:
ollama_data:
prometheus_data:
grafana_data:
networks:
autobot-data:
driver: bridge
autobot-app:
driver: bridge
# Shared management network: every service joins this single subnet so all
# fleet nodes report IPs from one range, regardless of app/data tier (#9761).
autobot-mgmt:
driver: bridge
ipam:
config:
- subnet: 172.30.0.0/24