deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeploy
部署
Deploy code from the current directory to Railway using .
railway up使用将当前目录的代码部署到Railway。
railway upWhen to Use
使用场景
- User asks to "deploy", "ship", "push code"
- User says "railway up" or "deploy to Railway"
- User wants to deploy local code changes
- User says "deploy and fix any issues" (use --ci mode)
- 用户说出“deploy”、“ship”、“push code”
- 用户说出“railway up”或“deploy to Railway”
- 用户想要部署本地代码变更
- 用户说出“deploy and fix any issues”(使用--ci模式)
Commit Message
提交信息
Always use the flag with a descriptive commit message summarizing what's being deployed:
-mbash
railway up --detach -m "Add user authentication endpoint"Good commit messages:
- Describe what changed: "Fix memory leak in worker process"
- Reference tickets/issues: "Implement feature #123"
- Be concise but meaningful: "Update deps and fix build warnings"
请始终使用标志,并附上描述部署内容的提交信息:
-mbash
railway up --detach -m "Add user authentication endpoint"优质提交信息示例:
- 描述变更内容:“Fix memory leak in worker process”
- 关联工单/问题:“Implement feature #123”
- 简洁且有意义:“Update deps and fix build warnings”
Modes
模式
Detach Mode (default)
分离模式(默认)
Starts deploy and returns immediately. Use for most deploys.
bash
railway up --detach -m "Deploy description here"启动部署后立即返回。适用于大多数部署场景。
bash
railway up --detach -m "Deploy description here"CI Mode
CI模式
Streams build logs until complete. Use when user wants to watch the build or needs to debug issues.
bash
railway up --ci -m "Deploy description here"When to use CI mode:
- User says "deploy and watch", "deploy and fix issues"
- User is debugging build failures
- User wants to see build output
流式传输构建日志直至完成。当用户想要查看构建过程或需要调试问题时使用。
bash
railway up --ci -m "Deploy description here"何时使用CI模式:
- 用户说出“deploy and watch”、“deploy and fix issues”
- 用户正在调试构建失败问题
- 用户想要查看构建输出
Deploy Specific Service
部署到指定服务
Default is linked service. To deploy to a different service:
bash
railway up --detach --service backend -m "Deploy description here"默认部署到已关联的服务。要部署到其他服务:
bash
railway up --detach --service backend -m "Deploy description here"Deploy to Unlinked Project
部署到未关联的项目
Deploy to a project without linking first:
bash
railway up --project <project-id> --environment production --detach -m "Deploy description here"Requires both and flags.
--project--environment无需预先关联即可部署到某个项目:
bash
railway up --project <project-id> --environment production --detach -m "Deploy description here"需要同时使用和标志。
--project--environmentCLI Options
CLI选项
| Flag | Description |
|---|---|
| Commit message describing the deploy (always use this) |
| Don't attach to logs (default) |
| Stream build logs, exit when done |
| Target service (defaults to linked) |
| Target environment (defaults to linked) |
| Target project (requires --environment) |
| Path to deploy (defaults to current directory) |
| 标志 | 描述 |
|---|---|
| 描述部署内容的提交信息(请始终使用此标志) |
| 不附加到日志(默认设置) |
| 流式传输构建日志,完成后退出 |
| 目标服务(默认为已关联的服务) |
| 目标环境(默认为已关联的环境) |
| 目标项目(需要搭配--environment使用) |
| 要部署的路径(默认为当前目录) |
Directory Linking
目录关联
Railway CLI walks UP the directory tree to find a linked project. If you're in a subdirectory of a linked project, you don't need to relink.
For subdirectory deployments, prefer setting via the environment skill, then deploy normally with .
rootDirectoryrailway upRailway CLI会向上遍历目录树以查找已关联的项目。如果您处于已关联项目的子目录中,则无需重新关联。
对于子目录部署,建议通过environment技能设置,然后使用正常部署。
rootDirectoryrailway upAfter Deploy
部署后
Detach mode
分离模式
Deploying to <service>...Use skill to check build status (with flag).
deployment--linesDeploying to <service>...使用技能检查构建状态(使用标志)。
deployment--linesCI mode
CI模式
Build logs stream inline. If build fails, the error will be in the output.
Do NOT run after CI mode - the logs already streamed. If you need
more context, use skill with flag (never stream).
railway logs --builddeployment--lines构建日志会实时流式传输。如果构建失败,错误信息会显示在输出中。
CI模式部署后请勿运行——日志已经流式传输完毕。如果需要更多上下文,请使用带标志的技能(切勿流式传输)。
railway logs --build--linesdeploymentComposability
组合使用
- Check status after deploy: Use skill
service - View logs: Use skill
deployment - Fix config issues: Use skill
environment - Redeploy after config fix: Use skill
environment
- 部署后检查状态:使用技能
service - 查看日志:使用技能
deployment - 修复配置问题:使用技能
environment - 配置修复后重新部署:使用技能
environment
Error Handling
错误处理
No Project Linked
未关联项目
No Railway project linked. Run `railway link` first.No Railway project linked. Run `railway link` first.No Service Linked
未关联服务
No service linked. Use --service flag or run `railway service` to select one.No service linked. Use --service flag or run `railway service` to select one.Build Failure (CI mode)
构建失败(CI模式)
The build logs already streamed - analyze them directly from the output.
Do NOT run after CI mode (it streams forever without ).
railway up --cirailway logs--linesCommon issues:
- Missing dependencies → check package.json/requirements.txt
- Build command wrong → use environment skill to fix
- Dockerfile issues → check dockerfile path
构建日志已实时流式传输——直接从的输出中分析错误。CI模式部署后请勿运行(如果不使用标志,它会无限流式传输)。
railway up --cirailway logs--lines常见问题:
- 缺少依赖项 → 检查package.json/requirements.txt
- 构建命令错误 → 使用environment技能修复
- Dockerfile问题 → 检查Dockerfile路径