8000 lense/docker-compose.prod.yml at v0.19.0 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
530 lines (507 loc) · 24.5 KB

docker-compose.prod.yml

File metadata and controls

530 lines (507 loc) · 24.5 KB
# 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
0