safesight-control/docs/deployment.md
tian c440186ce3 fix: 统一管理端部署路径,设备详情页支持无标准配置时展示设备实际模型/人脸库
- 所有路径统一为 /opt/safesightd/{bin,config,data}
- 新增 safesightd.json.example 使用绝对路径,不含 dev 私货
- package.sh 打包时使用示例配置,README 给出完整命令
- safesightd.service 精简冗余配置
- device.html: 无标准配置时仍展示设备上的模型/资源状态
- deployment.md: 路径对齐,补全配置字段
2026-07-22 11:14:30 +08:00

84 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SafeSight Control 部署指南
## 打包
在开发机上(需 Git Bash 或 Linux/WSL
```bash
cd safesight-control
bash scripts/package.sh
```
生成 `safesight-control-*.tar.gz`,包含 ARM64 和 AMD64 两个二进制、service 文件、配置示例。
---
## 部署
### 部署到 Edge 设备ARM64
```bash
# 传到设备
scp safesight-control-*.tar.gz orangepi@10.0.0.81:/tmp/
# 在设备上
cd /tmp && tar -xzf safesight-control-*.tar.gz
cd safesight-control-*
# 安装二进制
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
# 安装服务
sudo cp safesightd.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now safesightd
```
### 部署到独立 Linux 服务器AMD64
```bash
# 同上,二进制改为 safesightd-linux-amd64
sudo cp safesightd-linux-amd64 /opt/safesightd/bin/safesightd
```
其余步骤相同。
---
## 配置
编辑 `/opt/safesightd/config/safesightd.json`
```json
{
"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
}
```
---
## 验证
```bash
systemctl status safesightd
curl http://localhost:18080/api/devices
```
浏览器打开 `http://<IP>:18080`