Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
149 lines (144 loc) · 6.46 KB
/
Copy pathcompose.yaml
File metadata and controls
149 lines (144 loc) · 6.46 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
# Loom, and by default its own ClickHouse.
#
# COMPOSE_PROFILES=bundled start the clickhouse service below (the default)
# COMPOSE_PROFILES= use the ClickHouse that LOOM_CH_* in .env names:
# a self-managed server or ClickHouse Cloud
#
# install.sh writes .env for either choice, and docs/operations/deployment.md
# covers both. The release bundle ships this file with the repository's layout,
# so the same file runs from a clone (dev/docker-compose.dev.yml adds the source
# build) and from an install directory.
services:
clickhouse:
profiles: [bundled]
# The latest release, as CI runs (dev/ci_start_clickhouse.sh); a release
# bundle names the one that was latest when it was built.
# LOOM_CLICKHOUSE_IMAGE pins another, e.g. clickhouse/clickhouse-server:head
# for a master build (unsupported).
image: ${LOOM_CLICKHOUSE_IMAGE:-clickhouse/clickhouse-server:latest}
restart: unless-stopped
environment:
CLICKHOUSE_DB: loom
CLICKHOUSE_USER: loom
CLICKHOUSE_PASSWORD: loomdev
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: "1"
ulimits:
nofile:
soft: 262144
hard: 262144
volumes:
- loom-ch-data:/var/lib/clickhouse
# The English lemmatizer for ad-hoc lemmatize('en', ...) queries.
- ./deploy/lemmagen3:/var/lib/clickhouse/lemmagen3:ro
- ./deploy/clickhouse-config/lemmatizers.xml:/etc/clickhouse-server/config.d/lemmatizers.xml:ro
# The loom_reader user and profile, the tenant quota, the NLP flags.
- ./deploy/clickhouse-config/nlp_user_settings.xml:/etc/clickhouse-server/users.d/nlp_user_settings.xml:ro
# An embedded single-node Keeper for the KeeperMap tables.
- ./deploy/clickhouse-config/keeper.xml:/etc/clickhouse-server/config.d/keeper.xml:ro
# A user with no row policy on a table reads none of it.
- ./deploy/clickhouse-config/access_control.xml:/etc/clickhouse-server/config.d/access_control.xml:ro
# query_log and text_log keep 30 days.
- ./deploy/clickhouse-config/system_logs.xml:/etc/clickhouse-server/config.d/system_logs.xml:ro
# Named collections for the SQL ai* functions; defines none as shipped.
# Git-ignored, so `make bootstrap` makes it: a missing file is an error,
# not a root-owned directory Docker creates in its place.
- type: bind
source: ./deploy/clickhouse-config/named_collections.xml
target: /etc/clickhouse-server/config.d/named_collections.xml
read_only: true
bind:
create_host_path: false
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]
interval: 5s
timeout: 3s
retries: 30
loom:
image: "${LOOM_IMAGE_REPOSITORY:-ghcr.io/clickhouse/loom}:${LOOM_VERSION:-latest}"
# The per-server runtime files (server/core/runtime_files.py), empty on every start.
tmpfs:
- /run/loom:uid=999,gid=999,mode=0700
restart: unless-stopped
# Uvicorn waits LOOM_GRACEFUL_SHUTDOWN_S (10 s) for in-flight requests, then
# the lifespan drains run; Docker's default 10 s would kill them mid-drain.
stop_grace_period: 75s
depends_on:
clickhouse:
condition: service_healthy
# Skipped when the bundled profile is off.
required: false
ports:
- "${LOOM_BIND_HOST:-127.0.0.1}:${LOOM_PORT:-7777}:7777"
ulimits:
nofile:
soft: 65536
hard: 65536
# A ClickHouse on the Docker host is host.docker.internal, on Linux too.
extra_hosts:
- "host.docker.internal:host-gateway"
env_file:
- .env
environment:
# Unset in .env means the bundled clickhouse service.
LOOM_CH_HOST: "${LOOM_CH_HOST:-clickhouse}"
LOOM_CH_PORT: "${LOOM_CH_PORT:-8123}"
LOOM_CH_USER: "${LOOM_CH_USER:-loom}"
# Only an unset password means the bundled one; an empty one stays empty.
LOOM_CH_PASSWORD: "${LOOM_CH_PASSWORD-loomdev}"
LOOM_CH_READER_USER: "${LOOM_CH_READER_USER-loom_reader}"
# One source for both ends: the extractor's token is interpolated the same way,
# so a shell export cannot give the two services different tokens.
LOOM_DOCUMENT_EXTRACTOR_TOKEN: "${LOOM_DOCUMENT_EXTRACTOR_TOKEN:-}"
LOOM_DEPLOYMENT: "1"
LOOM_INSTANCE_LABEL: "deploy:standalone"
# The address the port is published on; see docs/operations/deployment.md.
LOOM_BIND_HOST: "${LOOM_BIND_HOST:-127.0.0.1}"
# Two processes unless .env names a count. The bundled ClickHouse may share
# this host and the container has no limits, so the image's own default
# (one per host CPU and GiB) could leave it no room.
LOOM_WEB_WORKERS: "${LOOM_WEB_WORKERS:-2}"
LOOM_ASSISTANT_ENABLED: "${LOOM_ASSISTANT_ENABLED:-false}"
volumes:
- loom-code-repos:/app/var/code_repos
networks: [default, extractor]
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:7777/v1/health/ready',timeout=3).status==200 else 1)",
]
interval: 10s
timeout: 5s
retries: 12
# Readiness, not liveness. A boot can wait up to 900 s on another
# process's migration lease before it applies or finds nothing pending.
start_period: 900s
# The document parsers, apart from the server: it holds no Loom or database
# credential, its network is internal (no route out) and shared with the loom
# service alone, which reaches it at LOOM_DOCUMENT_EXTRACTOR_URL with the token
# .env holds. Each extraction runs under a filter that makes no socket, so one
# a hostile file takes over reaches nothing, loom included, while extractions
# run one at a time, as here (docs/architecture/document-extraction.md).
extractor:
image: "${LOOM_EXTRACTOR_IMAGE_REPOSITORY:-ghcr.io/clickhouse/loom-extractor}:${LOOM_VERSION:-latest}"
restart: unless-stopped
environment:
# Unset, the service refuses to start and says so; the installer writes it.
LOOM_EXTRACTOR_TOKEN: "${LOOM_DOCUMENT_EXTRACTOR_TOKEN:-}"
networks: [extractor]
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
# One extraction at a time (LOOM_EXTRACTOR_CONCURRENCY), each held to
# LOOM_EXTRACTOR_MEMORY_MB (1 GiB) by its own limit; this bounds the whole.
mem_limit: 1536m
cpus: 1
pids_limit: 64
networks:
extractor:
internal: true
volumes:
loom-ch-data:
loom-code-repos: