chore(release): rename pre-release branch to pre
Docker Image / Build and Push Docker Image (push) Successful in 2m2s
Docker Image / Build and Push Docker Image (push) Successful in 2m2s
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
| 环境 | Git remote | 推送分支 | 宿主机端口 | 容器端口 | 部署脚本 |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| 测试环境 | `test` | `test` | `9135` | `3000` | `scripts/deploy/deploy_web_test.sh` |
|
||||
| 预发环境 | `test` | `pre` | `9135` | `3000` | `scripts/deploy/deploy_web_test.sh` |
|
||||
| 生产环境 | `production` | `main` | `9185` | `3000` | `scripts/deploy/deploy_web.sh` |
|
||||
|
||||
当前 remote 配置示例:
|
||||
@@ -26,15 +26,15 @@ production root@43.106.13.130:/root/cozsweet-repos/main
|
||||
|
||||
## 本地发布流程
|
||||
|
||||
旧测试环境发布流程(脚本迁移前):
|
||||
旧预发环境发布流程(脚本迁移前):
|
||||
|
||||
1. 进入 test worktree:`cozsweet-frontend-nextjs.worktrees/cozsweet-nextjs-test`
|
||||
1. 进入 pre worktree:`cozsweet-frontend-nextjs.worktrees/cozsweet-nextjs-pre`
|
||||
2. 确认当前分支。
|
||||
3. 执行 `git rebase dev`,把 `dev` 的最新代码变基到 `test` 分支。
|
||||
3. 执行 `git rebase dev`,把 `dev` 的最新代码变基到 `pre` 分支。
|
||||
4. 复制测试环境图标到 `public/`。
|
||||
5. 复制 `env-example/.env.local.example` 到 `.env.local`。
|
||||
6. 执行旧版 `scripts/deploy/deploy_web_test.sh`。
|
||||
7. 旧版 `deploy_web_test.sh` 推送 `test` remote 的 `test` 分支。
|
||||
7. 旧版 `deploy_web_test.sh` 推送 `test` remote 的 `pre` 分支。
|
||||
8. 推送成功后尝试清除 Cloudflare CDN 缓存。
|
||||
|
||||
旧生产环境发布流程(脚本迁移前):
|
||||
@@ -71,7 +71,7 @@ production root@43.106.13.130:/root/cozsweet-repos/main
|
||||
| 服务端分支 | 环境变量复制 | 宿主机端口 | 容器名 | 镜像标签 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `main` | `env-example/.env.production.example` → `.env.production` | `9185` | `cozsweet-web-prod` | `cozsweet-web:prod-<commit>` |
|
||||
| `test` | `env-example/.env.local.example` → `.env.local` | `9135` | `cozsweet-web-test` | `cozsweet-web:test-<commit>` |
|
||||
| `pre` | `env-example/.env.local.example` → `.env.local` | `9135` | `cozsweet-web-test` | `cozsweet-web:test-<commit>` |
|
||||
| `dev` | `env-example/.env.development.example` → `.env.local` | `9135` | `cozsweet-web-dev` | `cozsweet-web:dev-<commit>` |
|
||||
| 其他分支 | 使用默认 `.env.local` | `9135` | `cozsweet-web-<branch>` | `cozsweet-web:<branch>-<commit>` |
|
||||
|
||||
@@ -264,12 +264,12 @@ ABORTED ... (docker compose up failed)
|
||||
|
||||
1. `scripts/deploy/*` 只负责推送代码,不负责本地构建和本地启动。
|
||||
2. 自动构建和自动重启只发生在服务器端 `post-receive` hook。
|
||||
3. `main` 分支对应生产环境,`test` 分支对应测试环境。
|
||||
3. `main` 分支对应生产环境,`pre` 分支对应预发环境。
|
||||
4. 生产推送当前使用 `git push --force production main`。
|
||||
5. 构建失败时不会重启容器,旧容器继续运行。
|
||||
6. 服务启动由 Docker Compose 管理,不再使用 `nohup pnpm run start`。
|
||||
7. 服务器需要安装 Docker,并支持 `docker compose` 或旧版 `docker-compose` 命令。
|
||||
8. 测试环境和生产环境都通过同一套 `post-receive` 容器化流程部署,差异仅由分支、环境变量文件和端口决定。
|
||||
8. 预发环境和生产环境都通过同一套 `post-receive` 容器化流程部署,差异仅由分支、环境变量文件和端口决定。
|
||||
|
||||
## 后续优化建议
|
||||
|
||||
|
||||
Reference in New Issue
Block a user