feat: 新增 systemd 持久化部署(deploy/ztools2.service + install-systemd.sh)
systemd 管理 zTools2 后端实现开机自启 + 崩溃自动重启: - deploy/ztools2.service 模板(Restart=on-failure,after mysql) - deploy/install-systemd.sh 自动检测 .venv 或系统 uvicorn,填充路径安装 - README 补持久化部署章节
This commit is contained in:
23
deploy/ztools2.service
Normal file
23
deploy/ztools2.service
Normal file
@@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
Description=zikai file service (zTools2) - FastAPI backend
|
||||
Documentation=https://git.zikai.wang/zikai/zTools2
|
||||
After=network.target mysql.service
|
||||
Wants=mysql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# 工作目录与 uvicorn 路径:安装时由 install-systemd.sh 用实际路径替换
|
||||
WorkingDirectory=__ZTOOLS2_DIR__
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
ExecStart=__UVICORN__ app.main:app --host 127.0.0.1 --port 6867 --workers 1
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
# 后台转换可能耗时较长,放宽超时
|
||||
TimeoutStopSec=30
|
||||
KillSignal=SIGINT
|
||||
# 日志走 journald(journalctl -u ztools2)
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user