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