scripts/deploy.sh: build go+rust -> install (not cp) -> stop/reload/start both -> verify (is-active, no (deleted) inode, running-binary checksum == this build, /health=200). --verify-only flag for check-only. make deploy points at this script (replaces stale /usr/local/bin system-level target). Counter-example: install stale sidecar -> service stays active + health=200 (silent pass) -> make deploy-verify exits non-zero (catches silent fault). PartOf=zhiyid.service drop-in on zhiyi-consolidate + ExecStartPre rm /tmp/zhiyi-ipc.sock; restarting zhiyid now restarts sidecar (ActiveEnterTimestamp updates). deploy/ dir aligned to reality and desensitized (3 plaintext keys removed). Key cleanup in git history is a separate track - this card does not touch history. ACs verified. go test internal/governance failures are pre-existing rename tests, unrelated (this card touches no go/ code).
44 lines
2.3 KiB
Desktop File
44 lines
2.3 KiB
Desktop File
# 织忆 MemoryWeave Go Daemon — 用户级 systemd unit 单一真相源(t_f57b8bbf 对齐)
|
||
# 实际安装落点:~/.config/systemd/user/zhiyid.service(本文件是仓库内的脱敏母版,安装/比对用)
|
||
#
|
||
# ⚠️ 脱敏说明:仓库历史里曾含 3 个明文密钥(API_KEY / MOLIFANG_API_KEY / LLM_API_KEY),
|
||
# 已随 git 推到 Gitea origin/main。本文件为脱敏版,不携带任何真实密钥;
|
||
# 真实密钥/端点由运行环境注入。密钥清理属独立专项(本卡不碰 git 历史)。
|
||
#
|
||
# 运行事实(勿与过期全局版混淆):
|
||
# - 二进制 /home/muc/bin/zhiyid-new(install 装,非 /usr/local/bin)
|
||
# - systemd 用户级 ~/.config/systemd/user/(非 /etc/systemd/system 全局)
|
||
# - 数据目录 /var/lib/memoryweave
|
||
# - sidecar zhiyi-consolidate 是独立 unit,本 unit 用 Wants=(单向拉起)+ 其侧 PartOf= 回连重启
|
||
# 构建产物 go/cmd/zhiyid/zhiyid(gitignored)→ install 到 /home/muc/bin/zhiyid-new
|
||
|
||
[Unit]
|
||
Description=ZhiYi MemoryWeave (织忆) — Go Daemon
|
||
Documentation=http://192.168.123.11:3000/xiaoxue_admin/memoryweave
|
||
After=network.target zhiyi-consolidate.service bge-proxy.service
|
||
Wants=zhiyi-consolidate.service bge-proxy.service
|
||
# 2026-09-05 按需化: embedding 走 8000 bge-proxy(远端104优先→本地8001按需拉起)
|
||
# 原 Wants bge-embed.service 已移除(本地 fallback 不常驻)
|
||
|
||
[Service]
|
||
Type=simple
|
||
ExecStartPre=/bin/mkdir -p /var/lib/memoryweave /home/muc/.logs
|
||
ExecStart=/home/muc/bin/zhiyid-new
|
||
Restart=always
|
||
RestartSec=5
|
||
MemoryMax=2G
|
||
CPUQuota=200%
|
||
Environment=STORAGE_BACKEND=lancedb
|
||
# 2026-09-14 distill 改走队列代理 8081(fail fast,避免打爆单槽)
|
||
Environment=LLM_ENDPOINT=http://127.0.0.1:8081/v1/chat/completions
|
||
Environment=LLM_MODEL=local/minicpm5-2b
|
||
Environment=LLM_API_KEY=local-key
|
||
# 2026-09-22 restore rerank: use local cosine reranker via bge-embed service on port 8001
|
||
Environment=RERANK_ENDPOINT=http://127.0.0.1:8001
|
||
# 以下按需 drop-in(~/.config/systemd/user/zhiyid.service.d/):
|
||
# 20-obsidian-vault.conf → OBSIDIAN_VAULT=/home/muc/mc
|
||
# bind-lan-vpn.conf → ZHIYI_BIND=0.0.0.0(ufw 收窄 LAN/VPN 两网段)
|
||
# provenance-observe.conf → ZHIYI_COMMIT_PROVENANCE_OBSERVE=1
|
||
|
||
[Install]
|
||
WantedBy=default.target |