ljsysfurry commited on
Commit
101dd80
·
verified ·
1 Parent(s): f6721ee

Upload agentframe/deploy/install.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. agentframe/deploy/install.sh +52 -0
agentframe/deploy/install.sh ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # AgentFrame 一键部署脚本 (本机 systemd)
3
+ set -e
4
+
5
+ FRAMEWORK_DIR="/root/.openclaw/workspace/agentframe"
6
+ INSTALL_DIR="/opt/agentframe"
7
+ STATE_DIR="/var/lib/agentframe"
8
+
9
+ echo "📦 AgentFrame 部署脚本"
10
+ echo "======================"
11
+
12
+ # 1. 复制到 /opt
13
+ if [ ! -d "$INSTALL_DIR" ]; then
14
+ mkdir -p "$INSTALL_DIR"; cp -r "$FRAMEWORK_DIR" "$INSTALL_DIR/agentframe"
15
+ echo "✅ 已复制到 $INSTALL_DIR"
16
+ else
17
+ cp -r "$FRAMEWORK_DIR" "$INSTALL_DIR/"
18
+ echo "✅ 已更新 $INSTALL_DIR"
19
+ fi
20
+
21
+ # 2. 状态目录
22
+ mkdir -p "$STATE_DIR"
23
+ echo "✅ 状态目录: $STATE_DIR"
24
+
25
+ # 3. systemd 服务
26
+ cp "$FRAMEWORK_DIR/deploy/agentframe.service" /etc/systemd/system/agentframe.service
27
+ # 修正工作目录
28
+ sed -i "s|WorkingDirectory=/opt/agentframe|WorkingDirectory=$INSTALL_DIR/agentframe|" /etc/systemd/system/agentframe.service
29
+ systemctl daemon-reload
30
+ systemctl enable agentframe
31
+ echo "✅ systemd 服务已注册"
32
+
33
+ # 4. API key 检查
34
+ if [ -z "$AGENTFRAME_API_KEY" ]; then
35
+ echo "⚠️ 未设置 AGENTFRAME_API_KEY, 服务将使用 mock (离线模式)"
36
+ echo " 设置: export AGENTFRAME_API_KEY=sk-xxx 后重启服务"
37
+ else
38
+ sed -i "s|Environment=\"AGENTFRAME_API_KEY=.*|Environment=\"AGENTFRAME_API_KEY=$AGENTFRAME_API_KEY\"|" /etc/systemd/system/agentframe.service
39
+ systemctl daemon-reload
40
+ echo "✅ API key 已配置"
41
+ fi
42
+
43
+ # 5. 启动
44
+ systemctl restart agentframe || true
45
+ sleep 2
46
+ if systemctl is-active agentframe >/dev/null 2>&1; then
47
+ echo "✅ 服务运行中: http://0.0.0.0:8090/health"
48
+ else
49
+ echo "⚠️ 服务启动失败, 查看日志: journalctl -u agentframe -n 50"
50
+ fi
51
+
52
+ echo "完成!"