docs(deploy): 操作顺序铁律改'先库后码再重启'——先代码后库撞Unknown column崩溃实录
This commit is contained in:
parent
fc51fba1ea
commit
704c3f6495
@ -74,21 +74,27 @@ cd /d/doit/pipeline-app
|
||||
|
||||
### 第 2 步:操作(按序执行增量)
|
||||
|
||||
**顺序铁律:先库后码再重启**。新代码可能引用新列/新表,代码先上会在重启后
|
||||
`Unknown column` 崩溃(2026-09-01 生产实录)。
|
||||
|
||||
```bash
|
||||
# 2.1 差异核对(必做):打印生产与测试的差异清单,与本次批次对照
|
||||
./py3/bin/python deploy/ddiff.py --checklist
|
||||
|
||||
# 2.2 代码增量(先代码后库,或按迁移说明顺序)
|
||||
cd /d/doit/pipeline-app/pkgs/<module> && git pull --ff-only origin main
|
||||
cd /d/doit/pipeline-app && ./py3/bin/pip install pkgs/<module>
|
||||
find py3/lib/python3.10/site-packages/<module_pkg> -name __pycache__ -exec rm -rf {} +
|
||||
nohup bash restart-pipeline.sh </dev/null > logs/restart.log 2>&1 &
|
||||
sleep 15; curl -s -o /dev/null -w "health:%{http_code}\n" http://127.0.0.1:9090/
|
||||
|
||||
# 2.3 数据库增量(迁移引擎)
|
||||
# 2.2 数据库增量先行(迁移引擎)
|
||||
./py3/bin/python deploy/dmig.py status # 看台账:哪些已执行、哪些待执行
|
||||
./py3/bin/python deploy/dmig.py plan # 预演:打印本批次将执行的 SQL(不落库)
|
||||
./py3/bin/python deploy/dmig.py apply # 执行(自动先备份本批次表,逐条落库,逐条记账)
|
||||
|
||||
# 2.3 代码增量(库就绪后才上代码)
|
||||
cd /d/doit/pipeline-app/pkgs/<module> && git pull --ff-only origin main
|
||||
cd /d/doit/pipeline-app && ./py3/bin/pip install pkgs/<module>
|
||||
find py3/lib/python3.10/site-packages/<module_pkg> -name __pycache__ -exec rm -rf {} +
|
||||
|
||||
# 2.4 最后重启(生产四进程:逐 pidfile kill 再 start,见 pipeline-prod-operations 技能;
|
||||
# 禁止 pkill -f "pipeline-app" ——会误杀自己的远程 shell)
|
||||
nohup bash restart-pipeline.sh </dev/null > logs/restart.log 2>&1 &
|
||||
sleep 15; curl -s -o /dev/null -w "health:%{http_code}\n" http://127.0.0.1:9090/
|
||||
```
|
||||
|
||||
`dmig.py apply` 的行为:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user