Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
530 lines (507 loc) · 24.5 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
530 lines (507 loc) · 24.5 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
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
# Production-like stack: images built without dev tools, no source mounts, no hot reload.
# ACCESS_SECRET_KEY=... AUTH_SECRET=... SURREAL_PASS=... ARCHIVE_SECRET_KEY=... docker compose -f docker-compose.prod.yml up -d
# Put an HTTPS reverse proxy in front of the frontend (port 3000) before exposing it; IIIF auth requires HTTPS.
# Image names of their own: under the same project, the dev stack's default names (<project>-backend, ...) would be
# overwritten by these builds, and a later `docker compose up` would run the production images without hot reload.
# LENS_VERSION tags them (default `prod`), for NAS setups (Synology, QNAP) that run a named image. LENS_BACKEND_IMAGE
# and LENS_FRONTEND_IMAGE name a release's prebuilt images instead, which install.sh writes into .env when it pulls them
# (LENS_IMAGES=pull, with docker-compose.images.yml; docs/deployment.md#prebuilt-images).
x-backend: &backend
security_opt: ["no-new-privileges:true"] # nothing in Lens needs setuid programs
image: ${LENS_BACKEND_IMAGE:-lens-backend:${LENS_VERSION:-prod}}
build:
context: fastapi_backend
target: ${LENS_TARGET:-full} # LibreOffice and Chromium, to read Office files, text, web pages and emails; lean: without
args:
EXTRAS: ${EXTRAS:-}
# model servers on this machine (Ollama, LM Studio) as host.docker.internal, on Linux as on a Mac
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
ACCESS_SECRET_KEY: ${ACCESS_SECRET_KEY:?set ACCESS_SECRET_KEY}
ARCHIVE_SECRET_KEY: ${ARCHIVE_SECRET_KEY:?set ARCHIVE_SECRET_KEY}
SURREAL_URL: ws://surrealdb:8000
SURREAL_USER: ${SURREAL_USER:-root}
SURREAL_PASS: ${SURREAL_PASS:?set SURREAL_PASS}
RUN_BACKGROUND: "false"
FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000}
# where the Cloudflare tunnel (Settings › Remote access) sends visitors: the web app inside this stack
LENS_TUNNEL_ORIGIN: http://frontend:3000
# the web app's container (and the one running the tunnel): their X-Forwarded-For names the visitor, for throttles
LENS_TRUSTED_PROXY_HOSTS: frontend,backend,worker
LENS_NFS_PORT: ${LENS_NFS_PORT:-12049} # where the NFS share is published, for the mount command Settings shows
# the SMB share of the file tree (docs/smb.md): listens on 4445 in the container; LENS_SMB_PORT is where it's
# published, for the address Settings shows
LENS_SMB_LISTEN: 0.0.0.0
LENS_SMB_PORT: ${LENS_SMB_PORT:-1445}
# Fedora (docs/fedora.md): empty keeps it off; with the fedora profile, http://fedora:8080/fcrepo/rest
LENS_FEDORA_URL: ${LENS_FEDORA_URL:-}
LENS_FEDORA_USER: ${LENS_FEDORA_USER:-}
LENS_FEDORA_PASSWORD: ${LENS_FEDORA_PASSWORD:-}
CORS_ORIGINS: '["${FRONTEND_URL:-http://localhost:3000}"]'
ARCHIVE_ALLOWED_HOSTS: ${ARCHIVE_ALLOWED_HOSTS:-backend,localhost,127.0.0.1}
MAIL_SERVER: ${MAIL_SERVER:-}
MAIL_PORT: ${MAIL_PORT:-587}
MAIL_USERNAME: ${MAIL_USERNAME:-}
MAIL_PASSWORD: ${MAIL_PASSWORD:-}
MAIL_FROM: ${MAIL_FROM:-}
# first run (docs/configuration.md#first-run-setup): unset, the web app's setup wizard asks
LENS_SETUP_CODE: ${LENS_SETUP_CODE:-}
LENS_SETUP_WIZARD: ${LENS_SETUP_WIZARD:-}
LENS_ADMIN_EMAIL: ${LENS_ADMIN_EMAIL:-}
LENS_ADMIN_PASSWORD: ${LENS_ADMIN_PASSWORD:-}
LENS_ADMIN_NAME: ${LENS_ADMIN_NAME:-}
LENS_NAMESPACE: ${LENS_NAMESPACE:-}
LENS_LLM_BASE_URL: ${LENS_LLM_BASE_URL:-}
LENS_LLM_MODEL: ${LENS_LLM_MODEL:-}
LENS_LLM_API_KEY: ${LENS_LLM_API_KEY:-}
LENS_LLM_VISION_MODEL: ${LENS_LLM_VISION_MODEL:-}
# settings to start with, saved once and editable in the app (the web installer's answers; docs/configuration.md)
LENS_SETUP_SETTINGS: ${LENS_SETUP_SETTINGS:-}
# private networks calendar feeds and web pages may be fetched from, e.g. 192.168.1.0/24 (documents.web_networks)
LENS_WEB_NETWORKS: ${LENS_WEB_NETWORKS:-}
# opt-in telemetry (docs/telemetry.md): unset, it stays off unless turned on in Settings
LENS_TELEMETRY: ${LENS_TELEMETRY:-}
LENS_TELEMETRY_ENDPOINT: ${LENS_TELEMETRY_ENDPOINT:-}
LENS_TELEMETRY_HEADERS: ${LENS_TELEMETRY_HEADERS:-}
# opt-in usage events to your own Google Analytics 4 property (docs/analytics.md): unset, off unless turned on in Settings
LENS_ANALYTICS: ${LENS_ANALYTICS:-}
LENS_GA_MEASUREMENT_ID: ${LENS_GA_MEASUREMENT_ID:-}
LENS_GA_API_SECRET: ${LENS_GA_API_SECRET:-}
# Prometheus (docs/prometheus.md): /metrics, off unless LENS_PROMETHEUS=on with a LENS_PROMETHEUS_TOKEN; the
# monitoring profile below scrapes it and charts it in Grafana at LENS_GRAFANA_URL
LENS_PROMETHEUS: ${LENS_PROMETHEUS:-}
LENS_PROMETHEUS_TOKEN: ${LENS_PROMETHEUS_TOKEN:-}
LENS_GRAFANA_URL: ${LENS_GRAFANA_URL:-}
# the volume shared with the matterbridge service (its config, written from Settings → Chat rooms)
LENS_MATTERBRIDGE_DIR: /matterbridge
# the volume shared with the mesh service (its config, written while the mesh is on; docs/mesh.md)
LENS_MESH_DIR: /mesh
# the MCP runner (the optional `mcp` service, docs/assistant.md): MCP servers that run as a program, sandboxed there
LENS_MCP_RUNNER_URL: http://mcp:8090
LENS_MCP_TOKEN_FILE: /mcp-key/token
# the assistant's browser (the optional `browser` service, docs/assistant.md): Playwright MCP
LENS_BROWSER_URL: http://browser:8931
# the code sandbox's gateway (the optional `sandbox` profile, docs/assistant.md#code-sandbox): the client
# certificate Lens signs in to it with
LENS_SANDBOX_TLS_DIR: /sandbox-key
# upgrading from the web app (docs/updates.md): the folder install.sh's upgrade agent watches, and the install folder
LENS_CONTROL_DIR: /control
LENS_HOST_DIR: ${LENS_DIR:-}
# how this stack runs, shown (and changed through that agent) in Settings: the edition built above, and where the
# web app's port is published (127.0.0.1: this machine only)
LENS_TARGET: ${LENS_TARGET:-full}
LENS_BIND: ${LENS_BIND:-127.0.0.1}
volumes:
- archive-data:/data
- ./.lens-control:/control
# Lens's docs, which the assistant and agents answer questions about Lens from (lens_help, docs/assistant.md)
- ./docs:/docs:ro
- ${AUDIO_DIR:-./local-audio}:/audio:ro
- matterbridge-data:/matterbridge
- mesh-data:/mesh
- mcp-key:/mcp-key:ro
- sandbox-key:/sandbox-key:ro
depends_on:
surrealdb:
condition: service_healthy
restart: unless-stopped
networks: [lens, mcp, browser, sandbox]
services:
surrealdb:
image: surrealdb/surrealdb:v3.2.4
command: start --log info --user ${SURREAL_USER:-root} --pass ${SURREAL_PASS:?set SURREAL_PASS} surrealkv:/data/lens.db
user: root
volumes:
- surreal-data:/data
healthcheck:
test: ["CMD", "/surreal", "is-ready", "--endpoint", "http://localhost:8000"]
interval: 5s
timeout: 3s
retries: 20
restart: unless-stopped
networks: [lens]
backend:
<<: *backend
worker:
<<: *backend
command: lens worker
# the sensor hub (docs/sensors.md): MQTT and syslog, listened on only once sensors are turned on in the app.
# Something else on this machine using 1883 or 5514? Set LENS_MQTT_PORT / LENS_SYSLOG_PORT to other ports.
# Published where the web app is (LENS_BIND: this machine only unless install.sh opened it to the network);
# LENS_SENSOR_BIND=0.0.0.0 lets devices on the network in while the web app stays local.
ports:
- "${LENS_SENSOR_BIND:-${LENS_BIND:-127.0.0.1}}:${LENS_MQTT_PORT:-1883}:1883"
- "${LENS_SENSOR_BIND:-${LENS_BIND:-127.0.0.1}}:${LENS_SYSLOG_PORT:-5514}:5514/udp"
- "${LENS_SENSOR_BIND:-${LENS_BIND:-127.0.0.1}}:${LENS_SYSLOG_PORT:-5514}:5514/tcp"
# the file tree over NFS (docs/file-tree.md), served only once it's turned on in Settings → NFS share, and then
# only to the networks allowed there. 12049 on this machine so a host NFS server on 2049 is never in the way.
- "${LENS_SHARE_BIND:-${LENS_BIND:-127.0.0.1}}:${LENS_NFS_PORT:-12049}:2049"
# the file tree over SMB (docs/smb.md), served only once it's turned on in Settings → SMB share, and then only
# to the networks allowed there. 1445 on this machine so an SMB server the host runs on 445 is never in the way
# (Windows only connects to 445: install with LENS_SMB_PORT=445 for it; install.sh keeps it).
- "${LENS_SHARE_BIND:-${LENS_BIND:-127.0.0.1}}:${LENS_SMB_PORT:-1445}:4445"
# the graph as files over S3 and WebDAV (docs/file-tree.md): read-only, listened on only once File shares are turned
# on in the app; published where the web app is. Something else using 9555 or 9556? Set LENS_S3_PORT / LENS_WEBDAV_PORT.
- "${LENS_SHARE_BIND:-${LENS_BIND:-127.0.0.1}}:${LENS_S3_PORT:-9555}:9555"
- "${LENS_SHARE_BIND:-${LENS_BIND:-127.0.0.1}}:${LENS_WEBDAV_PORT:-9556}:9556"
healthcheck:
disable: true
frontend:
security_opt: ["no-new-privileges:true"]
image: ${LENS_FRONTEND_IMAGE:-lens-frontend:${LENS_VERSION:-prod}}
build:
context: ./nextjs-frontend
dockerfile: Dockerfile.prod
environment:
API_BASE_URL: http://backend:8000
AUTH_SECRET: ${AUTH_SECRET:?set AUTH_SECRET}
AUTH_TRUST_HOST: "true"
# the containers running the Cloudflare tunnel: their X-Forwarded-For names the visitor (lens-server.js)
LENS_WEB_PROXY_HOSTS: backend,worker
# the file shares at the web app's address, /s3 and /dav (lens-relay.js), once allowed in Settings › File shares,
# and MQTT over WebSockets at /mqtt, once allowed in Settings › Sensors
LENS_S3_URL: http://worker:9555
LENS_WEBDAV_URL: http://worker:9556
LENS_MQTT_WS_URL: http://worker:9883
# no AUTH_URL: sign-in follows the address the browser is on (its LAN name, https:// address or Cloudflare tunnel)
ports:
# this machine only by default; LENS_BIND=0.0.0.0 to reach it from the network (install.sh does on a server)
- "${LENS_BIND:-127.0.0.1}:${LENS_PORT:-3000}:3000"
depends_on: [backend]
restart: unless-stopped
networks: [lens]
# Matterbridge run by Lens (docs/chat-rooms.md): the assistant in Slack, Discord, Telegram, Matrix and WhatsApp rooms,
# set up in Settings → Chat rooms → Run Matterbridge here, which writes its config into the volume the two share.
# Opt-in, and it builds Matterbridge from source the first time: `docker compose --profile matterbridge up -d`.
matterbridge:
security_opt: ["no-new-privileges:true"]
image: lens-matterbridge:${LENS_VERSION:-prod}
build: ./matterbridge
profiles: [matterbridge]
volumes:
- matterbridge-data:/matterbridge
restart: unless-stopped
networks: [lens]
# Apache Tika (docs/configuration.md#apache-tika): reads the text and description of about a thousand kinds of file where Lens can't make
# them into PDFs itself, and what every document says about itself. Opt-in, about 250 MB of memory:
# `docker compose --profile tika up -d` (or COMPOSE_PROFILES=tika in .env), then Settings → Documents → Tika server:
# http://tika:9998. Reachable only inside Lens's network; it has no sign-in of its own.
tika:
image: apache/tika:${TIKA_VERSION:-4.0.0-1}
profiles: [tika]
security_opt: ["no-new-privileges:true"]
read_only: true
tmpfs: [/tmp]
environment:
JAVA_TOOL_OPTIONS: -Xmx${TIKA_HEAP:-512m}
restart: unless-stopped
networks: [lens]
# LanguageTool (docs/processing.md#cleaning-up-transcripts): grammar and punctuation fixes for the clean step. Opt-in,
# about 1 GB of memory: `docker compose --profile languagetool up -d` (or COMPOSE_PROFILES=languagetool in .env), then
# Settings → Analysis → LanguageTool server: http://languagetool:8010. Reachable only inside Lens's network.
languagetool:
image: erikvl87/languagetool:${LANGUAGETOOL_VERSION:-6.8}
profiles: [languagetool]
security_opt: ["no-new-privileges:true"]
environment:
Java_Xms: 256m
Java_Xmx: ${LANGUAGETOOL_HEAP:-768m}
restart: unless-stopped
networks: [lens]
# The MCP runner (mcp-runner/runner.py, docs/assistant.md): MCP servers that run as a program (stdio, usually npx or
# uvx), which admins add as extensions. Opt-in: `docker compose --profile mcp up -d`, or COMPOSE_PROFILES=mcp in .env.
# The sandbox: none of Lens's data or keys, no capabilities, a read-only image, and a network shared only with the
# backend (and the internet).
mcp:
image: lens-mcp:${LENS_VERSION:-prod}
build: ./mcp-runner
profiles: [mcp]
security_opt: ["no-new-privileges:true"]
cap_drop: [ALL]
read_only: true
tmpfs: [/tmp]
mem_limit: 2g
pids_limit: 512
volumes:
- mcp-data:/data
- mcp-key:/key
restart: unless-stopped
networks: [mcp]
# The assistant's browser (docs/assistant.md#the-browser): headless Chromium the assistant drives over MCP
# (Playwright MCP), added in Extensions › Add MCP server › Browser. Opt-in, about 400 MB to download: that page turns
# it on (the upgrade agent adds `browser` to COMPOSE_PROFILES and starts it and its proxy), or
# `docker compose --profile browser up -d`. The sandbox: none of Lens's data or keys, no capabilities, a read-only
# image, its profile in memory only, and a network with no way out but browser-proxy, which reaches public web
# addresses only, on ports 80 and 443 (fastapi_backend/app/domain/netguard.py). One browser for everyone who uses it.
browser:
image: mcr.microsoft.com/playwright/mcp:${PLAYWRIGHT_MCP_VERSION:-v0.0.83}
profiles: [browser]
command:
- --port=8931
- --host=0.0.0.0
- --allowed-hosts=browser:8931
- --shared-browser-context
- --proxy-server=http://browser-proxy:3128
- --image-responses=omit
- --timeout-navigation=45000
- --output-dir=/tmp/output
- --config=/etc/lens/playwright-mcp.json
stdin_open: true # it stops when its input closes
security_opt: ["no-new-privileges:true"]
cap_drop: [ALL]
read_only: true
tmpfs: [/tmp, "/home/node:uid=1000,gid=1000"] # the image runs as node (1000); its profile lives in its home
mem_limit: 1g
pids_limit: 512
volumes:
- ./browser/playwright-mcp.json:/etc/lens/playwright-mcp.json:ro
depends_on: [browser-proxy]
restart: unless-stopped
networks: [browser]
# The browser's only way out: netguard's proxy on its own (the standard library only), to public addresses on the
# web's ports. Nothing else: no data, no keys, nobody's user.
browser-proxy:
image: python:3.12-slim-trixie
profiles: [browser]
command: ["python", "-I", "/netguard/netguard.py", "--listen", "0.0.0.0:3128"]
user: "65534:65534"
security_opt: ["no-new-privileges:true"]
cap_drop: [ALL]
read_only: true
mem_limit: 256m
pids_limit: 256
volumes:
- ./fastapi_backend/app/domain/netguard.py:/netguard/netguard.py:ro
restart: unless-stopped
networks: [browser, browser-out]
# The code sandbox's NVIDIA OpenShell gateway (docs/assistant.md#code-sandbox): Python and bash for the assistant, one
# sandbox container per conversation, made through this machine's Docker. Opt-in: Settings → Code sandbox → Start
# the gateway (the upgrade agent adds `sandbox` to COMPOSE_PROFILES and starts these), or
# `docker compose --profile sandbox up -d openshell-gateway`. Linux only, with Landlock (Linux 6.2 or newer).
# openshell-init makes the gateway's certificates once, in /var/lib/openshell on this machine (the gateway has
# Docker mount files from it into the sandboxes, so it is the same folder inside and out); openshell-key copies the
# client's to the sandbox-key volume, readable by Lens only. Lens reaches the gateway on the sandbox network over
# mutual TLS; each sandbox's supervisor reaches it on this machine's 127.0.0.1:17670.
openshell-init:
image: ghcr.io/nvidia/openshell/gateway:0.1.4
profiles: [sandbox]
user: "0"
network_mode: none
command: ["generate-certs", "--output-dir", "/var/lib/openshell/tls", "--server-san", "openshell-gateway"]
environment:
HOME: /var/lib/openshell
volumes:
- &openshell-data
type: bind
source: /var/lib/openshell
target: /var/lib/openshell
bind:
create_host_path: true
restart: "no"
openshell-key:
image: python:3.12-slim # the sandboxes' default image too, so nothing extra is downloaded
profiles: [sandbox]
user: "0"
network_mode: none
depends_on:
openshell-init:
condition: service_completed_successfully
command:
- python3
- -c
- |
import os, shutil
for src, dst in (("ca.crt", "ca.crt"), ("client/tls.crt", "tls.crt"), ("client/tls.key", "tls.key")):
shutil.copyfile("/tls/" + src, "/key/" + dst + ".new")
os.chown("/key/" + dst + ".new", 1000, 1000)
os.chmod("/key/" + dst + ".new", 0o400)
os.replace("/key/" + dst + ".new", "/key/" + dst)
volumes:
- /var/lib/openshell/tls:/tls:ro
- sandbox-key:/key
restart: "no"
openshell-gateway:
image: ghcr.io/nvidia/openshell/gateway:0.1.4
profiles: [sandbox]
user: "0" # it drives Docker through its socket
command: ["--bind-address", "0.0.0.0", "--port", "17670"]
security_opt: ["no-new-privileges:true"]
cap_drop: [ALL]
read_only: true
tmpfs: [/tmp]
depends_on:
openshell-key:
condition: service_completed_successfully
environment:
OPENSHELL_GATEWAY_CONFIG: /etc/openshell/gateway.toml
OPENSHELL_DB_URL: "sqlite:/var/lib/openshell/gateway.db?mode=rwc"
OPENSHELL_LOCAL_TLS_DIR: /var/lib/openshell/tls
OPENSHELL_TELEMETRY_ENABLED: "false"
XDG_DATA_HOME: /var/lib/openshell
HOME: /var/lib/openshell
ports:
- "127.0.0.1:17670:17670" # this machine only: the sandboxes' supervisors, on the host's network
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- *openshell-data
- ./sandbox/gateway.toml:/etc/openshell/gateway.toml:ro
restart: unless-stopped
networks: [sandbox]
# StyleTTS2 (docs/speech-providers.md#styletts2): spoken answers and podcasts read on this machine, in a voice like a
# short clip you put in its voices volume. Heavy (PyTorch and a 1 GB model, fetched on first use), so opt-in:
# `docker compose --profile styletts2 up -d`, then Settings → AI assistant → Voice → StyleTTS2.
styletts2:
security_opt: ["no-new-privileges:true"]
image: lens-styletts2:${LENS_VERSION:-prod}
build: ./styletts2
profiles: [styletts2]
volumes:
- styletts2-data:/data
- styletts2-voices:/voices
restart: unless-stopped
networks: [lens]
# Fedora 6 (docs/fedora.md), the repository Lens can keep a copy of the archive in. Opt-in, and not needed on small
# machines: `docker compose --profile fedora up`, with LENS_FEDORA_URL=http://fedora:8080/fcrepo/rest (and
# LENS_FEDORA_USER / LENS_FEDORA_PASSWORD) in .env, or set it in Settings → Fedora.
fedora:
image: fcrepo/fcrepo:${FEDORA_VERSION:-6.5.1-tomcat9}
profiles: [fedora]
environment:
CATALINA_OPTS: >-
-Dfcrepo.home=/fcrepo-home -Djava.awt.headless=true -Dfcrepo.autoversioning.enabled=true
ports:
- "127.0.0.1:8081:8080" # its web UI and REST API, for this machine only
volumes:
- fedora-data:/fcrepo-home
networks: [lens]
# OpenSearch (docs/database.md), for word search on a big archive when this machine can spare the memory, or as a
# pattern for a cluster on another machine. Opt-in: `docker compose --profile opensearch up`, then Settings → Search
# → Word search: OpenSearch at http://opensearch:9200, and Reindex now. Reachable only inside Lens's network.
opensearch:
image: opensearchproject/opensearch:${OPENSEARCH_VERSION:-2.19.1}
profiles: [opensearch]
environment:
discovery.type: single-node
DISABLE_SECURITY_PLUGIN: "true"
DISABLE_INSTALL_DEMO_CONFIG: "true"
OPENSEARCH_JAVA_OPTS: -Xms${OPENSEARCH_HEAP:-512m} -Xmx${OPENSEARCH_HEAP:-512m}
volumes:
- opensearch-data:/usr/share/opensearch/data
networks: [lens]
# Prometheus, node-exporter and Grafana (docs/prometheus.md): charts of Lens and this machine over time, ready made.
# Opt-in: Admin → System health or Settings → Telemetry turns it on (the upgrade agent adds `monitoring` to
# COMPOSE_PROFILES and starts these). Prometheus scrapes with the token Lens writes to .lens-control/prometheus-token,
# or LENS_PROMETHEUS_TOKEN when set. Grafana listens where the web app does (LENS_BIND), on LENS_GRAFANA_PORT (3001);
# anyone who reaches it may view, and only the admin may change things.
prometheus:
image: prom/prometheus:${PROMETHEUS_VERSION:-v3.5.0}
profiles: [monitoring]
security_opt: ["no-new-privileges:true"]
entrypoint: ["/bin/sh", "-c"]
command:
- >-
{ if [ -n "$$LENS_PROMETHEUS_TOKEN" ]; then printf %s "$$LENS_PROMETHEUS_TOKEN" > /prometheus/lens-token;
else ln -sf /control/prometheus-token /prometheus/lens-token; fi; } &&
exec /bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus
--storage.tsdb.retention.time=$${LENS_METRICS_DAYS:-30}d
environment:
LENS_PROMETHEUS_TOKEN: ${LENS_PROMETHEUS_TOKEN:-}
LENS_METRICS_DAYS: ${LENS_METRICS_DAYS:-30}
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./.lens-control:/control:ro # prometheus-token, written by Lens when monitoring is turned on
- prometheus-data:/prometheus
restart: unless-stopped
networks: [lens]
node-exporter:
image: prom/node-exporter:${NODE_EXPORTER_VERSION:-v1.9.1}
profiles: [monitoring]
security_opt: ["no-new-privileges:true"]
command: ["--path.rootfs=/host"]
pid: host
volumes:
- /:/host:ro,rslave
restart: unless-stopped
networks: [lens]
grafana:
image: grafana/grafana-oss:${GRAFANA_VERSION:-12.0.2}
profiles: [monitoring]
security_opt: ["no-new-privileges:true"]
environment:
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:-admin} # Grafana asks to change admin on first sign-in
GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: /var/lib/grafana/dashboards/lens-dashboard.json
GF_ANALYTICS_REPORTING_ENABLED: "false"
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
GF_NEWS_NEWS_FEED_ENABLED: "false"
ports:
- "${LENS_BIND:-127.0.0.1}:${LENS_GRAFANA_PORT:-3001}:3000"
volumes:
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- ./docs/grafana:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
depends_on: [prometheus]
restart: unless-stopped
networks: [lens]
# The mesh (docs/mesh.md): Nebula, the private network between Lens's machines, on this machine (mesh/sidecar.py).
# Lens's server writes its config into the volume the two share; it makes this machine's key pair itself and holds
# NET_ADMIN for the mesh's network device, which nothing else in Lens does. It relays the database and the API to
# the machines the mesh's firewall lets in. Started by the upgrade agent when an admin adds a node (Settings ›
# Nodes), or `docker compose --profile mesh up -d`. Other machines reach it on UDP 4242 (LENS_MESH_PORT).
mesh:
image: python:3.12-slim # the plain image: the script is the repo's, Nebula is fetched with its checksum checked
profiles: [mesh]
command: ["python", "-I", "/lens-mesh/sidecar.py"]
security_opt: ["no-new-privileges:true"]
cap_drop: [ALL]
cap_add: [NET_ADMIN]
devices: ["/dev/net/tun:/dev/net/tun"]
read_only: true
tmpfs: [/tmp]
mem_limit: 256m
pids_limit: 256
environment:
LENS_MESH_DIR: /mesh
LENS_MESH_STATE: /state
LENS_MESH_LISTEN_PORT: "4242"
LENS_MESH_RELAYS: 8000=surrealdb:8000,8080=backend:8000
ports:
- "${LENS_MESH_BIND:-0.0.0.0}:${LENS_MESH_PORT:-4242}:4242/udp"
volumes:
- ./mesh/sidecar.py:/lens-mesh/sidecar.py:ro
- mesh-data:/mesh
- mesh-state:/state
restart: unless-stopped
networks: [lens]
volumes:
surreal-data:
matterbridge-data:
mesh-data:
mesh-state:
mcp-data:
mcp-key:
sandbox-key:
styletts2-data:
styletts2-voices:
archive-data:
fedora-data:
opensearch-data:
prometheus-data:
grafana-data:
networks:
lens:
driver: bridge
mcp:
driver: bridge
# the browser, the backend and the browser's proxy: no way out of it (internal)
browser:
driver: bridge
internal: true
# the browser's proxy to the internet
browser-out:
driver: bridge
sandbox:
driver: bridge