feat: spider 常驻服务的 systemd 单元(生产部署用)
This commit is contained in:
26
deploy/fashion-spider.service
Normal file
26
deploy/fashion-spider.service
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Fashion spider worker (claims crawl tasks from backend)
|
||||||
|
Documentation=https://git.23cm.cn/toom1996/spider
|
||||||
|
After=network-online.target docker.service
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
WorkingDirectory=/opt/fashion/spider
|
||||||
|
# -c 指定生产配置(endpoint 指向 127.0.0.1:18092,与后端 HMAC 密钥对齐)
|
||||||
|
# -w 1:同时抓 1 个品牌。抓取是带宽密集的活,多开会互相拖慢且更容易被 Vogue 限流。
|
||||||
|
# -i 5:队列空时每 5 秒轮询一次。
|
||||||
|
ExecStart=/opt/fashion/spider/bin/spider serve -c /opt/fashion/spider/config.prod.yml -w 1 -i 5
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
# 抓取进程偶尔会因为网络问题卡住,超时后由 systemd 拉起
|
||||||
|
TimeoutStopSec=30
|
||||||
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
|
# 日志走 journald:journalctl -u fashion-spider -f
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
SyslogIdentifier=fashion-spider
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user