Files
backend_v2/scripts/fashionapi.service
toom1996 30c9f21da4 update
2026-08-26 10:45:21 +08:00

35 lines
1.2 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.

# ============================================================
# Fashion API —— systemd 服务单元(可选,用于服务器常驻运行)
# ------------------------------------------------------------
# 用法(在服务器上):
# sudo cp fashionapi.service /etc/systemd/system/
# sudo systemctl daemon-reload
# sudo systemctl enable --now fashionapi
# 查看日志:sudo journalctl -u fashionapi -f
#
# 敏感项(JWT_SECRET / DB_PASSWORD 等)建议用 Environment 注入,
# 不要写进 config.yml,也不要提交到仓库。
# ============================================================
[Unit]
Description=Fashion API (public readonly endpoints)
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/fashionapi
ExecStart=/opt/fashionapi/server-linux-amd64
# 生产环境变量覆盖(按需修改)
Environment=CONFIG_PATH=/opt/fashionapi/config.yml
Environment=GIN_MODE=release
# Environment=DB_HOST=127.0.0.1
# Environment=DB_PASSWORD=your_strong_password
# Environment=JWT_SECRET=change-me-to-a-random-long-string
Restart=on-failure
RestartSec=3
# 如需指定运行账户,取消下一行注释并确保该用户对 /opt/fashionapi 有读权限
# User=www-data
[Install]
WantedBy=multi-user.target