deploy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Deploy

部署

Deploy code from the current directory to Railway using
railway up
.
使用
railway up
将当前目录的代码部署到Railway。

When 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
-m
flag with a descriptive commit message summarizing what's being deployed:
bash
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"
请始终使用
-m
标志,并附上描述部署内容的提交信息:
bash
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
--project
and
--environment
flags.
无需预先关联即可部署到某个项目:
bash
railway up --project <project-id> --environment production --detach -m "Deploy description here"
需要同时使用
--project
--environment
标志。

CLI Options

CLI选项

FlagDescription
-m, --message <MSG>
Commit message describing the deploy (always use this)
-d, --detach
Don't attach to logs (default)
-c, --ci
Stream build logs, exit when done
-s, --service <NAME>
Target service (defaults to linked)
-e, --environment <NAME>
Target environment (defaults to linked)
-p, --project <ID>
Target project (requires --environment)
[PATH]
Path to deploy (defaults to current directory)
标志描述
-m, --message <MSG>
描述部署内容的提交信息(请始终使用此标志)
-d, --detach
不附加到日志(默认设置)
-c, --ci
流式传输构建日志,完成后退出
-s, --service <NAME>
目标服务(默认为已关联的服务)
-e, --environment <NAME>
目标环境(默认为已关联的环境)
-p, --project <ID>
目标项目(需要搭配--environment使用)
[PATH]
要部署的路径(默认为当前目录)

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
rootDirectory
via the environment skill, then deploy normally with
railway up
.
Railway CLI会向上遍历目录树以查找已关联的项目。如果您处于已关联项目的子目录中,则无需重新关联。
对于子目录部署,建议通过environment技能设置
rootDirectory
,然后使用
railway up
正常部署。

After Deploy

部署后

Detach mode

分离模式

Deploying to <service>...
Use
deployment
skill to check build status (with
--lines
flag).
Deploying to <service>...
使用
deployment
技能检查构建状态(使用
--lines
标志)。

CI mode

CI模式

Build logs stream inline. If build fails, the error will be in the output.
Do NOT run
railway logs --build
after CI mode
- the logs already streamed. If you need more context, use
deployment
skill with
--lines
flag (never stream).
构建日志会实时流式传输。如果构建失败,错误信息会显示在输出中。
CI模式部署后请勿运行
railway logs --build
——日志已经流式传输完毕。如果需要更多上下文,请使用带
--lines
标志的
deployment
技能(切勿流式传输)。

Composability

组合使用

  • Check status after deploy: Use
    service
    skill
  • View logs: Use
    deployment
    skill
  • Fix config issues: Use
    environment
    skill
  • Redeploy after config fix: Use
    environment
    skill
  • 部署后检查状态:使用
    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
railway up --ci
output. Do NOT run
railway logs
after CI mode (it streams forever without
--lines
).
Common issues:
  • Missing dependencies → check package.json/requirements.txt
  • Build command wrong → use environment skill to fix
  • Dockerfile issues → check dockerfile path
构建日志已实时流式传输——直接从
railway up --ci
的输出中分析错误。CI模式部署后请勿运行
railway logs
(如果不使用
--lines
标志,它会无限流式传输)。
常见问题:
  • 缺少依赖项 → 检查package.json/requirements.txt
  • 构建命令错误 → 使用environment技能修复
  • Dockerfile问题 → 检查Dockerfile路径