fix: 统一管理端部署路径,设备详情页支持无标准配置时展示设备实际模型/人脸库
- 所有路径统一为 /opt/safesightd/{bin,config,data}
- 新增 safesightd.json.example 使用绝对路径,不含 dev 私货
- package.sh 打包时使用示例配置,README 给出完整命令
- safesightd.service 精简冗余配置
- device.html: 无标准配置时仍展示设备上的模型/资源状态
- deployment.md: 路径对齐,补全配置字段
This commit is contained in:
parent
a110436e2d
commit
c440186ce3
@ -2,14 +2,14 @@
|
||||
|
||||
## 打包
|
||||
|
||||
在开发机上:
|
||||
在开发机上(需 Git Bash 或 Linux/WSL):
|
||||
|
||||
```bash
|
||||
cd safesight-control
|
||||
bash scripts/package.sh
|
||||
```
|
||||
|
||||
生成 `safesight-control-*.tar.gz`,包含 ARM64 和 AMD64 两个二进制。
|
||||
生成 `safesight-control-*.tar.gz`,包含 ARM64 和 AMD64 两个二进制、service 文件、配置示例。
|
||||
|
||||
---
|
||||
|
||||
@ -24,11 +24,14 @@ scp safesight-control-*.tar.gz orangepi@10.0.0.81:/tmp/
|
||||
# 在设备上
|
||||
cd /tmp && tar -xzf safesight-control-*.tar.gz
|
||||
cd safesight-control-*
|
||||
sudo cp safesightd-linux-arm64 /usr/local/bin/safesightd
|
||||
sudo chmod +x /usr/local/bin/safesightd
|
||||
|
||||
# 创建配置
|
||||
sudo mkdir -p /opt/safesightd/config
|
||||
# 安装二进制
|
||||
sudo mkdir -p /opt/safesightd/bin
|
||||
sudo cp safesightd-linux-arm64 /opt/safesightd/bin/safesightd
|
||||
sudo chmod +x /opt/safesightd/bin/safesightd
|
||||
|
||||
# 创建数据和配置目录
|
||||
sudo mkdir -p /opt/safesightd/config /opt/safesightd/data
|
||||
sudo cp safesightd.json.example /opt/safesightd/config/safesightd.json
|
||||
sudo vi /opt/safesightd/config/safesightd.json # 修改 agent_token
|
||||
|
||||
@ -41,8 +44,8 @@ sudo systemctl enable --now safesightd
|
||||
### 部署到独立 Linux 服务器(AMD64)
|
||||
|
||||
```bash
|
||||
# 同上,使用 safesightd-linux-amd64
|
||||
sudo cp safesightd-linux-amd64 /usr/local/bin/safesightd
|
||||
# 同上,二进制改为 safesightd-linux-amd64
|
||||
sudo cp safesightd-linux-amd64 /opt/safesightd/bin/safesightd
|
||||
```
|
||||
|
||||
其余步骤相同。
|
||||
@ -57,10 +60,14 @@ sudo cp safesightd-linux-amd64 /usr/local/bin/safesightd
|
||||
{
|
||||
"listen": "0.0.0.0:18080",
|
||||
"discovery_port": 35688,
|
||||
"discovery_timeout_ms": 1200,
|
||||
"offline_after_ms": 10000,
|
||||
"agent_token": "4fe2d69fda23d0d5d04a1486d4920e68",
|
||||
"concurrency": 5,
|
||||
"data_dir": "/opt/safesightd/data",
|
||||
"offline_after_ms": 10000
|
||||
"db_path": "/opt/safesightd/data/app.db",
|
||||
"log_dir": "/opt/safesightd/data/logs",
|
||||
"alarm_retention_days": 30
|
||||
}
|
||||
```
|
||||
|
||||
@ -70,7 +77,7 @@ sudo cp safesightd-linux-amd64 /usr/local/bin/safesightd
|
||||
|
||||
```bash
|
||||
systemctl status safesightd
|
||||
curl http://localhost:18080/health
|
||||
curl http://localhost:18080/api/devices
|
||||
```
|
||||
|
||||
浏览器打开 `http://<IP>:18080`
|
||||
|
||||
@ -178,6 +178,13 @@
|
||||
<strong style="flex-shrink:0">{{if eq $status "ok"}}<span class="pill ok">一致</span>{{else if eq $status "mismatch"}}<span class="pill warn">不一致</span>{{else}}<span class="pill bad">缺失</span>{{end}}</strong></div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else if .DeviceModelStatuses}}
|
||||
<div class="info-list compact-list" style="margin-bottom:0">
|
||||
{{range $m := .DeviceModelStatuses}}
|
||||
<div style="display:flex;justify-content:space-between;align-items:center"><span class="mono" title="{{$m.Name}}" style="margin-bottom:0">{{$m.Name}}</span>
|
||||
<strong style="flex-shrink:0"><span class="pill ok">{{$m.SHA256}}</span></strong></div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .StandardResources}}
|
||||
@ -189,9 +196,16 @@
|
||||
<strong style="flex-shrink:0">{{if eq $status "ok"}}<span class="pill ok">一致</span>{{else if eq $status "mismatch"}}<span class="pill warn">不一致</span>{{else}}<span class="pill bad">缺失</span>{{end}}</strong></div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else if .DeviceResourceStatuses}}
|
||||
<div class="info-list compact-list">
|
||||
{{range $r := .DeviceResourceStatuses}}
|
||||
<div style="display:flex;justify-content:space-between;align-items:center"><span class="mono" title="{{$r.Name}}" style="margin-bottom:0">{{$r.Name}} <span class="muted small">({{resourceTypeLabel $r.ResourceType}})</span></span>
|
||||
<strong style="flex-shrink:0"><span class="pill ok">{{$r.SHA256}}</span></strong></div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if not (or .StandardModels .StandardResources)}}
|
||||
{{if not (or .StandardModels .StandardResources .DeviceModelStatuses .DeviceResourceStatuses)}}
|
||||
<div class="info-list compact-list">
|
||||
<div><span>模型入口</span><strong>通过模型管理页上传到设备</strong></div>
|
||||
<div><span>人脸库</span><strong>通过资源管理与基础配置维护</strong></div>
|
||||
|
||||
12
safesightd.json.example
Normal file
12
safesightd.json.example
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"listen": "0.0.0.0:18080",
|
||||
"discovery_port": 35688,
|
||||
"discovery_timeout_ms": 1200,
|
||||
"offline_after_ms": 10000,
|
||||
"agent_token": "4fe2d69fda23d0d5d04a1486d4920e68",
|
||||
"concurrency": 5,
|
||||
"data_dir": "/opt/safesightd/data",
|
||||
"db_path": "/opt/safesightd/data/app.db",
|
||||
"log_dir": "/opt/safesightd/data/logs",
|
||||
"alarm_retention_days": 30
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
[Unit]
|
||||
Description=SafeSight Control Service
|
||||
Documentation=https://github.com/your-org/SafeSight Control
|
||||
After=network.target network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
@ -10,22 +9,8 @@ User=root
|
||||
Group=root
|
||||
WorkingDirectory=/opt/safesightd
|
||||
ExecStart=/opt/safesightd/bin/safesightd /opt/safesightd/config/safesightd.json
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=process
|
||||
KillSignal=SIGTERM
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
StartLimitInterval=60s
|
||||
StartLimitBurst=3
|
||||
|
||||
# 资源限制(根据需要调整)
|
||||
# LimitNOFILE=65535
|
||||
# LimitNPROC=4096
|
||||
|
||||
# 安全设置
|
||||
NoNewPrivileges=false
|
||||
ProtectSystem=false
|
||||
ProtectHome=false
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@ -22,16 +22,24 @@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o "$BUILD_DIR/s
|
||||
echo "[2/2] 打包..."
|
||||
cp scripts/deploy/safesightd "$BUILD_DIR/"
|
||||
cp scripts/deploy/safesightd.service "$BUILD_DIR/"
|
||||
cp safesightd.json "$BUILD_DIR/safesightd.json.example" 2>/dev/null || true
|
||||
cp safesightd.json.example "$BUILD_DIR/safesightd.json.example" 2>/dev/null || true
|
||||
|
||||
cat > "$BUILD_DIR/README.txt" << 'EOF'
|
||||
SafeSight Control 离线部署包
|
||||
=============================
|
||||
|
||||
部署:
|
||||
sudo ./safesightd install /opt/safesightd
|
||||
sudo vi /opt/safesightd/config/safesightd.json # 修改 token
|
||||
sudo systemctl start safesightd
|
||||
ARM64 设备部署:
|
||||
sudo cp safesightd-linux-arm64 /opt/safesightd/bin/safesightd
|
||||
sudo chmod +x /opt/safesightd/bin/safesightd
|
||||
sudo mkdir -p /opt/safesightd/config /opt/safesightd/data
|
||||
sudo cp safesightd.json.example /opt/safesightd/config/safesightd.json
|
||||
sudo vi /opt/safesightd/config/safesightd.json # 修改 agent_token
|
||||
sudo cp safesightd.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now safesightd
|
||||
|
||||
AMD64 设备部署:
|
||||
同上,二进制改为 safesightd-linux-amd64
|
||||
|
||||
打开 http://<IP>:18080
|
||||
EOF
|
||||
|
||||
Loading…
Reference in New Issue
Block a user