Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
245 lines (236 loc) · 9.49 KB
/
Copy pathdocker-compose.yml
File metadata and controls
245 lines (236 loc) · 9.49 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
name: "memoh"
services:
postgres:
image: postgres:18-alpine
container_name: memoh-postgres
environment:
POSTGRES_DB: memoh
POSTGRES_USER: memoh
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-memoh123}
volumes:
- postgres_data:/var/lib/postgresql
- /etc/localtime:/etc/localtime:ro
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U memoh"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- memoh-network
pgvector:
image: pgvector/pgvector:pg18
container_name: memoh-pgvector
environment:
POSTGRES_DB: memoh_vector
POSTGRES_USER: memoh
POSTGRES_PASSWORD: ${PGVECTOR_PASSWORD:-${POSTGRES_PASSWORD:-memoh123}}
volumes:
- pgvector_data:/var/lib/postgresql
- /etc/localtime:/etc/localtime:ro
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U memoh -d memoh_vector"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- memoh-network
migrate:
image: memohai/server:latest
container_name: memoh-migrate
entrypoint: ["/app/memoh-server", "migrate", "up"]
volumes:
- ${MEMOH_CONFIG:-./config.toml}:/app/config.toml:ro
- memoh_data:/opt/memoh/data
depends_on:
postgres:
condition: service_healthy
restart: "no"
networks:
- memoh-network
server:
stop_grace_period: 45s
image: memohai/server:latest
container_name: memoh-server
privileged: true
pid: host
# Explicit memory ceiling (CM-PRC-001): the Go runtime backs off at
# GOMEMLIMIT instead of running into the container's OOM kill. Keep
# GOMEMLIMIT at roughly 85% of mem_limit when overriding either.
mem_limit: ${MEMOH_SERVER_MEMORY_LIMIT:-8g}
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
GOMEMLIMIT: "${MEMOH_SERVER_GOMEMLIMIT:-7GiB}"
# Proxy: use host.docker.internal for localhost proxies, e.g.
# HTTP_PROXY=http://host.docker.internal:7890 docker compose up -d
HTTP_PROXY: "${HTTP_PROXY:-${http_proxy:-}}"
HTTPS_PROXY: "${HTTPS_PROXY:-${https_proxy:-}}"
NO_PROXY: "${NO_PROXY:-127.0.0.1,localhost},postgres,pgvector,server,channel,web,migrate,webhook-tunnel,connect-it,memoh-postgres,memoh-pgvector,memoh-server,memoh-channel,memoh-web,memoh-migrate,memoh-webhook-tunnel,memoh-connect-it"
http_proxy: "${http_proxy:-${HTTP_PROXY:-}}"
https_proxy: "${https_proxy:-${HTTPS_PROXY:-}}"
no_proxy: "${no_proxy:-${NO_PROXY:-127.0.0.1,localhost}},postgres,pgvector,server,channel,web,migrate,webhook-tunnel,connect-it,memoh-postgres,memoh-pgvector,memoh-server,memoh-channel,memoh-web,memoh-migrate,memoh-webhook-tunnel,memoh-connect-it"
MEMOH_INTERNAL_RPC_SHARED_SECRET: "${MEMOH_INTERNAL_RPC_SHARED_SECRET:?MEMOH_INTERNAL_RPC_SHARED_SECRET is required}"
MEMOH_AGENT_CREDENTIALS_ENCRYPTION_KEY: "${MEMOH_AGENT_CREDENTIALS_ENCRYPTION_KEY:-}"
MEMOH_INTERNAL_RPC_SERVER_TARGET: "server:9090"
MEMOH_INTERNAL_RPC_CHANNEL_TARGET: "channel:9091"
MEMOH_CONNECT_IT_BASE_URL: "${MEMOH_CONNECT_IT_BASE_URL:-}"
MEMOH_CONNECT_IT_API_TOKEN: "${MEMOH_CONNECT_IT_API_TOKEN:-}"
MEMOH_DISPLAY_WEBRTC_UDP_PORT: "${MEMOH_DISPLAY_WEBRTC_UDP_PORT:-${MEMOH_DISPLAY_WEBRTC_UDP_PORT_MIN:-30000}}"
volumes:
- ${MEMOH_CONFIG:-./config.toml}:/app/config.toml:ro
- ./conf/providers:/app/conf/providers:ro
- containerd_data:/var/lib/containerd
- server_cni_state:/var/lib/cni
- memoh_data:/opt/memoh/data
# Expose host CDI specs to the nested containerd used for bot workspaces.
- /etc/cdi:/etc/cdi:ro
- /var/run/cdi:/var/run/cdi:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "8080:8080"
- "1455:8080"
- "${MEMOH_DISPLAY_WEBRTC_UDP_PORT:-${MEMOH_DISPLAY_WEBRTC_UDP_PORT_MIN:-30000}}:${MEMOH_DISPLAY_WEBRTC_UDP_PORT:-${MEMOH_DISPLAY_WEBRTC_UDP_PORT_MIN:-30000}}/udp"
expose:
- "9090"
depends_on:
migrate:
condition: service_completed_successfully
pgvector:
condition: service_healthy
restart: unless-stopped
networks:
- memoh-network
channel:
image: memohai/server:latest
container_name: memoh-channel
entrypoint: ["/app/memoh-channel", "serve"]
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
HTTP_PROXY: "${HTTP_PROXY:-${http_proxy:-}}"
HTTPS_PROXY: "${HTTPS_PROXY:-${https_proxy:-}}"
NO_PROXY: "${NO_PROXY:-127.0.0.1,localhost},postgres,server,channel,webhook-tunnel,memoh-postgres,memoh-server,memoh-channel,memoh-webhook-tunnel"
http_proxy: "${http_proxy:-${HTTP_PROXY:-}}"
https_proxy: "${https_proxy:-${HTTPS_PROXY:-}}"
no_proxy: "${no_proxy:-${NO_PROXY:-127.0.0.1,localhost}},postgres,server,channel,webhook-tunnel,memoh-postgres,memoh-server,memoh-channel,memoh-webhook-tunnel"
MEMOH_INTERNAL_RPC_SHARED_SECRET: "${MEMOH_INTERNAL_RPC_SHARED_SECRET:?MEMOH_INTERNAL_RPC_SHARED_SECRET is required}"
MEMOH_INTERNAL_RPC_SERVER_TARGET: "server:9090"
MEMOH_INTERNAL_RPC_CHANNEL_TARGET: "channel:9091"
MEMOH_WEBHOOK_TUNNEL_MODE: "${MEMOH_WEBHOOK_TUNNEL_MODE:-}"
MEMOH_WEBHOOK_PUBLIC_BASE_URL: "${MEMOH_WEBHOOK_PUBLIC_BASE_URL:-}"
MEMOH_WEBHOOK_TUNNEL_LISTEN_ADDR: ":18734"
MEMOH_WEBHOOK_TUNNEL_METRICS_URL: "http://webhook-tunnel:18735"
volumes:
- ${MEMOH_CONFIG:-./config.toml}:/app/config.toml:ro
- /etc/localtime:/etc/localtime:ro
expose:
- "8081"
- "9091"
- "18734"
depends_on:
migrate:
condition: service_completed_successfully
# Wait for the server so inbound platform messages arriving in the
# startup window do not fail their turn RPC.
server:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:8081/health"]
interval: 30s
timeout: 3s
start_period: 10s
retries: 3
restart: unless-stopped
networks:
- memoh-network
webhook-tunnel:
image: cloudflare/cloudflared:latest
container_name: memoh-webhook-tunnel
command: tunnel --no-autoupdate --url http://channel:18734 --metrics 0.0.0.0:18735
profiles: [webhook-tunnel]
environment:
HTTP_PROXY: "${HTTP_PROXY:-${http_proxy:-}}"
HTTPS_PROXY: "${HTTPS_PROXY:-${https_proxy:-}}"
NO_PROXY: "${NO_PROXY:-127.0.0.1,localhost},channel,memoh-channel"
http_proxy: "${http_proxy:-${HTTP_PROXY:-}}"
https_proxy: "${https_proxy:-${HTTPS_PROXY:-}}"
no_proxy: "${no_proxy:-${NO_PROXY:-127.0.0.1,localhost}},channel,memoh-channel"
depends_on:
- channel
expose:
- "18735"
restart: unless-stopped
networks:
- memoh-network
# Optional co-hosted Connect-It (enable with --profile connectors). It owns
# and migrates its own connect_it schema inside the shared memoh database;
# Memoh reaches it over HTTP only. The bootstrap API token is seeded by
# Connect-It at startup and presented by the Memoh server as its bearer
# token — the install script generates and persists all of these values.
connect-it:
image: "${MEMOH_CONNECT_IT_IMAGE:-ghcr.io/felinics/connect-it:0.3.3}"
container_name: memoh-connect-it
profiles: [connectors]
environment:
DATABASE_URL: "postgres://memoh:${POSTGRES_PASSWORD:-memoh123}@postgres:5432/memoh?sslmode=disable&search_path=connect_it"
CONNECT_IT_SECRET_KEY: "${MEMOH_CONNECT_IT_SECRET_KEY:-}"
COOKIE_SECRET: "${MEMOH_CONNECT_IT_COOKIE_SECRET:-}"
CONNECT_IT_ADMIN_PASSWORD: "${MEMOH_CONNECT_IT_ADMIN_PASSWORD:-}"
CONNECT_IT_BOOTSTRAP_API_TOKEN: "${MEMOH_CONNECT_IT_API_TOKEN:-}"
CONNECT_IT_BASE_URL: "${MEMOH_CONNECT_IT_PUBLIC_BASE_URL:-http://localhost:${MEMOH_CONNECT_IT_PORT:-8421}}"
HTTP_PROXY: "${HTTP_PROXY:-${http_proxy:-}}"
HTTPS_PROXY: "${HTTPS_PROXY:-${https_proxy:-}}"
NO_PROXY: "${NO_PROXY:-127.0.0.1,localhost},postgres,server,connect-it,memoh-postgres,memoh-server,memoh-connect-it"
http_proxy: "${http_proxy:-${HTTP_PROXY:-}}"
https_proxy: "${https_proxy:-${HTTPS_PROXY:-}}"
no_proxy: "${no_proxy:-${NO_PROXY:-127.0.0.1,localhost}},postgres,server,connect-it,memoh-postgres,memoh-server,memoh-connect-it"
ports:
- "${MEMOH_CONNECT_IT_PORT:-8421}:8421"
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
networks:
- memoh-network
web:
image: memohai/web:latest
container_name: memoh-web
environment:
MEMOH_SERVER_UPSTREAM: ${MEMOH_SERVER_UPSTREAM:-memoh-server:8080}
MEMOH_CHANNEL_UPSTREAM: ${MEMOH_CHANNEL_UPSTREAM:-memoh-channel:8081}
ports:
- "8082:8082"
# HTTPS + HTTP/2:h2 多路复用可避免多标签页的 SSE 长连接占满浏览器对单
# origin 的 ~6 条 HTTP/1.1 连接、导致页面卡死(#822)。取消下面两处注释
# 并放入证书后自动启用(自签 / mkcert / Let's Encrypt 均可)。
# - "8443:8443"
# volumes:
# - ./certs:/etc/nginx/certs:ro # 需包含 server.crt 与 server.key
depends_on:
server:
condition: service_healthy
channel:
condition: service_healthy
restart: unless-stopped
networks:
- memoh-network
volumes:
postgres_data:
driver: local
pgvector_data:
driver: local
containerd_data:
driver: local
memoh_data:
driver: local
server_cni_state:
driver: local
networks:
memoh-network:
driver: bridge