Files
chat/deploy/qingye.service
T
2026-06-15 21:21:20 +08:00

34 lines
1.3 KiB
Desktop File
Raw 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.
# ============================================================
# 青叶 (QingYe) —— systemd 服务单元(开机自启 + 崩溃重启)
# ------------------------------------------------------------
# 安装:
# sudo cp deploy/qingye.service /etc/systemd/system/qingye.service
# sudo systemctl daemon-reload
# sudo systemctl enable qingye # 开机自启
# sudo systemctl start qingye
#
# 查看状态: sudo systemctl status qingye
# 查看日志: sudo journalctl -u qingye -f
#
# ⚠️ ExecStart 必须显式带 -f docker-compose.prod.yml
# 绝不能运行裸 docker compose up(否则可能误用开发配置)。
# ============================================================
[Unit]
Description=QingYe (青叶) Production Stack (Docker Compose)
Requires=docker.service
After=docker.service network-online.target
Wants=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/qingye
# 注意:--env-file 让 ${VAR} 插值来自 .env.prod-f 固定使用生产编排文件
ExecStart=/usr/bin/docker compose --env-file .env.prod -f docker-compose.prod.yml up -d
ExecStop=/usr/bin/docker compose --env-file .env.prod -f docker-compose.prod.yml down
TimeoutStartSec=0
User=root
[Install]
WantedBy=multi-user.target