feat(deploy): 目录自适应 + Celery 自动轮询接入 systemd

1. start.sh BASE_DIR 不再硬编码 /root/ipam,改为跟随脚本所在目录
   (BASH_SOURCE 自动检测),无论部署在 /opt /usr/local /root 等
   任意目录都能工作。
2. 运行 start.sh 时自动生成 3 个 systemd 单元并 enable 开机自启:
   - ipam-backend (uvicorn :8008)
   - ipam-celery-worker
   - ipam-celery-beat (每60秒触发SNMP设备自动轮询)
   均含 Restart=always 崩溃自动重启,日志写入 /var/log/ipam/。
3. 前端 vite dev server 保持 nohup 启动(不纳入 systemd)。
4. stop.sh 改为 systemctl stop 停止 systemd 服务,pkill 兜底。
5. .gitignore 忽略 celerybeat-schedule 运行期文件。
This commit is contained in:
Your Name
2026-08-12 11:05:18 +08:00
parent 5369d8d6e5
commit 18cefa6ded
3 changed files with 197 additions and 83 deletions
+4
View File
@@ -22,6 +22,10 @@ dist/
*.log
/tmp/
# Celery Beat 调度状态文件(运行期自动生成)
celerybeat-schedule*
celerybeat.pid
# OS
.DS_Store
Thumbs.db