diff --git a/CHANGELOG.md b/CHANGELOG.md index b72de84..1c452a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # 变更记录 +## 2026-08-25(晚)— 服务器意外重启后 raylight/h3-console 全灭,补上 systemd 开机自启 + +**背景**:用户反馈 `http://192.168.110.67:8080/newtask.html` 打不开。排查发现机器在当天 +23:04 自己重启过(`uptime`/`last reboot` 确认,非人为操作),重启后 GPU 显存全空、 +ComfyUI(8188)/raylight-server(8100)/h3-console(8080/8081) 全部没起来——**这台机器此前 +没有任何开机自启配置**(既无 systemd unit 也无 crontab),全靠手动 `start.sh`/`run.sh`。 + +**修复**:临时先手动 `bash raylight/scripts/start.sh` + 手动起两个 h3-console 实例恢复服务, +然后补了三个 systemd unit(本地副本见 `raylight/scripts/raylight.service`、 +`h3-console/systemd/h3-console-lan.service`、`h3-console/systemd/h3-console-public.service`, +服务器上装在 `/etc/systemd/system/`): + +- `raylight.service`:`Type=oneshot` + `RemainAfterExit=yes` 包一层 `start.sh`,只负责 + **开机拉起一次**,**故意不设 `Restart=`**——崩溃自愈已经交给 `watchdog.sh`,两套自动重启 + 机制并存会重现 8月24日 PM2 那次「谁在重启」的排查混乱。 +- `h3-console-lan.service`(8080) / `h3-console-public.service`(8081):`Type=simple` 直接 + `ExecStart=run.sh`(脚本末尾是 `exec uvicorn`,进程替换后 systemd 能正确跟踪主进程), + 日志仍然 `append` 到原来的 `console-8080.log`/`console-subpath.log`,不改用 journald, + 保留原有排查习惯;这两个是无状态 FastAPI,加了 `Restart=on-failure` 没有已知冲突。 +- 三者都已 `enable`。console 两个实例已经停掉手动进程、切到 systemd 管理并验证 200; + `raylight.service` 因为手动起的进程当时健康在跑,为避免几分钟模型重载中断没有强制重启 + 「认领」,只对下次开机生效。 + +**遗留**:没有实测过真的 `reboot` 验证三个 unit 顺序拉起是否顺畅(尤其 raylight 启动要等 +ComfyUI+4卡FSDP集群就绪,可能需要 `TimeoutStartSec` 更宽裕),下次计划性重启时留意确认。 + ## 2026-08-25(凌晨)— 修复 watchdog.sh 误杀:把"采样跑完/VAE存盘中"当成卡死重启,打断了一批正在跑的任务 **背景**:批量重跑 16 个 h3-showcase 案例期间,队列跑到一半突然又出现"进程重启导致任务被取消/ diff --git a/h3-console/README.md b/h3-console/README.md index d92ab12..e208589 100644 --- a/h3-console/README.md +++ b/h3-console/README.md @@ -143,6 +143,13 @@ PID=$(ss -lptn "sport = :8080" | grep -o "pid=[0-9]*" | cut -d= -f2 | sort -u) [ -n "$PID" ] && kill $PID ``` +**开机自启(2026-08-25 补)**:两个实例现在都由 systemd 管理——`/etc/systemd/system/ +h3-console-lan.service`(8080)、`h3-console-public.service`(8081),本地副本见 +`systemd/` 目录,已 `enable`。`ExecStart` 直接指向 `run.sh`(脚本末尾 `exec uvicorn`, +进程替换后 systemd 能正确跟踪),日志仍 `append` 到原来的 `console-8080.log`/ +`console-subpath.log`(不改用 journald),加了 `Restart=on-failure`。改配置后用 +`systemctl restart h3-console-lan h3-console-public` 生效,不用再手动 kill 端口。 + **部署后验过**:`curl http://192.168.110.67:8080/v1/backends` 看到 4/4 ready;提交一个 fl2va 首尾帧任务,`console.log` 里能看到 `[supervisor] flip port=... ref2va -> fl2va`,30 秒后(空闲 判定)触发一次、只触发一次,新后端 ready 后任务自动提交并跑完,下载代理拿到合法 mp4。 diff --git a/h3-console/systemd/h3-console-lan.service b/h3-console/systemd/h3-console-lan.service new file mode 100644 index 0000000..cd2819e --- /dev/null +++ b/h3-console/systemd/h3-console-lan.service @@ -0,0 +1,19 @@ +[Unit] +Description=h3-console (LAN instance, port 8080, elastic supervisor off) +After=network.target raylight.service + +[Service] +Type=simple +User=admin +WorkingDirectory=/data/models/minimax-h3/console +Environment=H3_GATEWAY_URL=http://127.0.0.1:8100 +Environment=H3_CONSOLE_PUBLIC_BASE=http://192.168.110.67:8080 +Environment=PORT=8080 +ExecStart=/data/models/minimax-h3/console/run.sh +StandardOutput=append:/data/models/minimax-h3/console/console-8080.log +StandardError=append:/data/models/minimax-h3/console/console-8080.log +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/h3-console/systemd/h3-console-public.service b/h3-console/systemd/h3-console-public.service new file mode 100644 index 0000000..b836679 --- /dev/null +++ b/h3-console/systemd/h3-console-public.service @@ -0,0 +1,20 @@ +[Unit] +Description=h3-console (public /console subpath instance, port 8081) +After=network.target raylight.service + +[Service] +Type=simple +User=admin +WorkingDirectory=/data/models/minimax-h3/console +Environment=H3_GATEWAY_URL=http://127.0.0.1:8100 +Environment=H3_CONSOLE_PUBLIC_BASE=http://192.168.110.67:8080 +Environment=H3_CONSOLE_BASE_PATH=/console +Environment=PORT=8081 +ExecStart=/data/models/minimax-h3/console/run.sh +StandardOutput=append:/data/models/minimax-h3/console/console-subpath.log +StandardError=append:/data/models/minimax-h3/console/console-subpath.log +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/raylight/README.md b/raylight/README.md index 1138414..eec84f1 100644 --- a/raylight/README.md +++ b/raylight/README.md @@ -30,6 +30,11 @@ bash /data/models/raylight/start.sh 脚本会按端口停掉已在跑的 ComfyUI(8188)/raylight-server(8100),重新拉起两者,轮询健康检查。 照抄的是 `minimax-h3/start-all.sh` 的模式(按端口 `ss -lptn` 找PID kill,不用 `pkill -f`)。 +**开机自启(2026-08-25 补)**:`/etc/systemd/system/raylight.service` 包了这个脚本 +(`Type=oneshot`+`RemainAfterExit=yes`,已 `enable`),本地副本见 `scripts/raylight.service`。 +故意不设 `Restart=`——崩溃自愈交给 `watchdog.sh`,两套自动重启机制并存会重现 8月24日 PM2 +那次「谁在重启」的排查混乱,这个 unit 只管开机拉起一次。 + ## 怎么停 / 回滚到旧的 minimax-h3 ```bash diff --git a/raylight/scripts/raylight.service b/raylight/scripts/raylight.service new file mode 100644 index 0000000..5c472e8 --- /dev/null +++ b/raylight/scripts/raylight.service @@ -0,0 +1,16 @@ +[Unit] +Description=Raylight ComfyUI + FSDP server (MiniMax-H3 backend, 4-GPU cluster) +After=network.target + +[Service] +Type=oneshot +RemainAfterExit=yes +User=admin +WorkingDirectory=/data/models/raylight +ExecStart=/data/models/raylight/start.sh +TimeoutStartSec=300 +# 故意不设 Restart=:崩溃后的自愈已经交给 watchdog.sh 处理,两套自动重启机制并存 +# 会重现 CHANGELOG 2026-08-24「排查清楚谁在重启」那次混乱。这个 unit 只管开机拉起一次。 + +[Install] +WantedBy=multi-user.target