Files
sgame-admin-deploy/sgame-admin.service
2026-07-28 06:30:44 +00:00

48 lines
1.6 KiB
Desktop File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[Unit]
Description=SGame admin server (江湖录后台:玩家反馈 + 埋点 + 看板)
Documentation=https://git.xindiegaming.top/bia/sgame-admin-server
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=sgame
Group=sgame
WorkingDirectory=/opt/sgame-admin
ExecStart=/opt/sgame-admin/server -config /opt/sgame-admin/config.yaml
# 密钥(JWT_SECRET / INIT_ADMIN_PASSWORD / INGEST_APP_KEY)走这个文件,
# 权限 600、属主 sgame不进任何仓库。
EnvironmentFile=/opt/sgame-admin/env
Restart=always
RestartSec=5s
# —— 资源闸 ——
# VPS 总共 459MB还跑着 Caddy / frps / v2ray / vaultwarden。
# 实测常驻 ~30MB150M 留了 5 倍余量:真涨到这个数说明有泄漏,
# 宁可让它被 OOM kill 然后自动重启,也不能把整机拖进 swap 抖动。
#
# 目标机是 CentOS 7 = systemd 219 + cgroup v1只认 MemoryLimit
# 新版的 MemoryMax 在这里会被静默忽略,内存闸等于没写。
MemoryLimit=150M
# 单核机器,限制 CPU 配额避免某次重聚合把 Caddy 饿死
CPUQuota=80%
TasksMax=256
# —— 加固 ——
# 同样受 systemd 219 限制ProtectSystem=strict、ReadWritePaths、
# ProtectKernelTunables、RestrictSUIDSGID 都是 232+ 才有的,写了只会被忽略
# 并刷 warning。full 已经把 /usr /boot /etc 挂成只读,而本服务只写
# /opt/sgame-admin/data够用。
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
StandardOutput=journal
StandardError=journal
SyslogIdentifier=sgame-admin
[Install]
WantedBy=multi-user.target