railway-deployment

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Railway Deployment Management

Railway部署管理

Manage existing Railway deployments: list, view logs, redeploy, or remove.
Important: "Remove deployment" (
railway down
) stops the current deployment but keeps the service. To delete a service entirely, use the railway-environment skill with
isDeleted: true
.
管理现有的Railway部署:列出部署、查看日志、重新部署或移除部署。
重要说明: "移除部署"(
railway down
)会停止当前部署,但保留服务。若要完全删除服务,请使用带有
isDeleted: true
参数的railway-environment技能。

When to Use

使用场景

  • User says "remove deploy", "take down service", "stop deployment", "railway down"
  • User wants to "redeploy", "restart the service", "restart deployment"
  • User asks to "list deployments", "show deployment history", "deployment status"
  • User asks to "see logs", "show logs", "check errors", "debug issues"
  • 用户提及"remove deploy"、"take down service"、"stop deployment"、"railway down"时
  • 用户想要"重新部署"、"重启服务"、"重启部署"时
  • 用户要求"列出部署"、"查看部署历史"、"部署状态"时
  • 用户询问"查看日志"、"显示日志"、"检查错误"、"调试问题"时

List Deployments

列出部署

bash
railway deployment list --limit 10 --json
Shows deployment IDs, statuses, and metadata. Use to find specific deployment IDs for logs or debugging.
bash
railway deployment list --limit 10 --json
显示部署ID、状态和元数据。用于查找特定部署ID以进行日志查看或调试。

Specify Service

指定服务

bash
railway deployment list --service backend --limit 10 --json
bash
railway deployment list --service backend --limit 10 --json

View Logs

查看日志

Deploy Logs

部署日志

bash
railway logs --lines 100 --json
In non-interactive mode, streaming is auto-disabled and CLI fetches logs then exits.
bash
railway logs --lines 100 --json
在非交互模式下,流模式会自动禁用,CLI将获取日志后退出。

Build Logs

构建日志

bash
railway logs --build --lines 100 --json
For debugging build failures or viewing build output.
bash
railway logs --build --lines 100 --json
用于调试构建失败或查看构建输出。

Logs for Failed/In-Progress Deployments

失败/进行中部署的日志

By default
railway logs
shows the last successful deployment. Use
--latest
for current:
bash
railway logs --latest --lines 100 --json
默认情况下,
railway logs
显示最后一次成功的部署日志。使用
--latest
参数查看当前部署的日志:
bash
railway logs --latest --lines 100 --json

Filter Logs

过滤日志

bash
undefined
bash
undefined

Errors only

仅显示错误

railway logs --lines 50 --filter "@level:error" --json
railway logs --lines 50 --filter "@level:error" --json

Text search

文本搜索

railway logs --lines 50 --filter "connection refused" --json
railway logs --lines 50 --filter "connection refused" --json

Combined

组合过滤

railway logs --lines 50 --filter "@level:error AND timeout" --json
undefined
railway logs --lines 50 --filter "@level:error AND timeout" --json
undefined

Time-Based Filtering

基于时间的过滤

bash
undefined
bash
undefined

Logs from last hour

最近1小时的日志

railway logs --since 1h --lines 100 --json
railway logs --since 1h --lines 100 --json

Logs between 30 and 10 minutes ago

30分钟到10分钟前的日志

railway logs --since 30m --until 10m --lines 100 --json
railway logs --since 30m --until 10m --lines 100 --json

Logs from specific timestamp

特定时间戳的日志

railway logs --since 2024-01-15T10:00:00Z --lines 100 --json

Formats: relative (`30s`, `5m`, `2h`, `1d`, `1w`) or ISO 8601 timestamps.
railway logs --since 2024-01-15T10:00:00Z --lines 100 --json

格式支持相对时间(`30s`、`5m`、`2h`、`1d`、`1w`)或ISO 8601时间戳。

Logs from Specific Deployment

特定部署的日志

Deploy logs:
bash
railway logs <deployment-id> --lines 100 --json
Build logs:
bash
railway logs --build <deployment-id> --lines 100 --json
Get deployment ID from
railway deployment list
.
Note: The deployment ID is a positional argument, NOT
--deployment <id>
. The
--deployment
flag is a boolean that selects deploy logs (vs
--build
for build logs).
部署日志:
bash
railway logs <deployment-id> --lines 100 --json
构建日志:
bash
railway logs --build <deployment-id> --lines 100 --json
部署ID可通过
railway deployment list
命令获取。
注意: 部署ID是位置参数,而非
--deployment <id>
形式。
--deployment
是一个布尔标志,用于选择部署日志(与之相对的是
--build
标志用于选择构建日志)。

Redeploy

重新部署

Redeploy the most recent deployment:
bash
railway redeploy --service <name> -y
The
-y
flag skips confirmation. Useful when:
  • Config changed via railway-environment skill
  • Need to restart without new code
  • Previous deploy succeeded but service misbehaving
重新部署最近的部署:
bash
railway redeploy --service <name> -y
-y
标志用于跳过确认。适用于以下场景:
  • 通过railway-environment技能修改了配置
  • 需要在不更新代码的情况下重启服务
  • 之前的部署成功,但服务运行异常

Restart Container Only

仅重启容器

Restart without rebuilding (picks up external resource changes):
bash
railway restart --service <name> -y
Use when external resources (S3 files, config maps) changed but code didn't.
无需重新构建即可重启服务(会获取外部资源的变更):
bash
railway restart --service <name> -y
适用于外部资源(如S3文件、配置映射)发生变更但代码未修改的场景。

Remove Deployment

移除部署

Takes down the current deployment. The service remains but has no running deployment.
bash
undefined
停止当前部署。服务会保留,但没有运行中的部署。
bash
undefined

Remove deployment for linked service

移除关联服务的部署

railway down -y
railway down -y

Remove deployment for specific service

移除特定服务的部署

railway down --service web -y railway down --service api -y

This is what users mean when they say "remove deploy", "take down", or "stop the deployment".

**Note:** This does NOT delete the service. To delete a service entirely, use the railway-environment skill with `isDeleted: true`.
railway down --service web -y railway down --service api -y

这对应用户所说的"remove deploy"、"take down"或"stop the deployment"操作。

**注意:** 此操作不会删除服务。若要完全删除服务,请使用带有`isDeleted: true`参数的railway-environment技能。

CLI Options

CLI选项

deployment list

deployment list

FlagDescription
-s, --service <NAME>
Service name or ID
-e, --environment <NAME>
Environment name or ID
--limit <N>
Max deployments (default 20, max 1000)
--json
JSON output
标志描述
-s, --service <NAME>
服务名称或ID
-e, --environment <NAME>
环境名称或ID
--limit <N>
最大部署数量(默认20,最大1000)
--json
以JSON格式输出

logs

logs

FlagDescription
-s, --service <NAME>
Service name or ID
-e, --environment <NAME>
Environment name or ID
-d, --deployment
Show deploy logs (default, boolean flag)
-b, --build
Show build logs (boolean flag)
-n, --lines <N>
Number of lines (required)
-f, --filter <QUERY>
Filter using query syntax
--since <TIME>
Start time (relative or ISO 8601)
--until <TIME>
End time (relative or ISO 8601)
--latest
Most recent deployment (even if failed)
--json
JSON output
[DEPLOYMENT_ID]
Specific deployment (optional)
标志描述
-s, --service <NAME>
服务名称或ID
-e, --environment <NAME>
环境名称或ID
-d, --deployment
显示部署日志(默认选项,布尔标志)
-b, --build
显示构建日志(布尔标志)
-n, --lines <N>
日志行数(必填)
-f, --filter <QUERY>
使用查询语法过滤日志
--since <TIME>
起始时间(相对时间或ISO 8601格式)
--until <TIME>
结束时间(相对时间或ISO 8601格式)
--latest
显示最近的部署日志(即使部署失败)
--json
以JSON格式输出
[DEPLOYMENT_ID]
特定部署的ID(可选)

redeploy

redeploy

FlagDescription
-s, --service <NAME>
Service name or ID
-y, --yes
Skip confirmation
标志描述
-s, --service <NAME>
服务名称或ID
-y, --yes
跳过确认步骤

restart

restart

FlagDescription
-s, --service <NAME>
Service name or ID
-y, --yes
Skip confirmation
标志描述
-s, --service <NAME>
服务名称或ID
-y, --yes
跳过确认步骤

down

down

FlagDescription
-s, --service <NAME>
Service name or ID
-e, --environment <NAME>
Environment name or ID
-y, --yes
Skip confirmation
标志描述
-s, --service <NAME>
服务名称或ID
-e, --environment <NAME>
环境名称或ID
-y, --yes
跳过确认步骤

Presenting Logs

日志展示建议

When showing logs:
  • Include timestamps
  • Highlight errors and warnings
  • For build failures: show error and suggest fixes
  • For runtime crashes: show stack trace context
  • Summarize patterns (e.g., "15 timeout errors in last 100 logs")
展示日志时:
  • 包含时间戳
  • 高亮显示错误和警告信息
  • 对于构建失败:显示错误信息并给出修复建议
  • 对于运行时崩溃:显示堆栈跟踪上下文
  • 总结日志中的模式(例如:"最近100条日志中出现15次超时错误")

Composability

组合使用

  • Push new code: Use railway-deploy skill
  • Check service status: Use railway-status skill
  • Fix config issues: Use railway-environment skill
  • Create new service: Use railway-new skill
  • 推送新代码:使用railway-deploy技能
  • 检查服务状态:使用railway-status技能
  • 修复配置问题:使用railway-environment技能
  • 创建新服务:使用railway-new技能

Error Handling

错误处理

No Service Linked

未关联服务

No service linked. Run `railway service` to select one.
No service linked. Run `railway service` to select one.

No Deployments Found

未找到部署

No deployments found. Deploy first with `railway up`.
No deployments found. Deploy first with `railway up`.

No Logs Found

未找到日志

Deployment may be too old (log retention limits) or service hasn't produced output.
部署可能过于陈旧(受日志保留限制),或者服务尚未生成任何输出。