deploying-laravel-cloud
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeploying with Laravel Cloud CLI
使用Laravel Cloud CLI进行部署
Setup
安装设置
sh
composer global require laravel/cloud-cli
cloud auth -nsh
composer global require laravel/cloud-cli
cloud auth -nCommands
命令说明
Commands follow a CRUD pattern: , , , , .
resource:listresource:getresource:createresource:updateresource:deleteAvailable resources: , , , , , , , , , , , .
applicationenvironmentinstancedatabase-clusterdatabasecachebucketdomainwebsocket-clusterbackground-processcommanddeploymentSome resources have additional commands (e.g., , , , ). Discover these via .
domain:verifydatabase:openinstance:sizescache:typescloud -hNever hardcode command signatures. Always run to discover options at runtime.
cloud <command> -h命令遵循CRUD模式:、、、、。
resource:listresource:getresource:createresource:updateresource:delete可用资源类型:、、、、、、、、、、、。
applicationenvironmentinstancedatabase-clusterdatabasecachebucketdomainwebsocket-clusterbackground-processcommanddeployment部分资源拥有额外命令(例如、、、)。可通过查看这些命令。
domain:verifydatabase:openinstance:sizescache:typescloud -h切勿硬编码命令签名。始终在运行时通过查看可用选项。
cloud <command> -hCLI Flags
CLI参数规则
Always add to every command — prevents the CLI from hanging.
Never use or — they suppress all output.
-n-q--silentFlag combos per operation:
- Read (,
:list) →:get--json -n - Create () →
:create--json -n - Update () →
:update--json -n --force - Delete () →
:delete(no-n --force)--json - Environment variables →
-n --force - Deploy/ship → with all options passed explicitly (no
-n)--json
所有命令都要添加参数——避免CLI挂起。
切勿使用或参数——它们会屏蔽所有输出。
-n-q--silent不同操作对应的参数组合:
- 读取操作(、
:list)→:get--json -n - 创建操作()→
:create--json -n - 更新操作()→
:update--json -n --force - 删除操作()→
:delete(不使用-n --force)--json - 环境变量操作 →
-n --force - 部署/发布操作 → 并显式传入所有选项(不使用
-n)--json
Deployment Workflow
部署工作流
Determine the task and follow the matching path:
First deploy? → (discover options via )
cloud ship -ncloud ship -hExisting app? →
sh
cloud repo:config
cloud deploy {app_name} {environment} -n --open
cloud deploy:monitor -nEnvironment variables? →
cloud environment:variables -n --forceProvision infrastructure? →
cloud <resource>:create --json -nCustom domain? → then
cloud domain:create --json -ncloud domain:verify -nFor multi-step operations, see reference/checklists.md.
Not sure what the user needs? → ask them before running anything.
确定任务类型并遵循对应流程:
首次部署?→ 执行(通过查看可用选项)
cloud ship -ncloud ship -h已有应用?→
sh
cloud repo:config
cloud deploy {app_name} {environment} -n --open
cloud deploy:monitor -n配置环境变量?→ 执行
cloud environment:variables -n --force配置基础设施?→ 执行
cloud <resource>:create --json -n自定义域名?→ 先执行,再执行
cloud domain:create --json -ncloud domain:verify -n如需执行多步骤操作,请查看reference/checklists.md。
不确定用户需求?→ 在执行任何命令前先询问用户。
When a Command Fails
命令失败处理
- Read the error output
- Check resource status with or
:list --json -n:get --json -n - Auth error? →
cloud auth -n - Fix the issue, re-run the command
- If the same error repeats after one fix, stop and ask the user
Always run after every deploy. If it fails, show the user what went wrong before attempting a fix.
cloud deploy:monitor -n- 读取错误输出
- 使用或
:list --json -n检查资源状态:get --json -n - 认证错误?→ 执行
cloud auth -n - 修复问题后重新运行命令
- 修复一次后仍出现相同错误,请停止操作并询问用户
每次部署后务必执行。如果该命令失败,请先向用户展示错误信息,再尝试修复。
cloud deploy:monitor -nSubagent Delegation
子代理任务委托
Delegate high-output operations to subagents (using the Task tool) to keep the main context window small. Only the summary comes back — verbose output stays in the subagent's context.
Delegate these to a subagent:
- — deployment logs can be very long
cloud deploy:monitor -n - — full deployment details
cloud deployment:get --json -n - — listing many resources produces large JSON
cloud <resource>:list --json -n - Fetching docs from https://cloud.laravel.com/docs/llms.txt via
WebFetch
Keep in the main context:
- Short commands like ,
:create,:delete— output is small:update - — you need the deployment ID immediately
cloud deploy -n - Any command where you need the result for the next step right away
将高输出量的操作委托给子代理(使用任务工具),以保持主上下文窗口简洁。仅返回摘要信息——详细输出保留在子代理的上下文中。
以下操作可委托给子代理:
- ——部署日志可能非常长
cloud deploy:monitor -n - ——完整的部署详情
cloud deployment:get --json -n - ——列出大量资源会生成大体积JSON
cloud <resource>:list --json -n - 通过从https://cloud.laravel.com/docs/llms.txt获取文档
WebFetch
以下操作需保留在主上下文:
- 短命令如、
:create、:delete——输出内容较少:update - ——需要立即获取部署ID
cloud deploy -n - 任何需要立即使用结果执行下一步的命令
Rules
规则要求
Follow exact steps:
- Flag selection — always use the documented combos above
- Deploy sequence — deploy then monitor, never skip monitoring
- Destructive commands — always confirm with user first, show the command and wait for approval
- Error loop — diagnose, fix once, ask user if it fails again
Use your judgment:
- Instance sizes, regions, cluster types — ask the user if not specified
- Which resources to provision — based on what the user describes
- Order of provisioning — no strict sequence required
- How to present output — summarize, show raw, or extract fields based on context
严格遵循以下步骤:
- 参数选择——始终使用上述文档中指定的参数组合
- 部署顺序——先部署再监控,切勿跳过监控步骤
- 破坏性命令——始终先与用户确认,展示命令并等待用户批准
- 错误循环——诊断问题,修复一次,若再次失败则询问用户
可灵活判断的场景:
- 实例规格、区域、集群类型——若未指定则询问用户
- 需要配置哪些资源——根据用户描述判断
- 配置顺序——无严格要求
- 输出展示方式——根据上下文选择摘要展示、原始输出或提取特定字段
Remote Access
远程访问
Tinker (> v0.2.0)
Tinker(版本> v0.2.0)
Run PHP code directly in a Cloud environment:
sh
cloud tinker {environment} --code='Your PHP code here' --timeout=60 -n- — PHP code to execute (required in non-interactive mode)
--code - — max seconds to wait for output (default: 60)
--timeout
The code must explicitly output results using , , or similar — expressions alone produce no output.
echodumpAlways pass and to avoid interactive prompts.
--code-n直接在云环境中运行PHP代码:
sh
cloud tinker {environment} --code='Your PHP code here' --timeout=60 -n- ——要执行的PHP代码(非交互模式下必填)
--code - ——等待输出的最长秒数(默认:60)
--timeout
代码必须使用、等方式显式输出结果——仅表达式不会产生输出。
echodump始终传入和参数以避免交互式提示。
--code-nRemote Commands
远程命令
Run shell commands on a Cloud environment:
sh
cloud command:run {environment} --cmd='your command here' -n- — the command to run (required in non-interactive mode)
--cmd - — skip real-time output streaming
--no-monitor - — copy output to clipboard
--copy-output
Review past commands:
- — list command history
cloud command:list {environment} --json -n - — get details and output of a specific command
cloud command:get {commandId} --json -n
Delegate to a subagent when output may be long.
command:run在云环境中运行Shell命令:
sh
cloud command:run {environment} --cmd='your command here' -n- ——要运行的命令(非交互模式下必填)
--cmd - ——跳过实时输出流
--no-monitor - ——将输出复制到剪贴板
--copy-output
查看历史命令:
- ——列出命令历史
cloud command:list {environment} --json -n - ——获取特定命令的详情和输出
cloud command:get {commandId} --json -n
当命令输出可能较长时,将委托给子代理。
command:runConfig
配置文件
- Global: — auth tokens and preferences
~/.config/cloud/config.json - Repo-local: — app and environment defaults (set by
.cloud/config.json)cloud repo:config - CLI arguments override both
- 全局配置:——认证令牌和偏好设置
~/.config/cloud/config.json - 仓库本地配置:——应用和环境默认值(通过
.cloud/config.json设置)cloud repo:config - CLI参数会覆盖上述两种配置
Documentation
文档参考
Laravel Cloud Docs: https://cloud.laravel.com/docs/llms.txt
When the user asks how something works or needs an explanation of a Laravel Cloud feature, fetch the docs from the URL above using and use it to provide accurate answers.
WebFetchLaravel Cloud文档:https://cloud.laravel.com/docs/llms.txt
当用户询问功能工作原理或需要Laravel Cloud功能说明时,使用从上述URL获取文档,并据此提供准确解答。
WebFetchWhen Stuck
遇到问题时
- Fetch https://cloud.laravel.com/docs/llms.txt for official documentation
- Run for any command's options
cloud <command> -h - Run to discover commands
cloud -h
- 从https://cloud.laravel.com/docs/llms.txt获取官方文档
- 执行查看任意命令的选项
cloud <command> -h - 执行查看所有可用命令
cloud -h