deploy: manage backend with systemd

This commit is contained in:
2026-07-28 17:38:45 +08:00
parent c7bb49776c
commit 80d2716b7c
2 changed files with 25 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
[Unit]
Description=Qiji backend API
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=v6ole
Group=v6ole
WorkingDirectory=/home/v6ole/pyproject/qiji/backend
EnvironmentFile=/home/v6ole/pyproject/qiji/backend/.env
Environment=PYTHONDONTWRITEBYTECODE=1
ExecStart=/home/v6ole/pyproject/qiji/backend/.venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8002
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectKernelTunables=true
ProtectControlGroups=true
UMask=0077
[Install]
WantedBy=multi-user.target
+1 -1
View File
@@ -30,7 +30,7 @@ alembic current
## 3. 发布与验证
- [ ] 使用指定 Tag/镜像摘要部署;禁止直接从未审核工作区运行。
- [ ] 服务以受控进程或编排平台运行,未使用开发热重载。
- [ ] 服务以受控 systemd 服务或编排平台运行,未使用开发热重载。
- [ ] 仅反向代理对公网开放 HTTPS;数据库、缓存、MinIO 管理端口不对公网监听。
- [ ] 健康检查通过:`GET /health`
- [ ] 回归登录、角色授权、企微绑定、受控图片上传和图片下载授权。