forked from secureagentics/Adrian
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
139 lines (135 loc) · 4.72 KB
/
Copy pathcompose.yaml
File metadata and controls
139 lines (135 loc) · 4.72 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
# Compose orchestration for Adrian.
#
# Run from the repo root after `adrian-setup bootstrap` has populated
# .env and seeded data/adrian.db. Bring the stack up (backend +
# dashboard + bundled classifier; requires NVIDIA Container Toolkit):
#
# docker compose --profile llm up -d
#
# One-shot bootstrap / reset / set-model use the setup profile:
#
# docker compose --profile setup run --rm setup bootstrap --gguf gemma-4-e2b.gguf
# docker compose --profile setup run --rm setup reset-password
# docker compose --profile setup run --rm setup set-model --gguf gemma-4-e4b.gguf
services:
backend:
build:
context: .
dockerfile: deploy/Dockerfile.backend
image: adrian-backend:local
# Build-only: never pull from a registry. Stops a future
# squatter who registers `adrian-backend:local` on Docker Hub
# from getting silently pulled and run.
pull_policy: build
container_name: adrian-backend
restart: unless-stopped
# .env is optional so `docker compose --profile setup run setup
# bootstrap` can run on a fresh clone before any .env exists.
# The bootstrap subcommand writes .env; subsequent `docker
# compose up` calls then find it.
env_file:
- path: .env
required: false
environment:
ADRIAN_DB_PATH: /data/adrian.db
# Pin the in-container listen to 8080. ADRIAN_BACKEND_PORT in
# .env / env_file only controls the host-side mapping below; if
# we let the Go process read it too it would try to bind that
# host port inside its own netns and the published mapping would
# forward to a port nothing was listening on.
ADRIAN_BACKEND_PORT: "8080"
ports:
- "${ADRIAN_BACKEND_PORT:-8080}:8080"
volumes:
- ./data:/data
- ./models:/models:ro
# Distroless image has no shell / wget / curl, so the binary
# self-probes via `/adrian healthcheck` (HTTP-GET /readyz, exit
# 0/1). start_period covers the cold path: first DB open + the
# classifier upstream's first response (Llama.cpp model load can
# take 30-60 s on a fresh container).
healthcheck:
test: ["CMD", "/adrian", "healthcheck"]
interval: 10s
timeout: 5s
retries: 5
start_period: 60s
# Hold the backend off until the classifier is ready - eliminates
# the early-window where a SDK could connect, fail to classify, and
# (since the engine fails closed) halt every tool call.
depends_on:
llm:
condition: service_healthy
required: false
setup:
profiles: ["setup"]
build:
context: .
dockerfile: deploy/Dockerfile.setup
image: adrian-setup:local
pull_policy: build
volumes:
- .:/workspace
frontend:
build:
context: .
dockerfile: deploy/Dockerfile.frontend
image: adrian-frontend:local
pull_policy: build
container_name: adrian-frontend
restart: unless-stopped
depends_on:
- backend
ports:
- "${ADRIAN_DASHBOARD_PORT:-3000}:3000"
# Local classifier. Enable with the "llm" profile:
# docker compose --profile llm up -d
#
# Hosts a GGUF model behind a Chat Completions endpoint at
# http://adrian-llm:8081/v1/chat/completions (the ADRIAN_LLM_URL
# value `bootstrap --gguf <name>` writes).
#
# NVIDIA GPU is required; the upstream
# ghcr.io/ggml-org/llama.cpp:server-cuda image bundles CUDA + the
# llama-server binary.
llm:
profiles: ["llm"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda
container_name: adrian-llm
restart: unless-stopped
env_file:
- path: .env
required: false
volumes:
- ./models:/models:ro
ports:
- "127.0.0.1:8081:8081"
# ADRIAN_LLM_MODEL_PATH is set by `setup bootstrap --gguf <name>` to
# the in-container path (e.g. /models/gemma-4-e2b.gguf). n-gpu-layers
# 99 offloads everything to the GPU; llama.cpp clamps to the model's
# actual layer count, so this is a safe upper bound.
command: >-
-m ${ADRIAN_LLM_MODEL_PATH:-/models/model.gguf}
--host 0.0.0.0
--port 8081
--ctx-size ${ADRIAN_LLM_CTX_SIZE:-8192}
--n-gpu-layers 99
--jinja
# llama-server exposes /health (returns 200 once the model is
# loaded and ready to accept requests) and /v1/models. The
# upstream image is Ubuntu-based and ships curl, so a shell-form
# check works. start_period covers the load: a 5 GB GGUF + GPU
# offload routinely takes 30-60 s on a cold container.
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8081/health || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 90s
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]