Repository navigation
Expand file tree
/
Copy pathcompose.yml
More file actions
253 lines (236 loc) · 7.82 KB
/
Copy pathcompose.yml
File metadata and controls
253 lines (236 loc) · 7.82 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
# Reusable environment for Python/App services
x-app-env: &app-env
UV_NO_SYNC: "1"
HF_TOKEN: ${HF_TOKEN:-}
HF_HUB_OFFLINE: "1"
TRANSFORMERS_OFFLINE: "1"
EMBED_MODEL: /model
OLLAMA_HOST: ollama:11434
OLLAMA_MODEL_ID: tinyllama
CHAINLIT_FILES_DIR: /tmp/chainlit_files
AGNAV_APP_NAME: ${AGNAV_APP_NAME:-BCGEU Navigator}
AGNAV_APP_DESCRIPTION: ${AGNAV_APP_DESCRIPTION:-BCGEU Agreement Navigator}
AGNAV_WELCOME_TITLE: ${AGNAV_WELCOME_TITLE:-BCGEU Navigator}
AGNAV_DATA_DIR: ${AGNAV_DATA_DIR:-/data/sources}
AGNAV_CACHE_DIR: ${AGNAV_CACHE_DIR:-/data/cache}
x-test-env: &test-env
<<: *app-env
# Standard service boilerplate: Resource limits and Persistence
x-service-defaults: &service-defaults
build:
context: ./app
dockerfile: Containerfile
args:
VERSION: ${AGNAV_VERSION:-dev}
target: builder
image: vexilon:dev
mem_limit: 6g
memswap_limit: 6g
volumes: []
services:
# ── Main Application
# Development with Hot-Reload (Ollama)
dev: &dev-service
container_name: vexilon-dev
<<: *service-defaults
user: "${UID:-1000}:${GID:-1000}"
depends_on:
ollama-init:
condition: service_completed_successfully
volumes:
- ./app:/app:z
- /data/cache
- /app/.files
environment:
<<: *app-env
AGNAV_DATA_DIR: ${AGNAV_DATA_DIR:-/app/data}
AGNAV_LLM_PROVIDER: ${AGNAV_LLM_PROVIDER:-ollama}
AGNAV_DEV_MODE: "true"
WATCHFILES_FORCE_POLLING: "true"
PORT: "7860"
mem_limit: 2g
memswap_limit: 2g
ports:
- "7860:7860"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7860/"]
interval: 10s
timeout: 5s
retries: 10
start_period: 120s
command: >
sh -c "cd /app && uv run --no-sync chainlit run main.py --host 0.0.0.0 --port 7860 --headless --watch"
# Staging / Cloud Parity test container running locally (Hugging Face)
staging:
container_name: vexilon-staging
<<: *service-defaults
user: "${UID:-1000}:${GID:-1000}"
depends_on:
ollama-init:
condition: service_completed_successfully
volumes:
- ./app:/app:z
- /data/cache
- /app/.files
environment:
<<: *app-env
AGNAV_DATA_DIR: ${AGNAV_DATA_DIR:-/app/data}
AGNAV_LLM_PROVIDER: huggingface
WATCHFILES_FORCE_POLLING: "true"
PORT: "7861"
mem_limit: 2g
memswap_limit: 2g
ports:
- "7861:7861"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7861/"]
interval: 10s
timeout: 5s
retries: 10
start_period: 120s
command: >
sh -c "cd /app && uv run --no-sync chainlit run main.py --host 0.0.0.0 --port 7861 --headless --watch"
# ── Tests
# Pure logic tests with fully mocked external dependencies.
# Fast, zero RAM footprint, runs on every commit.
test-unit:
container_name: vexilon-test-unit
<<: *service-defaults
environment: *test-env
# Shared healthcheck not needed for one-off test runners
command: >
sh -c "VERIFY_ENABLED=true uv run --no-sync python -m pytest tests/test_*.py -v
--junitxml=reports/junit.xml
--cov=indexing --cov=main --cov-report=xml:reports/coverage.xml"
# Validates integration between app code and the local model services.
# Hits live Ollama instance; requires pre-warmed model weights.
test-integration-model:
container_name: vexilon-test-integration-model
<<: *service-defaults
depends_on:
test-cache:
condition: service_completed_successfully
ollama-init-test:
condition: service_completed_successfully
environment: *test-env
command: >
sh -c "uv run --no-sync python -m pytest tests/integration/ -v"
# Functional tests for the internal RAG streaming logic.
# Verifies end-to-end Python flow from query to token with a mocked LLM.
test-integration-app:
container_name: vexilon-test-integration-app
<<: *service-defaults
depends_on:
test-cache:
condition: service_completed_successfully
volumes: []
environment:
<<: *test-env
PYTHONPATH: /app
AGNAV_LLM_PROVIDER: mock
command: >
sh -c "uv run --no-sync python -m pytest tests/test_rag_stream.py -v"
# CI-only app service without bind mount for e2e tests
# Uses baked-in /app from image, avoiding bind-mount permission issues
app-ci:
container_name: vexilon-app-ci
<<: *service-defaults
user: "${UID:-1000}:${GID:-1000}"
depends_on:
ollama-init:
condition: service_completed_successfully
environment:
<<: *app-env
AGNAV_LLM_PROVIDER: ${AGNAV_LLM_PROVIDER:-ollama}
PORT: "7860"
mem_limit: 2g
memswap_limit: 2g
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7860/"]
interval: 10s
timeout: 5s
retries: 10
start_period: 120s
command: >
sh -c "cd /app && /venv-dev/bin/chainlit run main.py --host 0.0.0.0 --port 7860 --headless"
# UI end-to-end tests using Playwright.
# Verifies keyboard interactions, a11y labels, Knowledge Base drawer, and chat smokes.
test-ui-e2e:
container_name: vexilon-test-ui-e2e
<<: *service-defaults
depends_on:
app-ci:
condition: service_healthy
environment:
<<: *test-env
APP_URL: http://app-ci:7860
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
command: >
sh -c "uv run --no-sync playwright install chromium --with-deps &&
uv run --no-sync python -m pytest tests/e2e/ -v"
# Integrity gate for the pre-computed FAISS index.
# Ensures the baked-in vector store matches the expected manifest.
test-cache:
container_name: vexilon-test-cache
<<: *service-defaults
environment: *app-env
command: /venv/bin/python scripts/generate_cache_manifest.py validate
# The final synchronization gate for the entire repository.
# Only succeeds if all parallel unit and integration suites pass.
test-everything:
container_name: vexilon-test-everything
<<: *service-defaults
depends_on:
test-unit:
condition: service_completed_successfully
test-integration-model:
condition: service_completed_successfully
test-integration-app:
condition: service_completed_successfully
test-ui-e2e:
condition: service_completed_successfully
command: >
sh -c "echo 'ALL SYSTEMS VERIFIED'"
# ── Local LLM (Ollama)
# Core background daemon container. Runs 'ollama serve' indefinitely, loading
# and serving the pulled models in RAM/VRAM on port 11434.
ollama:
container_name: vexilon-ollama
image: ollama/ollama:0.40.5
ports: ["${OLLAMA_PORT:-11434}:11434"]
environment:
OLLAMA_FLASH_ATTENTION: 1
OLLAMA_HOST: 0.0.0.0
volumes:
- ${OLLAMA_DATA_PATH:-ollama_data}:/root/.ollama
mem_limit: 4g
memswap_limit: 4g
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 10s
timeout: 5s
retries: 5
# One-time helper to pull the required model for local development.
# Boots up, pulls model from registry, then exits immediately.
# Fails loudly on network error so developer knows their dev env is broken.
ollama-init: &ollama-init-service
container_name: vexilon-ollama-init
image: ollama/ollama:0.40.5
depends_on:
ollama:
condition: service_healthy
environment:
<<: *app-env
entrypoint: /bin/sh
command: ["-c", "ollama pull $$OLLAMA_MODEL_ID"]
# One-time helper to pull the model specifically for the testing environment.
# Uses '*test-env' and has a safe '|| true' fallback: if registry is flaky/offline,
# but model is already stored in host-restored CI cache, integration tests will still pass.
ollama-init-test:
<<: *ollama-init-service
container_name: vexilon-ollama-init-test
environment:
<<: *test-env
command: ["-c", "ollama pull $$OLLAMA_MODEL_ID || true"]
volumes:
ollama_data: {}