fix: robust auto-start after reboot

- Moved bge_embed_server.py to ~/.hermes/scripts/ (persistent)
- Moved Rust sidecar binary to ~/bin/zhiyi-consolidate (persistent)
- zhiyid.service: After=zhiyi-consolidate bge-embed (start ordering)
- All services: enabled + Linger=yes → auto-start on boot
- ExecStartPre fallback: re-copy from Gitea clone if file missing
This commit is contained in:
小唯 2026-07-02 01:05:24 +08:00
parent c86f5bc304
commit 51aa9de939
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,17 @@
[Unit]
Description=MemoryWeave BGE-M3 ONNX Embed Server
After=network.target
[Service]
Type=simple
Environment="BGE_MODEL_PATH=/home/muc/models/bge-m3/onnx"
Environment="BGE_PORT=8000"
ExecStartPre=/bin/bash -c 'if [ ! -f /home/muc/.hermes/scripts/bge_embed_server.py ]; then cp /tmp/memoryweave/deploy/bge_embed_server.py /home/muc/.hermes/scripts/ 2>/dev/null || true; fi'
ExecStart=/home/muc/.hermes/hermes-agent/.venv/bin/python3 /home/muc/.hermes/scripts/bge_embed_server.py
Restart=always
RestartSec=5
StandardOutput=append:/tmp/bge_embed.log
StandardError=append:/tmp/bge_embed.log
[Install]
WantedBy=default.target

View File

@ -0,0 +1,16 @@
[Unit]
Description=MemoryWeave Rust IPC Sidecar (zhiyi-consolidate)
After=network.target
[Service]
Type=simple
Environment="RUST_LOG=info"
ExecStartPre=/bin/bash -c 'if [ ! -f /home/muc/bin/zhiyi-consolidate ]; then cp /tmp/memoryweave/rust/target/release/zhiyi-consolidate /home/muc/bin/ 2>/dev/null || true; fi'
ExecStart=/home/muc/bin/zhiyi-consolidate --mode socket --socket /tmp/zhiyi-ipc.sock --data-dir /var/lib/memoryweave
Restart=always
RestartSec=5
StandardOutput=append:/tmp/zhiyi-sidecar.log
StandardError=append:/tmp/zhiyi-sidecar.log
[Install]
WantedBy=default.target

View File

@ -0,0 +1,18 @@
[Unit]
Description=ZhiYi MemoryWeave (织忆) — Go Daemon
Documentation=http://192.168.123.11:3000/xiaoxue_admin/memoryweave
After=network.target zhiyi-consolidate.service bge-embed.service
Wants=zhiyi-consolidate.service bge-embed.service
[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
[Install]
WantedBy=default.target