guara-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
With 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
With 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)
Monorepo (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)
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 # Deploy default branch
guara deploy --branch develop # Deploy specific branch
guara deploy --commit abc123f # Deploy specific commitCLI会轮询部署状态并显示加载动画。终端状态说明:
- 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 # Interactive: pick from healthy deployments
guara rollback --deployment <id> # Direct rollback to specific deployment仅状态为且镜像有效的部署可用于回滚。
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 # Scale to zero replicas
guara services start # Restore to configured replicas
guara services restart # Rolling restart (zero downtime)
guara services delete # Permanent deletionAutoscaling
Autoscaling
bash
guara scale --autoscaling on # Enable autoscaling
guara scale --autoscaling off # Disable, use fixed replicasbash
guara scale --autoscaling on # Enable autoscaling
guara scale --autoscaling off # Disable, use fixed replicasCustom Domains
自定义域名
bash
undefinedbash
undefinedAdd domain
Add 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:
The CLI returns a CNAME target. User must add this DNS record:
api.myapp.com CNAME <cname-target>
api.myapp.com CNAME <cname-target>
Verify status
Verify status
guara domains list
guara domains list
Remove
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。