safesight-control/docs/deployment.md

87 lines
2.0 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 文件、配置示例
- **种子配置数据**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 bash install.sh
```
AMD64 部署同上,`install.sh` 自动识别架构。
首次启动自动导入种子数据,无需手动操作。
---
## 配置
编辑 `/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`