部署到 Vapor Cloud 封面
Vapor 大型教程

部署到 Vapor Cloud

Vapor Cloud 的部署流程可以压缩成几个命令,但失败后怎么取消、资源怎么清理同样重要。这里记录 deploy、查看状态和清理资源的操作。

部署

$ vapor cloud deploy 
app: TILApp
git: https://github.com/wangzhizhou/TILApp-BackEnd.git
env: production
db: yes
replicas: 1
replica size: free
branch: master
build: incremental
Creating deployment [Done]
Connecting to build logs ...
Waiting in Queue [Done]
Checkout branch 'master' [Done]
Verifying base folder [Done]
Selected swift version: 4.1.0 [Done]
Building vapor (release) [Done]
Trying to find executable [Done]
Found executable: Run [Done]
Creating container registry [Done]
Building container [Done]
Pushing container to registry [Done]
Updating replicas [Done]
Deployment succeeded: https://joker.vapor.cloud [Done]
Successfully deployed.

取消部署并删除

首先需要把部署的机器数变为 0:

$  vapor cloud deploy --replicas=0

然后在 Vapor 云上自己的帐号中,从内到外一级一级删除。

上线前检查

版本提示:这里记录的是 Vapor Cloud 旧版命令输出。云平台命令和套餐可能发生变化,实际部署前请以当前官方 CLI 帮助和控制台文档为准。

本系列其他文章