Railway
Run Rivet workers on Railway.
Workers run in runner mode here: your service opens a connection out to the control plane on startup. It needs no public domain and nothing pasted into a connect form.
Requirements
- A Railway account
- A GitHub repository containing your app
- A control plane, either Rivet Cloud or your own
Steps
Deploy the repository
Connect your GitHub account to Railway and select the repository. Railway detects and deploys it. See Railway’s quick start.
Set the environment variables
Add RIVET_ENDPOINT and RIVET_PUBLIC_ENDPOINT as service variables. Both values are described in Workers. See Railway’s variables docs.
If your control plane is another Railway service, reference its private domain rather than a public one.
Set the draining period
Railway kills the old deploy 0 seconds after SIGTERM by default, so actors are cut off mid-drain on every deploy.
Under Settings → Deploy, set Draining seconds. Actors need up to 30 minutes, so 2100 is the safe value. See Railway’s deployment teardown docs.
Verify
Open the dashboard and confirm your service appears under Runners. It reconnects automatically if the connection drops.
Signal handling
If your start command is a wrapper (npm start, yarn start, a shell script), the wrapper becomes PID 1 and swallows SIGTERM, so the drain never runs regardless of the draining period.
- Invoke the binary directly, for example
node dist/index.js. - Or run
dumb-initortinias PID 1 in your Dockerfile.
Scaling
Runner-mode workers are interchangeable, so raising the service’s replica count adds capacity with nothing to re-register. New replicas dial out and appear under Runners.
Removing a replica is the slow direction: it drains for up to 30 minutes, so keep the draining period at 2100 and reduce replica count gradually rather than in one step.
Railway has no CPU-target autoscaler, so replica count is fixed until you change it. Size it for peak traffic, or use Kubernetes or AWS ECS where the count moves with load.
Settings to avoid
Do not enable App Sleeping on a worker. Sleeping suspends the process, which drops its connection to the control plane, and Railway only wakes a service on inbound HTTP. Worker traffic is outbound, so the service would never wake and actors could not be scheduled to it.
Multi-region deploys are supported and place workers closer to your users.