modify: 集成 granian/uvicorn(gunicorn 保留),启动参数保持现状用函数转换

This commit is contained in:
2026-10-13 01:59:00 +08:00
parent 3a359fa485
commit 2df1e7266c
7 changed files with 1126 additions and 579 deletions
+5 -2
View File
@@ -16,6 +16,8 @@
#
# 可选:/etc/chongming.env 中写 APP_WORKERS=<N> 覆盖 worker 数(默认取
# config.toml [production.server].workers,打包版通常为 4)。
# 可选:APP_SERVER=granian|uvicorn|gunicorn 切换 HTTP 服务器(默认 Linux 下
# gunicorn,Windows 下 uvicorn);三者的启动参数同取自 [production.server]。
[Unit]
Description=Chongming Zenoh Gateway (FastAPI + Zenoh + MQTT)
@@ -29,7 +31,8 @@ StartLimitBurst=5
[Service]
Type=simple
# 打包应用入口:Nuitka 编译产物,前台运行 gunicorn master(Linux 分支)
# 打包应用入口:Nuitka 编译产物,前台运行所选服务器 master(默认 Linux 分支为
# gunicorn,可用 APP_SERVER 切到 granian/uvicorn)
ExecStart=/data/chongming/chongming
# 所有相对路径(config.toml / config/ / resources/*.mbank / static.svfs /
# data/ / logs/ / uploads/)均相对工作目录解析,必须指向安装目录
@@ -48,7 +51,7 @@ Environment=PYTHONUNBUFFERED=1
# 私有动态库,再补一条 Environment=LD_LIBRARY_PATH=/opt/sophon/sophon-ffmpeg-latest/lib
Environment=PATH=/opt/sophon/sophon-ffmpeg-latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# 优雅停机:SIGTERM 由 gunicorn 排空 worker,等在途请求/告警上传完成
# 优雅停机:SIGTERM 由服务器 master 排空 worker,等在途请求/告警上传完成
KillSignal=SIGTERM
KillMode=control-group
TimeoutStopSec=30