文件
phonerail/rack/deploy/phonerail-rack.service
T
zhou yang和Claude Opus 5.5 271c649f66 rack:「固件」页 —— 上传 .bin、选板推送 OTA、实时看进度 / 待验证 / 回滚
- firmware.py:固件库。上传时核 ESP 镜像头(0xE9 + app 描述 + project_name == phonerail + ≤3 MB),
  存成 /root/phonerail/fw/<sha 前 16 位>.bin(nginx 7765 放出去),库里记版本 / 编译时间 / 上传人
- api:GET/POST/DELETE /api/firmware(请求体即 .bin,不引 multipart)、POST /api/boards/{id}/ota(进审计);
  通用 /cmd 不放行 ota —— URL 与哈希只能由固件库生成;OTA 事件按 arg 显示中文、失败 / 回滚标红
- 前端:Firmware.vue + OtaState.vue;推送对话框默认不重启,勾「立刻重启」时列出每块板会断电的路并二次确认;
  单板页显示 OTA 状态
- simboard 模拟 ota(下载进度 / 就绪 / 重启 / 自证);test_firmware.py 13 例,后端共 39 例(本机 + 服务器 3.8)
- service 加 --fw-dir;已部署。板 B 实测:上传 → 推送 → 就绪 → 同镜像带重启 → 不重下直接重启 → 自证健康

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 14:14:06 +08:00

25 行
764 B
Desktop File

[Unit]
Description=PhoneRail 机架管理(FastAPI,只绑 127.0.0.1:7764,经统一门户 phonerail.home.example:7755 访问)
After=network-online.target mosquitto.service
Wants=mosquitto.service
[Service]
Type=simple
WorkingDirectory=/root/phonerail-rack/backend
ExecStart=/root/phonerail-rack/venv/bin/python -m prrack.main \
--db /root/phonerail-rack/data/rack.db \
--static /root/phonerail-rack/frontend/dist \
--mqtt-env /root/phonerail/mqtt.env \
--fw-dir /root/phonerail/fw \
--bind 127.0.0.1 --port 7764
Restart=on-failure
RestartSec=3
StandardOutput=append:/var/log/phonerail-rack.log
StandardError=append:/var/log/phonerail-rack.log
NoNewPrivileges=true
ProtectSystem=full
PrivateTmp=true
[Install]
WantedBy=multi-user.target