옵션
집 Skill DevOps 및 CI/CD Railway CLI Management

Railway CLI Management

CaptainCrouton89/.claude CaptainCrouton89/.claude

서비스를 배포하고 관리하며, 로그를 확인하고 철도 인프라를 구성합니다. 철도 환경에 서비스를 배포하거나, 환경 변수를 관리하거나, 배포 로그를 확인하거나, 서비스의 규모를 조정하거나, 볼륨을 관리할 때 사용합니다.

...모든 것을 확장하십시오
67
업데이트 된 시간 2026년 7월 2일

Railway CLI 관리에 대하여

Railway CLI 관리 기능은 개발자와 운영 팀에게 Railway 플랫폼에서 서비스를 효율적으로 관리하고 배포할 수 있는 일련의 명령어를 제공합니다. 이 기능을 사용하면 명령줄을 통해 서비스 배포, 환경 변수 관리, 서비스 스케일링, 로그 확인 등의 작업을 간편하게 수행할 수 있습니다. Railway CLI를 사용하면 배포 프로세스를 자동화하고 속도를 높여서 여러 서비스와 환경을 보다 쉽게 관리할 수 있습니다. 단일 서비스를 관리하는 경우이든 복잡하게 연결된 서비스들을 관리하는 경우이든, Railway CLI는 원활한 운영을 보장하기 위한 강력한 도구 세트를 제공합니다.

자주 묻는 질문

Railway CLI를 사용하여 어떻게 서비스를 배포하나요?

현재 디렉터리를 배포하려면 railway up 명령어를 사용하세요. 로그를 함께 배포하지 않으려면 railway up --detach를 사용하거나, --service--environment 플래그를 사용하여 특정 서비스나 환경을 지정할 수 있습니다.

Railway CLI를 사용하여 서비스의 규모를 조정할 수 있나요?

네, railway scale 명령어를 사용하면 서비스의 규모를 조정할 수 있습니다. 예를 들어, railway scale --us-west1 3을 사용하면 미국 서부 지역에 서비스 인스턴스를 3개로 스케일링합니다.

제 서비스의 로그를 어떻게 확인할 수 있나요?

최근에 배포된 서비스의 로그를 확인하려면 railway logs 명령어를 사용하세요. 특정 서비스나 환경을 지정하려면 --service 또는 --environment 플래그를 사용하세요. 보다 상세한 로그 정보를 원한다면 배포별로 또는 빌드별로 필터링할 수도 있습니다.

Railway CLI를 사용하여 환경 변수를 관리할 수 있나요?

네, railway variables 명령어를 사용하면 환경 변수를 조회, 설정, 관리할 수 있습니다. 특정 서비스나 환경의 변수를 조회하거나, JSON 또는 키=값 형식으로 출력할 수도 있습니다.

여러 개의 환경을 관리하는 방법이 있나요?

네, railway environment 명령어를 사용하여 환경을 생성, 연결, 삭제할 수 있습니다. 예를 들어, railway environment new를 사용하면 새로운 환경을 생성하고, railway environment delete를 사용하면 지정된 환경을 삭제할 수 있습니다.

GitHub에서 보기

Railway CLI Management

Master Railway CLI for deployments, service management, log viewing, and infrastructure operations.

Quick Reference

Deployment

# Deploy current directory to linked servicerailway up# Deploy without attaching to logsrailway up --detach# Deploy to specific servicerailway up --service api# Deploy to specific environmentrailway up --environment production# Redeploy latest deploymentrailway redeploy# Redeploy specific servicerailway redeploy --service worker# Skip confirmationrailway redeploy --yes# Remove most recent deploymentrailway down# Remove deployment from specific servicerailway down --service api

Service & Project Management

# List all projectsrailway list# Link to existing project (interactive)railway link# Link to specific project by IDrailway link <project-id># Show current project statusrailway status# Get status as JSON (includes deployment IDs!)railway status --json# Open project dashboard in browserrailway open# Unlink current directory from projectrailway unlink# Link to specific servicerailway service <service-name-or-id># Add new service to projectrailway add

Getting Deployment IDs

Best Method:

# Get full project status including deployment IDsrailway status --json# Extract specific deployment ID using jqrailway status --json | jq -r '.services.edges[0].node.serviceInstances.edges[0].node.latestDeployment.id'# Get deployment ID for specific servicerailway status --json | jq -r '.services.edges[] | select(.node.name=="api") | .node.serviceInstances.edges[0].node.latestDeployment.id'

Output Structure:

  • .services.edges[].node - Service info
  • .node.serviceInstances.edges[].node.latestDeployment.id - Latest deployment UUID
  • .node.serviceInstances.edges[].node.latestDeployment.meta - Commit info, build config, etc.

Logs

View Logs

# Stream logs for latest deploymentrailway logs# View logs for specific servicerailway logs --service api# View logs for specific environmentrailway logs --environment production# View deployment logs (startup/runtime)railway logs --deployment# View build logsrailway logs --build# View logs for specific deployment by IDrailway logs <deployment-id># Get logs for specific service deploymentrailway logs --service worker --deployment# Output as JSONrailway logs --json# Combine optionsrailway logs --service api --deployment --json

Logs Tips:

  • Default: Shows latest deployment logs
  • Deployment logs: Application startup and runtime output
  • Build logs: Compilation, dependencies, Nixpacks output
  • Use --json with jq for filtering

Environment Variables

# List all variables for active environmentrailway variables# List for specific servicerailway variables --service api# List for specific environmentrailway variables --environment production# Show as key=value formatrailway variables --kv# Output as JSONrailway variables --json# Set variable(s)railway variables --set "DATABASE_URL=postgres://..."# Set multiplerailway variables --set "NODE_ENV=production" --set "LOG_LEVEL=debug"# Run local command with Railway variablesrailway run npm start# Open subshell with Railway variables loadedrailway shell

Environments

# Link to environment (interactive)railway environment# Link to specific environmentrailway environment production# Create new environmentrailway environment new# Delete environmentrailway environment delete <environment-name>

Scaling

# Scale service in linked environmentrailway scale --us-west1 3# Scale specific servicerailway scale --service api --us-west1 2# Scale across multiple regionsrailway scale --us-west1 2 --europe-west4 1# Available regions:# --us-west1, --us-west2, --us-east4# --europe-west4, --asia-southeast1

Volumes

# List volumesrailway volume list# List for specific servicerailway volume list --service api# Add new volumerailway volume add# Delete volumerailway volume delete <volume-id># Update volumerailway volume update <volume-id># Detach volume from servicerailway volume detach <volume-id># Attach volume to servicerailway volume attach <volume-id>

Database Connection

# Connect to database shellrailway connect# Examples:# - PostgreSQL: Opens psql# - MongoDB: Opens mongosh# - MySQL: Opens mysql# - Redis: Opens redis-cli

Authentication

# Login to Railway accountrailway login# Logoutrailway logout# Check current userrailway whoami

Common Workflows

Initial Project Setup

# Loginrailway login# Link to existing projectrailway link# Or create new projectrailway init# Link to servicerailway service api# Link to environmentrailway environment production# Check statusrailway status

Deploy with Environment Variables

# Set variablesrailway variables --set "NODE_ENV=production" --set "API_KEY=secret"# Deployrailway up# Monitor logsrailway logs --deployment

Debug Failed Deployment

# Get deployment IDDEPLOY_ID=$(railway status --json | jq -r '.services.edges[0].node.serviceInstances.edges[0].node.latestDeployment.id')# View build logsrailway logs $DEPLOY_ID --build# View deployment logsrailway logs $DEPLOY_ID --deployment# Check full statusrailway status --json | jq '.services.edges[].node.serviceInstances.edges[].node.latestDeployment'

Monitor Multiple Services

# Terminal 1: API logsrailway logs --service api --deployment# Terminal 2: Worker logsrailway logs --service worker --deployment# Or use JSON + jq for filteringrailway logs --service api --json | jq 'select(.level == "error")'

Extract Deployment Information

# Get all deployment IDsrailway status --json | jq -r '.services.edges[].node | {service: .name, deployment: .serviceInstances.edges[0].node.latestDeployment.id}'# Get commit info for deploymentrailway status --json | jq -r '.services.edges[].node.serviceInstances.edges[].node.latestDeployment.meta | {commit: .commitHash, message: .commitMessage}'# Get service URLsrailway status --json | jq -r '.services.edges[].node | select(.serviceInstances.edges[0].node.latestDeployment.canRedeploy == true)'

Redeploy After Config Change

# Change variablesrailway variables --set "NEW_VAR=value"# Redeploy to pick up changesrailway redeploy --yes# Or deploy freshrailway up

Run Commands with Railway Environment

# Run migrationrailway run npm run migrate# Run seed scriptrailway run node scripts/seed.js# Start local dev with production variablesrailway run npm run dev# Open shell with all variablesrailway shell

Important Notes

Deployment Targets

  • Production: Linked to production environment
  • Preview: Branch-based deployments (configured in Railway dashboard)
  • Development: Local with railway run or railway shell

JSON Output

  • railway status --json is the most comprehensive command
  • Contains: services, deployment IDs, commit info, build config, service instances
  • Use jq for parsing and filtering

Environment Linking

  • Project, service, and environment are all linked separately
  • Use railway status to verify what you're linked to
  • Change with railway service, railway environment, railway link

Logs Behavior

  • Default: Latest deployment logs (5-minute window)
  • Deployment logs: Application output (stdout/stderr)
  • Build logs: Nixpacks, dependencies, compilation
  • JSON output: Structured logs for parsing

Railway.json Configuration

  • Stored in project root
  • Defines build/deploy configuration per service
  • Example:
{  "$schema": "https://railway.app/railway.schema.json",  "build": {    "builder": "NIXPACKS",    "buildCommand": "pnpm install && pnpm run build"  },  "deploy": {    "startCommand": "node dist/index.js",    "healthcheckPath": "/health",    "healthcheckTimeout": 100,    "restartPolicyType": "ON_FAILURE",    "restartPolicyMaxRetries": 10  }}

Common Issues

  • No TTY errors: Command requires interactive input (use JSON output or flags)
  • Service not linked: Run railway service <service-name> first
  • Environment not linked: Run railway environment <env-name> first
  • Deployment not found: Use railway status --json to verify deployment ID exists

Examples from Real Projects

Saturn Backend (API + Worker)

# Check both services statusrailway status --json | jq '.services.edges[] | {  service: .node.name,  deployment: .node.serviceInstances.edges[0].node.latestDeployment.id,  commit: .node.serviceInstances.edges[0].node.latestDeployment.meta.commitHash}'# Get API deployment logsrailway logs --service api --deployment# Get worker deployment logsrailway logs --service worker --deployment# Redeploy both after config changerailway redeploy --service api --yesrailway redeploy --service worker --yes

Debug Production Issue

# Stream live logs with error filteringrailway logs --service api --deployment --json | jq 'select(.level == "error" or .level == "fatal")'# Get recent deployment metadatarailway status --json | jq '.services.edges[] | select(.node.name == "api") | .node.serviceInstances.edges[0].node.latestDeployment.meta'# Check health check configurationrailway status --json | jq '.services.edges[].node.serviceInstances.edges[].node.latestDeployment.meta.fileServiceManifest.deploy'

모든 파일

1개 파일

Railway CLI Management 설치

스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축 해제하세요.

ZIP 다운로드

저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.

git clone https://github.com/CaptainCrouton89/.claude/blob/main/skills.archive/railway-cli/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

복사 복사
빠른 설정: 스킬 폴더를 .claude/skills/Claude로 복사하면 자동으로 해당 스킬을 감지하여 사용할 수 있습니다.

관련 스킬

Verification &amp; Quality Assurance
업데이트 된 시간 2026년 6월 29일
base44-cli
업데이트 된 시간 2026년 6월 29일
klingai-upgrade-migration
업데이트 된 시간 2026년 7월 3일
debug
업데이트 된 시간 2026년 7월 3일
OR