This commit is contained in:
vet
2026-04-20 11:04:45 +07:00
parent 868a22e940
commit 77c464e757
2 changed files with 240 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ ssh -T git@github.com
```
deploy-test/
├── dt.sh # 总控快捷入口pull/build/start/stop/restart/status
├── 00-init-tools.sh # 步骤0可选Linux 服务器安装 Go / Node / Docker、GOPROXY、GitHub HTTPS 重写
├── common.sh # 公共函数库(路径、日志函数)
├── 01-init-env.sh # 步骤1写入 .env.deploy-test已存在则覆盖旧文件带时间戳备份
@@ -91,6 +92,27 @@ deploy-test/
---
## 快捷入口:`dt.sh`
`dt.sh``deploy-test` 的总控脚本,放在 `deploy-test/` 目录内,但会扫描 **deploy-test 上级目录** 下的所有 Git 工程。
```bash
./deploy-test/dt.sh pull # 拉取所有工程最新代码fetch + pull --ff-only
./deploy-test/dt.sh build # 编译后端服务
./deploy-test/dt.sh start # 启动 deploy-test 后端服务
./deploy-test/dt.sh stop # 停止 deploy-test 后端服务
./deploy-test/dt.sh restart # 重启 deploy-test 后端服务
./deploy-test/dt.sh status # 查看服务状态
./deploy-test/dt.sh fe-start pc # 启动 pc 前端
./deploy-test/dt.sh fe-stop pc # 停止 pc 前端
./deploy-test/dt.sh up # pull + build + restart
./deploy-test/dt.sh deploy # pull + build + restart + status
```
`pull` 是安全更新:只执行 `git fetch --all --prune``git pull --ff-only`。如果某工程有本地未提交改动,脚本只会 `fetch` 并提示,不会 `reset` 或覆盖本地修改。
---
## 步骤 0`00-init-tools.sh`(裸机 / 新服务器)
在**尚未安装 Go、Node、Docker** 的 Linux 测试服务器上,先执行本脚本再跑 `01-init-env.sh` 及后续步骤。`setup.sh` **不会**自动调用它,需手动执行。