Openclacky deploy

Deploy Rails applications to Clacky cloud platform(Railway backend)

install
source · Clone the upstream repo
git clone https://github.com/clacky-ai/openclacky
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/clacky-ai/openclacky "$T" && mkdir -p ~/.claude/skills && cp -r "$T/lib/clacky/default_skills/deploy" ~/.claude/skills/clacky-ai-openclacky-deploy && rm -rf "$T"
manifest: lib/clacky/default_skills/deploy/SKILL.md
source content

Railway Deployment for Rails

Deploy a Rails application to the Clacky cloud platform (Railway backend).

When to invoke

Trigger this skill when the user says:

  • "deploy", "/deploy", "deploy my app", "push to production"
  • "部署", "上线", "发布"

How to run

Step 1 — Run the deploy script

bundle exec ruby <absolute-path-to-this-skill>/scripts/rails_deploy.rb

Timeout: set to at least 300 seconds (5 minutes).

The script prints each step as it runs. When it finishes it prints one of:

[DEPLOY] RESULT: SUCCESS (2m 34s)
[DEPLOY] RESULT: FAILED (45s) — <error message>

Step 2 — Show the full output to the user

After the script exits, always show the complete stdout output to the user in a code block or verbatim. The output contains step-by-step logs they need to see. Do NOT summarise silently — show everything, then add your summary.

On success

After showing the output, report the deployed URL and any useful links.

On failure

After showing the output, show the error message and summarise the most likely cause in one sentence. Suggest next steps (e.g. fix the error shown, then re-run

/deploy
).


What the script does internally

The script runs three phases automatically. Do not add any AI reasoning steps between phases — the script handles all logic internally.

Phase 0 — Cloud project binding

  1. Reads
    .clacky/openclacky.yml
    for
    project_id
    • If file is missing → runs inline cloud project creation flow (reuses
      new/scripts/cloud_project_init.sh
      ), writes the file, continues
    • If
      project_id
      is blank → hard-fail (corrupted file)
  2. Reads
    ~/.clacky/clacky_cloud.yml
    for
    workspace_key
    • If missing/empty → hard-fail with guidance to obtain key offline
  3. Calls
    GET /openclacky/v1/projects/:id
    to verify the project exists
    • 404 → runs inline cloud project creation flow, continues
    • Other error → hard-fail

Phase 1 — Subscription check

subscription.status
Action
PAID
✅ Continue
FREEZE
⚠️ Warn, continue
SUSPENDED
❌ Hard-fail
null
/
OFF
/
CANCELLED
Open payment page, poll for activation

Payment polling: open

https://app.clacky.ai/dashboard/openclacky-project/<id>
in browser, poll
GET /openclacky/v1/deploy/payment
every 10 s for up to 180 s.

Phase 2 — Deployment (8 steps)

StepAction
1
POST /deploy/create-task
→ get
platform_token
,
platform_project_id
,
deploy_task_id
2
railway link --project <id> --environment production
3Inject env vars: Rails defaults + Figaro
config/application.yml
production block +
categorized_config
4Poll
GET /deploy/services
until DB middleware is
SUCCESS
→ inject
DATABASE_URL
reference; call
POST /deploy/bind-domain
5
railway up --service <name> --detach
→ notify backend
"deploying"
6Poll
GET /deploy/status
every 5 s (max 300 s) until
SUCCESS
or failure
7
railway run bundle exec rails db:migrate
; seed if first deployment
8HTTP health check on deployed URL; notify backend
"success"

All

railway
commands receive
RAILWAY_TOKEN
via Ruby
ENV
hash — no
clackycli
wrapper is needed.


Important constraints

  • Never modify source files before deploying.
  • Never commit or push changes as part of this skill.
  • Never prompt the user for Railway credentials — those come from the Clacky platform (
    platform_token
    is returned by
    create-task
    ).
  • If
    railway
    CLI is not installed, hard-fail with install instructions:
    npm install -g @railway/cli