Railway Ecosystem Ops (Agent-Ready)
This guide defines a consistent agent workflow for managing Railway deployments across the HoloScript ecosystem.
Why this exists
Railway CLI auth can fail for project-scoped tokens (railway whoami / railway link), but the same token may still have valid project-scoped GraphQL access.
The automation in scripts/railway-ecosystem.ts uses Railway GraphQL directly to:
- discover projects/services accessible by the token,
- resolve service + environment IDs by name,
- trigger deployments via
serviceInstanceDeploy, - verify endpoint health via configured health URLs.
Configuration
Targets are defined in:
scripts/data/railway-ecosystem.targets.json
Each target includes:
project(Railway project name)environment(typicallyproduction)service(Railway service name)healthUrl(public health endpoint)
Required environment variables
RAILWAY_API_TOKEN(preferred)- or
RAILWAY_TOKEN(fallback)
Optional:
- target-specific API-key env vars if health endpoints need auth headers.
Commands
From repo root:
pnpm railway:discover— list Railway projects visible to token scopepnpm railway:status— evaluate configured targets (deployment + health)pnpm railway:recover— trigger deploy and poll recovery formcp-orchestratorpnpm railway:deploy -- --target <targetName>— deploy and poll any configured target
Agent process (recommended)
- Run
pnpm railway:status. - If target is unhealthy (
HTTP_5xx/NO_RESPONSE), run:pnpm railway:deploy -- --target <targetName>
- Re-run
pnpm railway:statusuntil target reports healthy. - If deployment remains
CRASHED, gather deployment metadata and logs via the same GraphQL token and fix source/config before re-deploy.
Notes
- Service IDs and environment IDs are resolved dynamically each run.
- This avoids brittle hardcoded IDs in agent workflows.
- Keep
scripts/data/railway-ecosystem.targets.jsonupdated as services are added/renamed.