fix: prepare Guideng for isolated JD runtime
This commit is contained in:
parent
57513d8a03
commit
d4b0ce3ddc
2 changed files with 13 additions and 7 deletions
|
|
@ -6,13 +6,19 @@ Wants=network-online.target
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=guideng
|
User=guideng
|
||||||
EnvironmentFile=/etc/guideng/secret.env
|
Group=guideng
|
||||||
|
EnvironmentFile=-/etc/guanghu/persona-secrets/shared-deepseek.env
|
||||||
|
Environment=GUIDENG_REPO=/var/lib/guanghu/personas/guideng/repository
|
||||||
|
Environment=GUIDENG_CONFIG=/opt/guideng/agent/agent.json
|
||||||
ExecStart=/usr/bin/python3 /opt/guideng/agent/guideng_agent.py
|
ExecStart=/usr/bin/python3 /opt/guideng/agent/guideng_agent.py
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
|
PrivateTmp=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
ReadWritePaths=/opt/guideng/repo /var/lib/guideng
|
ProtectHome=true
|
||||||
|
ReadWritePaths=/var/lib/guanghu/personas/guideng
|
||||||
|
ReadOnlyPaths=/opt/guideng/agent /etc/guanghu/persona-secrets
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ import json, os, subprocess, sys, urllib.request
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
REPO = Path(os.environ.get("GUIDENG_REPO", "/opt/guideng/repo"))
|
REPO = Path(os.environ.get("GUIDENG_REPO", "/var/lib/guanghu/personas/guideng/repository"))
|
||||||
CFG = json.loads(Path(os.environ.get("GUIDENG_CONFIG", "/etc/guideng/agent.json")).read_text())
|
CFG = json.loads(Path(os.environ.get("GUIDENG_CONFIG", "/etc/guideng/agent.json")).read_text())
|
||||||
API_KEY = os.environ["GUIDENG_MODEL_API_KEY"] # 只从环境注入, 服务器 secret.env 提供
|
API_KEY = os.environ.get("GUIDENG_MODEL_API_KEY") or os.environ["DEEPSEEK_API_KEY"]
|
||||||
TZ = CFG.get("timezone", "Asia/Shanghai")
|
TZ = CFG.get("timezone", "Asia/Shanghai")
|
||||||
|
|
||||||
def sh(*args, check=True):
|
def sh(*args, check=True):
|
||||||
|
|
@ -37,8 +37,8 @@ def call_model(messages):
|
||||||
|
|
||||||
def heartbeat():
|
def heartbeat():
|
||||||
today = datetime.now().strftime("%Y-%m-%d")
|
today = datetime.now().strftime("%Y-%m-%d")
|
||||||
sh("git", "fetch", "origin", check=False)
|
sh("git", "fetch", "origin")
|
||||||
sh("git", "pull", "--rebase", "origin", "main", check=False)
|
sh("git", "pull", "--rebase", "origin", "main")
|
||||||
|
|
||||||
channel = (REPO / "lake-heart-channel/冰朔的湖心频道.md").read_text(encoding="utf-8")
|
channel = (REPO / "lake-heart-channel/冰朔的湖心频道.md").read_text(encoding="utf-8")
|
||||||
identity = load_identity()
|
identity = load_identity()
|
||||||
|
|
@ -73,7 +73,7 @@ def heartbeat():
|
||||||
sh("git", "-c", "user.name=归灯 GLS-LA-20260720-003 · 铸渊 ICE-GL-ZY001",
|
sh("git", "-c", "user.name=归灯 GLS-LA-20260720-003 · 铸渊 ICE-GL-ZY001",
|
||||||
"-c", "user.email=ICE-GL-ZY001@fifth-domain.local",
|
"-c", "user.email=ICE-GL-ZY001@fifth-domain.local",
|
||||||
"commit", "-m", f"归灯 · {today} 心跳 · 签到与湖心回音\n\n国作登字-2026-A-00037559")
|
"commit", "-m", f"归灯 · {today} 心跳 · 签到与湖心回音\n\n国作登字-2026-A-00037559")
|
||||||
sh("git", "push", "origin", "main", check=False)
|
sh("git", "push", "origin", "main")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if "--once" in sys.argv:
|
if "--once" in sys.argv:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue