部署脚本:init_repos.sh 随仓库移动(路径按自身位置推导)+ deploy.conf 改成模板

- init_repos.sh 现在位于 agent/scripts/:AGENT_DIR / DEST_ROOT 全部按脚本位置推导,不再写死 /root/workspace/tools
- 仓库已存在就 pull 到最新后继续;有未提交改动则跳过 pull(不覆盖本地改动)并继续,不再计为失败
- 部署配置搜索顺序:<两仓库父目录>/deploy.conf → scripts/deploy.conf(已 gitignore)→ /root/deploy.conf;找不到时提示从模板复制
- scripts/deploy.conf(原被 git 跟踪)改为 scripts/deploy.conf.example 模板;真身 deploy.conf 进 .gitignore
  (原文件里 4 个 key 均为空、只有默认 admin 密码,无密钥泄漏)
- init.sh: docker 缺失时提示可先跑 scripts/init_host.sh
This commit is contained in:
2026-09-15 21:33:26 +08:00
parent 3f4ab51ea5
commit 295756b798
5 changed files with 82 additions and 63 deletions
+2 -1
View File
@@ -62,7 +62,8 @@ gen_hex() { # $1 = 字节数(默认 32)
}
if [ "$UP" = "1" ] && { ! command -v docker >/dev/null 2>&1 || ! docker compose version >/dev/null 2>&1; }; then
err "要起服务需要 docker + docker compose;只生成配置请用: UP=0 $0"
err "要起服务需要 docker + docker compose。可先跑本仓库的 scripts/init_host.sh(宿主机初始化:装 Docker、swap 等)。"
err "只生成配置请用: UP=0 $0"
exit 1
fi