npx skills add https://github.com/railwayapp/railway-skills --skill service检查状态、更新属性以及高级服务创建。
注意: 对于使用本地代码创建服务(常见情况),建议使用 new 技能,它同时处理项目设置、脚手架搭建和服务创建。
对于 GitHub 仓库源: 使用 new 技能创建空服务,然后使用 environment 技能通过暂存变更 API 配置 source.repo。
通过 GraphQL API 创建新服务。没有对应的 CLI 命令。
railway status --json
提取:
project.id - 用于创建服务environment.id - 用于暂存实例配置广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
mutation serviceCreate($input: ServiceCreateInput!) {
serviceCreate(input: $input) {
id
name
}
}
| 字段 | 类型 | 描述 |
|---|---|---|
projectId | String! | 项目 ID(必需) |
name | String | 服务名称(如果省略则自动生成) |
source.image | String | Docker 镜像(例如,nginx:latest) |
source.repo | String | GitHub 仓库(例如,user/repo) |
branch | String | 仓库源的 Git 分支 |
environmentId | String | 如果设置且是分叉环境,则仅在该环境中创建 |
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation createService($input: ServiceCreateInput!) {
serviceCreate(input: $input) { id name }
}' \
'{"input": {"projectId": "PROJECT_ID"}}'
SCRIPT
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation createService($input: ServiceCreateInput!) {
serviceCreate(input: $input) { id name }
}' \
'{"input": {"projectId": "PROJECT_ID", "name": "my-service", "source": {"image": "nginx:latest"}}}'
SCRIPT
请勿使用带有 source.repo 的 serviceCreate - 应改用暂存变更 API。
流程:
serviceCreate(input: {projectId: "...", name: "my-service"})environment 技能通过暂存变更 API 配置源使用 environment 技能配置服务实例:
{
"services": {
"<serviceId>": {
"isCreated": true,
"source": { "image": "nginx:latest" },
"variables": {
"PORT": { "value": "8080" }
}
}
}
}
关键: 对于新的服务实例,务必包含 isCreated: true。
然后使用 environment 技能来应用和部署。
关于变量引用,请参阅 reference/variables.md。
railway service status --json
返回链接服务的当前部署状态。
railway deployment list --json --limit 5
显示:
| 状态 | 含义 |
|---|---|
| SUCCESS | 已部署并正在运行 |
| FAILED | 构建或部署失败 |
| DEPLOYING | 正在部署 |
| BUILDING | 构建进行中 |
| CRASHED | 运行时崩溃 |
| REMOVED | 部署已移除 |
通过 GraphQL API 更新服务名称或图标。
railway status --json
从响应中提取 service.id。
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation updateService($id: String!, $input: ServiceUpdateInput!) {
serviceUpdate(id: $id, input: $input) { id name }
}' \
'{"id": "SERVICE_ID", "input": {"name": "new-name"}}'
SCRIPT
图标可以是图片 URL 或动画 GIF。
| 类型 | 示例 |
|---|---|
| 图片 URL | "icon": "https://example.com/logo.png" |
| 动画 GIF | "icon": "https://example.com/animated.gif" |
| Devicons | "icon": "https://devicons.railway.app/github" |
Railway Devicons: 查询 https://devicons.railway.app/{query} 获取常见的开发者图标(例如,github、postgres、redis、nodejs)。在 https://devicons.railway.app 浏览全部图标。
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation updateService($id: String!, $input: ServiceUpdateInput!) {
serviceUpdate(id: $id, input: $input) { id icon }
}' \
'{"id": "SERVICE_ID", "input": {"icon": "https://devicons.railway.app/github"}}'
SCRIPT
| 字段 | 类型 | 描述 |
|---|---|---|
name | String | 服务名称 |
icon | String | 表情符号或图片 URL(包括动画 GIF) |
切换当前目录链接的服务:
railway service link
或直接指定:
railway service link <service-name>
new 技能(处理脚手架搭建 + 创建)environment 技能(变量、命令、镜像等)environment 技能并设置 isDeleted: trueenvironment 技能deployment 技能deploy 技能No service linked. Run `railway service link` to link a service.
Service exists but has no deployments yet. Deploy with `railway up`.
Service "foo" not found. Check available services with `railway status`.
用户可能未在链接的项目中。检查 railway status。
用户至少需要 DEVELOPER 角色才能创建服务。
Docker 镜像必须可访问(公开或具有注册表凭据)。
每周安装量
1.6K
仓库
GitHub 星标
214
首次出现
2026年1月20日
安全审计
安装于
opencode1.4K
codex1.4K
gemini-cli1.4K
github-copilot1.4K
amp1.3K
kimi-cli1.3K
Check status, update properties, and advanced service creation.
Note: For creating services with local code (the common case), prefer the new skill which handles project setup, scaffolding, and service creation together.
For GitHub repo sources: Use new skill to create empty service, then environment skill to configure source.repo via staged changes API.
Create a new service via GraphQL API. There is no CLI command for this.
railway status --json
Extract:
project.id - for creating the serviceenvironment.id - for staging the instance configmutation serviceCreate($input: ServiceCreateInput!) {
serviceCreate(input: $input) {
id
name
}
}
| Field | Type | Description |
|---|---|---|
projectId | String! | Project ID (required) |
name | String | Service name (auto-generated if omitted) |
source.image | String | Docker image (e.g., nginx:latest) |
source.repo | String | GitHub repo (e.g., user/repo) |
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation createService($input: ServiceCreateInput!) {
serviceCreate(input: $input) { id name }
}' \
'{"input": {"projectId": "PROJECT_ID"}}'
SCRIPT
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation createService($input: ServiceCreateInput!) {
serviceCreate(input: $input) { id name }
}' \
'{"input": {"projectId": "PROJECT_ID", "name": "my-service", "source": {"image": "nginx:latest"}}}'
SCRIPT
Do NOT use serviceCreate with source.repo - use staged changes API instead.
Flow:
serviceCreate(input: {projectId: "...", name: "my-service"})environment skill to configure source via staged changes APIUse environment skill to configure the service instance:
{
"services": {
"<serviceId>": {
"isCreated": true,
"source": { "image": "nginx:latest" },
"variables": {
"PORT": { "value": "8080" }
}
}
}
}
Critical: Always include isCreated: true for new service instances.
Then use environment skill to apply and deploy.
For variable references, see reference/variables.md.
railway service status --json
Returns current deployment status for the linked service.
railway deployment list --json --limit 5
Show:
| Status | Meaning |
|---|---|
| SUCCESS | Deployed and running |
| FAILED | Build or deploy failed |
| DEPLOYING | Currently deploying |
| BUILDING | Build in progress |
| CRASHED | Runtime crash |
| REMOVED | Deployment removed |
Update service name or icon via GraphQL API.
railway status --json
Extract service.id from the response.
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation updateService($id: String!, $input: ServiceUpdateInput!) {
serviceUpdate(id: $id, input: $input) { id name }
}' \
'{"id": "SERVICE_ID", "input": {"name": "new-name"}}'
SCRIPT
Icons can be image URLs or animated GIFs.
| Type | Example |
|---|---|
| Image URL | "icon": "https://example.com/logo.png" |
| Animated GIF | "icon": "https://example.com/animated.gif" |
| Devicons | "icon": "https://devicons.railway.app/github" |
Railway Devicons: Query https://devicons.railway.app/{query} for common developer icons (e.g., github, postgres, redis, nodejs). Browse all at https://devicons.railway.app
bash <<'SCRIPT'
scripts/railway-api.sh \
'mutation updateService($id: String!, $input: ServiceUpdateInput!) {
serviceUpdate(id: $id, input: $input) { id icon }
}' \
'{"id": "SERVICE_ID", "input": {"icon": "https://devicons.railway.app/github"}}'
SCRIPT
| Field | Type | Description |
|---|---|---|
name | String | Service name |
icon | String | Emoji or image URL (including animated GIFs) |
Switch the linked service for the current directory:
railway service link
Or specify directly:
railway service link <service-name>
new skill (handles scaffolding + creation)environment skill (variables, commands, image, etc.)environment skill with isDeleted: trueenvironment skilldeployment skilldeploy skillNo service linked. Run `railway service link` to link a service.
Service exists but has no deployments yet. Deploy with `railway up`.
Service "foo" not found. Check available services with `railway status`.
User may not be in a linked project. Check railway status.
User needs at least DEVELOPER role to create services.
Docker image must be accessible (public or with registry credentials).
Weekly Installs
1.6K
Repository
GitHub Stars
214
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
opencode1.4K
codex1.4K
gemini-cli1.4K
github-copilot1.4K
amp1.3K
kimi-cli1.3K
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
102,600 周安装
branch | String | Git branch for repo source |
environmentId | String | If set and is a fork, only creates in that env |