This commit is contained in:
toom1996
2026-10-19 00:33:25 +08:00
parent 3860e731db
commit 5db90af73a
17 changed files with 853 additions and 5244 deletions

View File

@ -186,6 +186,29 @@ backend/
├── scripts/ # pgvector 起库脚本等
├── go.mod / go.sum
├── Dockerfile
├── docker-compose.yml # 生产编排:db + proxy + backend_a/b + web_a/b
├── deploy.sh # 发布 / 回滚 / 清理旧镜像
├── init-db.sh # 首次建库
├── nginx/default.conf # 常驻代理配置
├── Makefile
└── README.md
```
---
## 7. 部署(Docker,零停机)
生产部署以**本仓库为入口**:`docker-compose.yml`、`deploy.sh`、`init-db.sh`、代理配置都在这里,
脚本会自动把同级的 `/opt/fashion/test`(前端仓)一起拉到位并构建。
```bash
cp .env.example .env # 填 6 个必填密钥
./init-db.sh <sql> # 首次建库
./deploy.sh all # 发布(之后日常就是这一条)
./deploy.sh --rollback # 秒级回滚
```
蓝绿双槽 + 常驻 nginx:发布时只重建空闲槽,健康后再 `nginx -s reload` 切换,在途请求不丢;
镜像按 `RELEASE=时间戳-提交号` 打不可变标签,历史版本不被覆盖。
完整步骤、发布流程、镜像管理、数据库兼容约束与排障见 **[`DEPLOY.md`](./DEPLOY.md)**。