This commit is contained in:
toom1996
2026-08-26 10:45:21 +08:00
parent 3cf1368e68
commit 30c9f21da4
48 changed files with 3442 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# ============================================================
# 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