Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
175 lines (165 loc) · 7.92 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
175 lines (165 loc) · 7.92 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
# 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.
x-backend: &backend
security_opt: ["no-new-privileges:true"] # nothing in Lens needs setuid programs
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
# 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:-}
# 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:-}
# the volume shared with the matterbridge service (its config, written from Settings → Chat rooms)
LENS_MATTERBRIDGE_DIR: /matterbridge
volumes:
- archive-data:/data
- ${AUDIO_DIR:-./local-audio}:/audio:ro
- matterbridge-data:/matterbridge
depends_on:
surrealdb:
condition: service_healthy
restart: unless-stopped
networks: [lens]
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"
healthcheck:
disable: true
frontend:
security_opt: ["no-new-privileges:true"]
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
# 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]
# 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]
volumes:
surreal-data:
matterbridge-data:
archive-data:
fedora-data:
opensearch-data:
networks:
lens:
driver: bridge