- package.sh: 打包包含 configs 种子数据、tools 构建工具、deps 离线依赖、scripts 辅助脚本 - ImportSeedAssets: 首次启动检测空库自动导入 templates/profiles/overlays - face_gallery.html: 添加构建人脸库按钮 - device.html: 无标准配置时显示设备实际模型/资源,无人脸库配置时隐藏按钮 - register-face-gallery.py: 手动注册已构建人脸库到 standard_resources - deployment.md: 更新部署流程反映新包结构 - .gitignore: 排除 *.tar.gz 构建产物
100 lines
2.4 KiB
Markdown
100 lines
2.4 KiB
Markdown
# SafeSight Control 部署指南
|
||
|
||
## 打包
|
||
|
||
在开发机上(需 Git Bash 或 Linux/WSL):
|
||
|
||
```bash
|
||
cd safesight-control
|
||
bash scripts/package.sh
|
||
```
|
||
|
||
生成 `safesight-control-*.tar.gz`,包含:
|
||
- ARM64 + AMD64 二进制
|
||
- service 文件、配置示例
|
||
- **种子配置数据**(configs/:templates、profiles、overlays)
|
||
- **人脸库构建工具**(tools/:Python 脚本 + ONNX 模型)
|
||
- **离线 Python 依赖**(deps/:onnxruntime wheel)
|
||
- **辅助脚本**(scripts/:import-assets、register-face-gallery)
|
||
|
||
---
|
||
|
||
## 部署(ARM64)
|
||
|
||
```bash
|
||
# 传到设备
|
||
scp safesight-control-*.tar.gz user@server:/tmp/
|
||
|
||
# 解压
|
||
cd /tmp && tar -xzf safesight-control-*.tar.gz
|
||
cd safesight-control-*
|
||
|
||
# 安装
|
||
sudo mkdir -p /opt/safesightd/{bin,config,data}
|
||
sudo cp safesightd-linux-arm64 /opt/safesightd/bin/safesightd
|
||
sudo chmod +x /opt/safesightd/bin/safesightd
|
||
sudo cp safesightd.json.example /opt/safesightd/config/safesightd.json
|
||
sudo cp -r configs /opt/safesightd/
|
||
sudo cp -r tools /opt/safesightd/
|
||
sudo cp -r scripts /opt/safesightd/
|
||
|
||
# 安装服务
|
||
sudo cp safesightd.service /etc/systemd/system/
|
||
sudo systemctl daemon-reload
|
||
sudo systemctl enable --now safesightd
|
||
|
||
# 首次启动自动导入种子数据,无需手动操作
|
||
```
|
||
|
||
AMD64 部署同上,二进制改为 `safesightd-linux-amd64`。
|
||
|
||
---
|
||
|
||
## 配置
|
||
|
||
编辑 `/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
|
||
# 1. 离线安装 Python 依赖(仅首次)
|
||
sudo pip3 install /opt/safesightd/deps/*.whl
|
||
|
||
# 2. 通过 Web UI 导入照片后,触发构建
|
||
curl -X POST http://localhost:18080/face-gallery/build
|
||
|
||
# 3. 如从外部传入已构建的 face_gallery.db:
|
||
sudo mkdir -p /opt/safesightd/resources/standard_resources/face_gallery
|
||
sudo cp face_gallery.db /opt/safesightd/resources/standard_resources/face_gallery/
|
||
sudo python3 /opt/safesightd/scripts/register-face-gallery.py
|
||
sudo systemctl restart safesightd
|
||
```
|
||
|
||
---
|
||
|
||
## 验证
|
||
|
||
```bash
|
||
systemctl status safesightd
|
||
curl http://localhost:18080/api/devices
|
||
```
|
||
|
||
浏览器打开 `http://<IP>:18080`
|