RYP-E4, dispatch 4.2 PY2.2 (Railyard side): - lib/watch: checks (public https app addresses only; IPs, private names and our own hosts refused), 20 per org, a status page slug each. The box 1 agent reads GET /api/v1/watch/agent/checks (ids and URLs only, bearer WATCH_AGENT_TOKEN) and posts results to /api/v1/watch/agent/results. Two failures in a row turn a check red; each change emails the owner once through Rally Send (product railyard, from status@, idempotency key per change; a failed send is retried on the next result). Older, unknown and future results change nothing. - /status/<slug>: live results only (state, share of the last checks, bars), the check's name and never its address or any host or vendor name. - The Watch screen: add by address, pause or resume, open the status page. - Bridge route uptime (contract cases, uptime_check_keys): a check for the given address, or the app's latest live deploy; the first result is the slot's proof (check_result). - Gated on RAILYARD_WATCH_LIVE (denylist rule railyard-slot-watch): off, no check runs, the pages 404, the nav has no Watch item and the slot answers arriving. The copy test lints each gated surface with the flag and proves it checks the flag first. - Migration 0006 (watch_checks, watch_status; https only, history capped at 90, cascades with the org). Tests: watch 10/10, bridge 25/25, contract 3/3, migration 7/7 (0006 twice on a scratch cluster), watch copy 7/7, console 108/108 with the bundle build, tsc clean, SDK 7/7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Railyard console
The signed-in console for Railyard (RYP-D1, Wave E package Y-2): sign in with Google or GitHub, a $1 card check that is credited back, a 14-day trial with the plan's limits, then one plan billed monthly or yearly. Three screens (Apps, Usage, Billing), one primary action on each, a pause switch and one-click cancel.
How it works
- Sign-in: the console's own Scribase project handles Google and GitHub (OAuth with PKCE). The console reads the user from the auth server, creates the org and its entitlements row, and keeps a signed, HttpOnly session cookie.
- Data: schema
railyardin the same Scribase project (db/migrations/0001_railyard_console.sql), reached with the service role from the server only. RLS is on with no policies. - Money ladder:
lib/ladder.ts(pure). Checkout sessions carry signed metadata, so a payment link with made-up metadata cannot name an org.lib/webhook.tsverifies the Standard Webhooks signature and timestamp, ignores replays (unique message id), applies the ladder, and credits or debits the $1 on the customer's wallet with idempotency keys. A refund of the card check reverses the credit and ends the trial. - CLI sign-in: a device flow at
/api/v1/device/codeand/api/v1/device/token; the user approves the code at/device. Tokens are org-scoped and stored as SHA-256 hashes. - Test mode only: the payment client refuses the live host unless
RAILYARD_DODO_LIVE=1is set by the owner.
Environment
| Name | Where | What |
|---|---|---|
SCRIBASE_URL |
var | The console's Scribase project URL |
SCRIBASE_ANON_KEY |
secret | Project anon key (sign-in calls only) |
SCRIBASE_SERVICE_ROLE_KEY |
secret | Project service role (schema railyard) |
RAILYARD_SESSION_SECRET |
secret | 32+ random bytes; signs sessions and checkout metadata |
DODO_API_KEY |
secret | Test-mode key of the railyard brand |
DODO_WEBHOOK_SECRET |
secret | Webhook signing secret (whsec_...) |
DODO_BRAND_ID |
var | Brand id; events for other brands are ignored |
DODO_PRODUCT_ID_CARD_CHECK, DODO_PRODUCT_ID_MONTH, DODO_PRODUCT_ID_YEAR |
var | The three products |
DODO_API_BASE |
var | Defaults to the test host |
RAILYARD_DODO_LIVE |
var | Owner only: 1 allows the live host |
RAILYARD_CONSOLE_URL, RAILYARD_INSIGHTS_URL |
var | Public URLs |
INSIGHTS_API_URL |
var | Insights tenant API base (Wave P PY1.3); empty keeps the Insights page on "No data yet" |
FLAGS_API_URL |
var | Railyard Flags (Wave P PY2.1): base URL of the flags service on box 2 (through the tunnel). With FLAGS_ADMIN_TOKEN set, new flag environments are made there; without them, flags live in the console's own tables (migration 0005), the fallback. |
FLAGS_ADMIN_TOKEN |
secret | The flags service's instance admin token (Token ... auth). Only this console holds it; apps read flags with their public flags key. |
RAILYARD_WATCH_LIVE |
var | Railyard Watch (Wave P PY2.2). 1 turns on uptime checks, the Watch screen, the public status pages and the alert email. Unset (the default): no check runs and nothing about Watch is shown (denylist rule railyard-slot-watch). Set it only after the customer checks stack on box 1 passes its drill. |
WATCH_AGENT_TOKEN |
secret | Bearer token of the box 1 checks agent (stacks/gatus-customers/agent.sh), at least 32 characters; the same value sits in /etc/products/watch-agent.token on box 1. Unset keeps the agent API off (503). |
RALLY_TX_URL |
var | Rally Send transactional endpoint (https) for Watch alert email, product railyard. |
RALLY_TX_KEY |
secret | Rally Send key minted for product railyard. Without it, alerts are logged, not sent. |
INSIGHTS_API_TOKEN |
secret | Bearer token of the Insights tenant API |
SITES |
KV binding | The edge collector's site entries; written when an app is added and on every plan, add-on or pause change |
RELAY_URL |
var | Relay's OpenAI-compatible base for the AI gateway (Wave P PY1.4) |
RELAY_TENANT_KEY |
secret | The Relay tenant key from relay-tenancy.sh tenant-key (BYOK only; see apps/relay/config/tenants/README.md) |
RAILYARD_CREDENTIALS_KEY |
secret | 32 random bytes, base64: seals customers' provider keys |
RAILYARD_SCRIBASE_BRIDGE_SECRET |
secret | Standard Webhooks secret (whsec_...) shared with Scribase control-api for the bridge (Wave P PY1.0). Unset keeps the bridge off (503). |
RAILYARD_BRIDGE_ACCEPT_LEGACY |
var | P-Y1 transition only. 1 also accepts bridge calls from a Scribase build older than contract version 2 (message id without the route, orgs without addon.as_of). Unset (the default) refuses them. Set it only for the minutes between the console deploy and the Scribase control-api deploy, then remove it. |
Scribase bridge (Wave P PY1.0)
Scribase sells Railyard inside its portfolio add-on. Its control-api calls
/api/v1/bridge/scribase/{orgs,claims,proof}, server to server and signed
(app/api/v1/bridge/scribase/service.ts). The first call creates the Railyard
org bound to the Scribase org id (no second sign-up, table
railyard.scribase_bindings, migration 0002), and the add-on state is
mirrored into the entitlement as plan addon. A lapsed add-on pauses the org
and keeps its data. Keys reach only the Scribase CLI: a claim is a one-time,
pre-approved device code that the CLI exchanges at /api/v1/device/token and
writes to the credentials file. The contract is
tests/contract/fixtures/scribase-bridge/contract.json at the repo root.
Tests
pnpm install --filter @railyard/console
node --test test/*.test.ts # journey, webhook, ladder, tokens, repo, component, bundle, migration
The journey test runs sign-in, the $1 checkout, the webhook and "Add app" against
in-memory fakes of the payment and auth servers. The bundle test runs
next build with sentinel secrets and greps the client bundle. The migration
test starts a throwaway local Postgres.
Owner steps
- Create the
railyardbrand and the three test-mode products; set the env above. - Apply
db/migrations/0001_railyard_console.sql, thendb/migrations/0002_scribase_bridge.sqlanddb/migrations/0003_ai_gateway.sql, to the console's Scribase project and addrailyardto its exposed schemas. - Enable Google and GitHub sign-in on that project with
https://railyard.ereboslab.com/auth/callbackas a redirect URL. - Point the webhook at
/api/billing/webhook, then run one card check and one refund in test mode and record the result.