1.1.3 • Published 3 years ago
koot-serverless v1.1.3
Serverless迁移步骤
确认安装koot@0.13.3以上版本
可以使用koot-cli进行升级
npx koot-cli
版本跨度较大时,需要进行迁移测试。
下载koot-serverless模板里的serverless文件夹
下载serverless文件夹,复制到项目根目录下
https://github.com/cmux/koot-serverless/tree/master/packages/koot-serverless
Tips:
可以使用chrome插件GitZip进行github文件夹打包下载安装koot-serverless
yarn add koot-serverless
确认编译和发布脚本
确保同一个环境的
npm scripts
中打包和发布的环境变量target
。 prod对应生产环境,qa对应测试环境。// package.json { ... "scripts": { ... "build:qa": "koot-build --config ./serverless/koot.config.js -- target=qa", "build:prod": "koot-build --config ./serverless/koot.config.js -- target=prod", "deploy:qa": "./serverless/deploy.js qa", "deploy:prod": "./serverless/deploy.js prod" } ... }
整理依赖
把
package.json
里,dependencies
里的依赖移到devDependencie
s里,服务端依赖除外。与运维对接创建发布流程
配置 publicPath
需要运维提供cos绑定的域名或者腾讯提供的免费域名,写入
serverless/config.js
的publicPath
。需要运维配置
- 选择serverless专用的docker
- 确定触发的tag前缀
- 需要在项目根目录生成.env文件
TENCENT_SECRET_ID=aaa TENCENT_SECRET_KEY=bbb
- 需要在项目根目录生成
serverless.yml
文件,$
开头的值需要运维修改name: $name koot-csr: component: 'koot-tencent-website' inputs: code: root: ./public region: $region bucketName: $bucketName koot-ssr: component: 'koot-tencent-koa' inputs: code: ./server region: $region functionName: $functionName serviceId: $serviceId tags: $tagkey: $tagvalue
- 执行发布脚本
npm run deploy:prod #发布环境对应的脚本
打包发布
打包和发布步骤:
npm run build:prod # 打包 git add serverless git commit -m "build:prod" # 提交 git push git tag release-xxxxxxxx # 打tag git push --tag # 审批流程
1.1.3
3 years ago
1.1.2
3 years ago
1.1.1
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.0.10
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago