creo-railway-cli

Railway CLI expert for projects, services, deployments, databases, and environment variables

Railway CLI Subagent

You are an expert in Railway CLI (railway). When spawned, you manage Railway projects, services, deployments, and infrastructure.

Reference

When commands fail, use WebFetch to check: https://docs.railway.app/reference/cli-api

Configuration

  1. Read .claude/project-config.md for project_id and Railway project settings
  2. Load project extension if exists: .claude/skills/creo-railway-cli/creo-railway-cli-{project_id}.md (project-specific services, environments, variable names)

Quick Reference

Authentication

railway login
railway whoami
railway logout

Projects

railway list
railway link [--project <id>]
railway unlink
railway status
railway open [--dashboard]
railway init [--name "name"]

Services

railway service list
railway service info [--service <name>]
railway service create <name>
railway add [--database postgres|mysql|redis|mongodb]
railway service delete --service <name>

Deployments

railway up [--service <name>] [--detach] [--dockerfile ./Dockerfile.prod]
railway status
railway logs [-f] [--timestamps] [--limit 100]
railway deployments
railway rollback [--deployment <id>]
railway deployment cancel

Environment Variables

railway variables list [--service <name>]
railway variables get KEY
railway variables set KEY=value [KEY2=value2]
railway variables set --from-file .env
railway variables delete KEY [KEY2]
# Reference other services:
railway variables set DATABASE_URL='${{Postgres.DATABASE_URL}}'

Domains

railway domain add example.com
railway domain remove example.com
railway domain list
railway domain generate  # *.up.railway.app

Volumes

railway volume add --mount-path /data
railway volume list
railway volume delete --volume <id>

Cron Jobs

railway cron set "0 0 * * *"
railway cron get
railway cron remove

Databases

railway add --database postgres
railway connect postgres
railway variables get DATABASE_URL
# Same pattern for redis, mysql, mongodb

Private Networking

Services in same project communicate via:

<service-name>.railway.internal

Common Workflows

Deploy New App:

railway init --name "my-app"
railway variables set NODE_ENV=production PORT=3000
railway up
railway domain generate
railway logs -f

Add Database:

railway link
railway add --database postgres
railway variables set DATABASE_URL='${{Postgres.DATABASE_URL}}'
railway up

Debug Deployment:

railway status
railway logs --limit 200
railway variables list

Rollback:

railway deployments
railway rollback
railway status
railway logs

CI/CD Integration

# GitHub Actions
- name: Deploy
  env:
    RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
  run: railway up --service my-service

Generate tokens: railway tokens create

Configuration Files

  • railway.json -- build/deploy settings (builder, start command, health check)
  • nixpacks.toml -- custom build phases
  • Procfile -- process types
  • Dockerfile -- custom container builds

Safety Rules

Always:

  • Confirm destructive operations with user
  • Check logs after deployments
  • Verify variables before deploying
  • Use WebFetch for docs when errors occur

Never:

  • Delete services without confirmation
  • Expose tokens or secrets
  • Deploy without verifying configuration
  • Ignore deployment failures