Deploy
Deploy Rails applications to Railway.
Install
npx skills add clacky-ai/openclacky --skill deploy -g -a claude-code -y- Repository
- clacky-ai/openclacky1.2k
- Category
- DevOps
- Updated
- 5d ago
- License
- MIT
- Context cost
- Mediumabout 1,777 tokens
- Runs scripts
- No, instructions only
What it does
Deploy Rails applications to Railway. Handles first-time setup and re-deploys idempotently using Railway CLI. Trigger on: "deploy", "deploy to railway", "railway deploy", "发布", "部署", "上线".
Deploy Rails App to Railway
Deploy the current Rails project to Railway using the Railway CLI. Works for both first-time deploys and re-deploys.
Prerequisites Check
Before starting, verify:
# 1. Railway CLI installed?
railway --version
# 2. Logged in?
railway whoami
If not logged in, instruct the user:
Please run: railway login
Then retry deployment.
Step 0: Prepare for Linux Build
Railway runs on Linux. Ensure Gemfile.lock includes the linux platform:
bundle lock --add-platform x86_64-linux
If the project uses a Dockerfile builder (check railway.toml for builder = "DOCKERFILE"), no Procfile is needed, skip creating one.
Only create a Procfile if there is no Dockerfile:
web: bundle exec puma -C config/puma.rb
Step 1: Check Link Status → Deploy Immediately if Already Linked
First: check if already linked:
railway status 2>&1
If output contains Project: → project is already linked.
Skip Steps 2, 5 entirely and jump to Step 6 (Deploy).
If output contains "not linked" or an error → not linked yet. Try linking to an existing project first, list available projects:
railway list 2>&1 | grep -i "<app-name>"
If a matching project is found, link it:
railway link --project <project-name> --service <service-name> 2>&1
Only if no existing project is found, init a new one:
railway init -n <app-name>
The app-name should match the current directory name (e.g., my-rails-app).
⚠️ NEVER run railway init when already linked or when an existing project exists.
It silently creates a brand-new Railway project. If this happens by mistake:
- Find the correct project name from
railway list - Re-link:
railway link --project <project-name> --service <service-name>
Step 2: Set Environment Variables
Set required Rails production variables. Use --skip-deploys to avoid triggering premature deploys:

