添加systemd service文件,更新部署脚本格式
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
31
rust-backend.service
Normal file
31
rust-backend.service
Normal file
@@ -0,0 +1,31 @@
|
||||
[Unit]
|
||||
Description=Rust Backend Service (Weather Data Collection API)
|
||||
After=network.target postgresql.service
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=/root/rust/rust_backend
|
||||
ExecStart=/root/rust/rust_backend/rust-backend
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
# 环境变量配置
|
||||
EnvironmentFile=/root/rust/rust_backend/.env
|
||||
|
||||
# 安全加固
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=read-only
|
||||
ReadWritePaths=/root/rust/rust_backend
|
||||
|
||||
# 日志标识
|
||||
SyslogIdentifier=rust-backend
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user