添加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:
2026-03-25 17:26:44 +08:00
parent fe514ebfc4
commit ef8fac7ec2
2 changed files with 32 additions and 1 deletions

View File

@@ -126,4 +126,4 @@ main() {
}
# 执行主函数
main
main

31
rust-backend.service Normal file
View 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