2521690 591df2d18e feat: 增强 edge-agent 服务控制与便携打包能力
- 将 Windows/Linux service control 执行器从占位实现推进到可用
- 新增 service control 测试,覆盖 status/start/stop/restart 主路径
- 增强 edge-agent 启动脚本,优先使用包内私有 Python 运行时
- 增强 Windows/Linux 打包脚本,支持携带私有 Python 运行时
- 更新 edge-agent README 与当前进度总结
- 新增 dist 忽略规则,避免打包产物污染仓库
2026-04-09 11:26:42 +08:00

83 lines
1.7 KiB
Markdown

# Smart Deploy Agent Demo Edge Agent
## Setup
```bash
python -m venv .venv
.venv\Scripts\python -m pip install -e edge-agent
```
## Run Once
```bash
set PYTHONPATH=edge-agent
.venv\Scripts\python -m app.main --once
```
## Run Loop
```bash
set PYTHONPATH=edge-agent
.venv\Scripts\python -m app.main
```
## Test
```bash
set PYTHONPATH=edge-agent
C:\Users\MH\AppData\Local\Programs\Python\Python311\python.exe -m pytest edge-agent/tests -q -p no:cacheprovider
```
## Default Runtime Notes
1. default backend url: `http://127.0.0.1:8000`
2. default edge id: `edge-shanghai-001`
3. current registered tools:
`http_health_check`
`check_port`
`check_process`
`grep_log`
`windows_service_control`
`linux_service_control`
4. current bootstrap implements:
heartbeat
pull task
execute registered tools
report result
report event
## Package Scripts
Current repo includes:
1. `scripts/start-windows.ps1`
2. `scripts/start-linux.sh`
3. `scripts/package-windows.ps1`
4. `scripts/package-linux.sh`
These scripts currently prepare a portable package skeleton and startup entrypoints.
Current Windows package script already bundles a private Python runtime into:
`runtime/python/`
Current Linux package script supports bundling a private Python runtime directory passed in by argument or `EDGE_PYTHON_HOME`.
## Packaging Direction
For user-side delivery, this edge agent is intended to be bundled as:
1. Windows: `zip` portable package
2. Linux: `tar.gz` self-contained runtime directory
## Current Verification Baseline
Current edge-agent baseline: `10 passed`
## Verified Packaging
Current verified artifact:
1. Windows portable package zip has been generated and verified to include:
`start.ps1`
`app/main.py`
`runtime/python/python.exe`