railway-deployment by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill railway-deployment管理现有的 Railway 部署:列出、查看日志、重新部署或移除。
重要提示: "移除部署" (railway down) 会停止当前部署但保留服务。要完全删除服务,请使用 railway-environment 技能并设置 isDeleted: true。
railway deployment list --limit 10 --json
显示部署 ID、状态和元数据。用于查找特定部署 ID 以查看日志或调试。
railway deployment list --service backend --limit 10 --json
railway logs --lines 100 --json
在非交互模式下,流式传输会自动禁用,CLI 会获取日志然后退出。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
railway logs --build --lines 100 --json
用于调试构建失败或查看构建输出。
默认情况下 railway logs 显示最后一次成功的部署。使用 --latest 查看当前部署:
railway logs --latest --lines 100 --json
# 仅错误
railway logs --lines 50 --filter "@level:error" --json
# 文本搜索
railway logs --lines 50 --filter "connection refused" --json
# 组合过滤
railway logs --lines 50 --filter "@level:error AND timeout" --json
# 过去一小时的日志
railway logs --since 1h --lines 100 --json
# 30分钟前到10分钟前的日志
railway logs --since 30m --until 10m --lines 100 --json
# 特定时间戳之后的日志
railway logs --since 2024-01-15T10:00:00Z --lines 100 --json
格式:相对时间 (30s, 5m, 2h, 1d, 1w) 或 ISO 8601 时间戳。
部署日志:
railway logs <deployment-id> --lines 100 --json
构建日志:
railway logs --build <deployment-id> --lines 100 --json
从 railway deployment list 获取部署 ID。
注意: 部署 ID 是一个位置参数,而不是 --deployment <id>。--deployment 标志是一个布尔值,用于选择部署日志(相对于 --build 选择构建日志)。
重新部署最近的部署:
railway redeploy --service <name> -y
-y 标志跳过确认。在以下情况下很有用:
重启但不重新构建(会获取外部资源更改):
railway restart --service <name> -y
当外部资源(S3 文件、配置映射)更改但代码未更改时使用。
下线当前部署。服务仍然存在但没有正在运行的部署。
# 移除链接服务的部署
railway down -y
# 移除特定服务的部署
railway down --service web -y
railway down --service api -y
这就是用户说"移除部署"、"下线"或"停止部署"时的意思。
注意: 这不会删除服务。要完全删除服务,请使用 railway-environment 技能并设置 isDeleted: true。
| 标志 | 描述 |
|---|---|
-s, --service <NAME> | 服务名称或 ID |
-e, --environment <NAME> | 环境名称或 ID |
--limit <N> | 最大部署数(默认 20,最大 1000) |
--json | JSON 输出 |
| 标志 | 描述 |
|---|---|
-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] | 特定部署(可选) |
| 标志 | 描述 |
|---|---|
-s, --service <NAME> | 服务名称或 ID |
-y, --yes | 跳过确认 |
| 标志 | 描述 |
|---|---|
-s, --service <NAME> | 服务名称或 ID |
-y, --yes | 跳过确认 |
| 标志 | 描述 |
|---|---|
-s, --service <NAME> | 服务名称或 ID |
-e, --environment <NAME> | 环境名称或 ID |
-y, --yes | 跳过确认 |
展示日志时:
No service linked. Run `railway service` to select one.
No deployments found. Deploy first with `railway up`.
部署可能太旧(日志保留限制)或服务未产生输出。
每周安装数
152
仓库
GitHub 星标数
22.6K
首次出现
2026年1月21日
安全审计
安装于
claude-code125
opencode120
gemini-cli114
cursor111
codex101
antigravity99
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 deployment list --limit 10 --json
Shows deployment IDs, statuses, and metadata. Use to find specific deployment IDs for logs or debugging.
railway deployment list --service backend --limit 10 --json
railway logs --lines 100 --json
In non-interactive mode, streaming is auto-disabled and CLI fetches logs then exits.
railway logs --build --lines 100 --json
For debugging build failures or viewing build output.
By default railway logs shows the last successful deployment. Use --latest for current:
railway logs --latest --lines 100 --json
# Errors only
railway logs --lines 50 --filter "@level:error" --json
# Text search
railway logs --lines 50 --filter "connection refused" --json
# Combined
railway logs --lines 50 --filter "@level:error AND timeout" --json
# Logs from last hour
railway logs --since 1h --lines 100 --json
# Logs between 30 and 10 minutes ago
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.
Deploy logs:
railway logs <deployment-id> --lines 100 --json
Build logs:
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).
Redeploy the most recent deployment:
railway redeploy --service <name> -y
The -y flag skips confirmation. Useful when:
Restart without rebuilding (picks up external resource changes):
railway restart --service <name> -y
Use when external resources (S3 files, config maps) changed but code didn't.
Takes down the current deployment. The service remains but has no running deployment.
# Remove deployment for linked service
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.
| Flag | Description |
|---|---|
-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 |
| Flag | Description |
|---|---|
-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> |
| Flag | Description |
|---|---|
-s, --service <NAME> | Service name or ID |
-y, --yes | Skip confirmation |
| Flag | Description |
|---|---|
-s, --service <NAME> | Service name or ID |
-y, --yes | Skip confirmation |
| Flag | Description |
|---|---|
-s, --service <NAME> | Service name or ID |
-e, --environment <NAME> | Environment name or ID |
-y, --yes | Skip confirmation |
When showing logs:
No service linked. Run `railway service` to select one.
No deployments found. Deploy first with `railway up`.
Deployment may be too old (log retention limits) or service hasn't produced output.
Weekly Installs
152
Repository
GitHub Stars
22.6K
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
claude-code125
opencode120
gemini-cli114
cursor111
codex101
antigravity99
| 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) |