deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeploying on GuaraCloud
在GuaraCloud上部署服务
Build Methods
构建方式
| Method | When to use | What happens |
|---|---|---|
| Project has a Dockerfile | Builds using the Dockerfile in the repo |
| No Dockerfile, or prefer auto-detection | Heroku-style buildpacks detect language and build automatically |
For monorepos, use , , and to specify the subdirectory and custom commands.
--root-dir--build-cmd--start-cmd| 方式 | 使用场景 | 执行逻辑 |
|---|---|---|
| 项目包含Dockerfile时 | 使用代码仓库中的Dockerfile进行构建 |
| 无Dockerfile,或偏好自动检测时 | 采用Heroku风格的buildpack自动检测语言并完成构建 |
对于单体仓库(monorepo),可使用、和参数指定子目录与自定义命令。
--root-dir--build-cmd--start-cmdCreate a Project
创建项目
bash
guara projects create --name my-appbash
guara projects create --name my-appCreate a Service
创建服务
bash
undefinedbash
undefinedWith Dockerfile
使用Dockerfile
guara services create --name api --build-method dockerfile --repo https://github.com/user/repo --port 3000
guara services create --name api --build-method dockerfile --repo https://github.com/user/repo --port 3000
With buildpack
使用buildpack
guara services create --name api --build-method buildpack --repo https://github.com/user/repo --port 8080
guara services create --name api --build-method buildpack --repo https://github.com/user/repo --port 8080
Monorepo (buildpack)
单体仓库(使用buildpack)
guara services create --name web --build-method buildpack
--repo https://github.com/user/monorepo
--root-dir ./apps/web
--build-cmd "pnpm --filter web build"
--start-cmd "pnpm --filter web start"
--port 3000
--repo https://github.com/user/monorepo
--root-dir ./apps/web
--build-cmd "pnpm --filter web build"
--start-cmd "pnpm --filter web start"
--port 3000
guara services create --name web --build-method buildpack
--repo https://github.com/user/monorepo
--root-dir ./apps/web
--build-cmd "pnpm --filter web build"
--start-cmd "pnpm --filter web start"
--port 3000
--repo https://github.com/user/monorepo
--root-dir ./apps/web
--build-cmd "pnpm --filter web build"
--start-cmd "pnpm --filter web start"
--port 3000
Interactive (no flags)
交互式创建(无参数)
guara services create
Creating a service does NOT trigger a build. Deploy separately after creation.
**Requires:** GitHub App installed. If not installed, the CLI will prompt with a link.guara services create
创建服务不会触发构建操作,需在创建完成后单独执行部署。
**注意:** 需要已安装GitHub App。若未安装,CLI会提示对应的安装链接。Deploy
部署服务
bash
guara deploy # Deploy default branch
guara deploy --branch develop # Deploy specific branch
guara deploy --commit abc123f # Deploy specific commitThe CLI polls deployment status and shows a spinner. Terminal statuses:
- healthy — deployment succeeded, service is live
- failed — build or deploy error occurred
- rolled_back — deployment was replaced by a rollback
- superseded — a newer deployment replaced this one
bash
guara deploy # 部署默认分支
guara deploy --branch develop # 部署指定分支
guara deploy --commit abc123f # 部署指定提交版本CLI会轮询部署状态并显示加载动画。终端状态说明:
- healthy — 部署成功,服务已上线
- failed — 构建或部署过程中出现错误
- rolled_back — 该部署已被回滚操作替代
- superseded — 该部署已被新版本部署替代
Rollback
回滚操作
bash
guara rollback # Interactive: pick from healthy deployments
guara rollback --deployment <id> # Direct rollback to specific deploymentOnly deployments with status and a valid image are available for rollback.
healthybash
guara rollback # 交互式选择:从健康的部署版本中选择回滚目标
guara rollback --deployment <id> # 直接回滚到指定ID的部署版本仅状态为且包含有效镜像的部署版本可用于回滚。
healthyService Lifecycle
服务生命周期管理
bash
guara services stop # Scale to zero replicas
guara services start # Restore to configured replicas
guara services restart # Rolling restart (zero downtime)
guara services delete # Permanent deletionbash
guara services stop # 将副本数缩容至0
guara services start # 恢复至配置的副本数
guara services restart # 滚动重启(无停机)
guara services delete # 永久删除服务Autoscaling
自动扩容
bash
guara scale --autoscaling on # Enable autoscaling
guara scale --autoscaling off # Disable, use fixed replicasbash
guara scale --autoscaling on # 开启自动扩容
guara scale --autoscaling off # 关闭自动扩容,使用固定副本数Custom Domains
自定义域名
bash
undefinedbash
undefinedAdd domain
添加域名
guara domains add --domain api.myapp.com
guara domains add --domain api.myapp.com
The CLI returns a CNAME target. User must add this DNS record:
CLI会返回一个CNAME目标地址。用户需要添加对应的DNS记录:
api.myapp.com CNAME <cname-target>
api.myapp.com CNAME <cname-target>
Verify status
验证状态
guara domains list
guara domains list
Remove
删除域名
guara domains remove --domain api.myapp.com
Domain status progresses: `pending` → `active` once DNS propagates and verification succeeds.guara domains remove --domain api.myapp.com
域名状态会经历:`pending`(待验证)→ `active`(已生效),该过程需等待DNS解析完成并通过验证。Environment Variables
环境变量配置
bash
guara env set DATABASE_URL=postgres://...
guara env set KEY1=val1 KEY2=val2
guara env list
guara env unset KEYImportant: Setting or unsetting env vars triggers a rolling restart of the service.
To make a variable available during Docker builds (as a build arg):
bash
guara env set NPM_TOKEN=xxx --buildbash
guara env set DATABASE_URL=postgres://...
guara env set KEY1=val1 KEY2=val2
guara env list
guara env unset KEY重要提示: 设置或删除环境变量会触发服务的滚动重启。
若要让变量在Docker构建阶段可用(作为构建参数):
bash
guara env set NPM_TOKEN=xxx --buildDeployment Status Check
部署状态检查
After deploying, verify the service is healthy:
bash
guara services infoCheck deployment history:
bash
guara deployments listFor step-by-step deployment scenarios, see references/workflows.md.
For tier limits and pricing, see guaracloud.com/docs.
部署完成后,可通过以下命令验证服务是否健康:
bash
guara services info查看部署历史:
bash
guara deployments list如需分步部署场景示例,请查看references/workflows.md。
关于套餐限制与定价信息,请访问guaracloud.com/docs。