Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
92 lines (90 loc) · 3.74 KB
/
Copy pathdocker-compose.yml
File metadata and controls
92 lines (90 loc) · 3.74 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
# Fixed memory services. Run via the verified launcher so resolved connections
# are injected in memory; existing data/cache volumes and old banks are retained.
#
# Build-time model bake egress: the launcher resolves HF_ENDPOINT from the
# effective network path and passes it here. Not a free choice — the mirror and
# a proxy are alternative paths: behind a proxy hf-mirror.com redirects to
# huggingface.co, whose resolve response has no X-Repo-Commit and the pinned
# snapshot_download fails its metadata check. Default is therefore the official
# endpoint (reached through the forwarded proxy); set
# HF_ENDPOINT=https://hf-mirror.com yourself only on a direct (proxy-less)
# network. Models stay pinned to exact revisions either way.
services:
hindsight:
image: lepimemory-hindsight:0.10.0
build:
context: .
dockerfile: deploy/hindsight/Dockerfile
# Build-only host network reaches a loopback proxy; runtime stays bridged.
network: host
args:
HF_ENDPOINT: ${HF_ENDPOINT:-https://huggingface.co}
HTTP_PROXY: ${HTTP_PROXY:-${http_proxy:-}}
HTTPS_PROXY: ${HTTPS_PROXY:-${https_proxy:-}}
container_name: hindsight
ports:
- "127.0.0.1:8888:8888" # REST API
- "127.0.0.1:9999:9999" # 自带 UI(调试记忆时很有用)
environment:
# Missing resolved connection is read-only, never a key sent to a default endpoint.
HINDSIGHT_API_LLM_PROVIDER: ${HINDSIGHT_API_LLM_PROVIDER:-none}
HINDSIGHT_API_LLM_MODEL: ${HINDSIGHT_API_LLM_MODEL:-}
HINDSIGHT_API_LLM_BASE_URL: ${HINDSIGHT_API_LLM_BASE_URL:-}
HINDSIGHT_API_LLM_API_KEY: ${HINDSIGHT_API_LLM_API_KEY:-}
HINDSIGHT_API_EMBEDDINGS_LOCAL_MODEL: /opt/lepimemory-models/embedding
HINDSIGHT_API_RERANKER_LOCAL_MODEL: /opt/lepimemory-models/reranker
HINDSIGHT_API_STORE_DOCUMENT_TEXT: "true"
HF_HUB_OFFLINE: "1"
TRANSFORMERS_OFFLINE: "1"
volumes:
- hindsight-data:/home/hindsight/.pg0
- hindsight-hf-cache:/home/hindsight/.cache/huggingface
restart: unless-stopped
healthcheck:
# 镜像里没有 curl/wget,但有 python3(/app/api/.venv/bin/python3)
test:
[
"CMD",
"python3",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8888/health', timeout=3)",
]
interval: 15s
timeout: 5s
retries: 20
start_period: 600s # 首次启动慢(建 PG + 拉模型),给足宽限
laya:
image: lepimemory-laya:0.3.26
build:
context: .
dockerfile: deploy/laya/Dockerfile
network: host
args:
HF_ENDPOINT: ${HF_ENDPOINT:-https://huggingface.co}
HTTP_PROXY: ${HTTP_PROXY:-${http_proxy:-}}
HTTPS_PROXY: ${HTTPS_PROXY:-${https_proxy:-}}
ports:
- "127.0.0.1:8000:8000"
environment:
LAYA_API_KEY: ${LEPI_LAYA_API_KEY:-}
LAYA_MAX_CONCURRENT: "1"
LAYA_MAX_TOKEN_BUDGET: "8192"
HF_HUB_OFFLINE: "1"
restart: unless-stopped
healthcheck:
test:
- CMD
- python
- -c
- "import json,os,urllib.request; key=os.environ.get('LAYA_API_KEY',''); r=urllib.request.Request('http://127.0.0.1:8000/health', headers={'Authorization':'Bearer '+key} if key else {}); h=json.load(urllib.request.urlopen(r, timeout=3)); assert h['revisions']['multilingual']=='1720e3e3357cfe1e281542e223f8273b0890ca34'"
interval: 15s
timeout: 5s
retries: 20
start_period: 120s
volumes:
hindsight-data:
# 固定卷名:与既有部署对齐(含既有数据),compose 直接复用;新机器自动创建
name: hindsight-data
hindsight-hf-cache:
# 本地模型缓存(跨容器重建保留;否则每次重建都要重下模型)
name: hindsight-hf-cache