Deploy OpenClaw on Railway with One-Click Template
Deploy OpenClaw on Railway using a single-click template, then manage it via the web-based Control UI. This guide covers required variables, volumes, and networking for persistent state.
Read this when
- Deploying OpenClaw to Railway
- You want a one-click cloud deploy with browser-based Control UI
Deploy OpenClaw on Railway using a single-click template, then manage it through the web-based Control UI. For those who prefer avoiding server-side terminal work, this approach is the simplest: Railway handles Gateway hosting for you.
One-click deploy
Deploy the template
Press the Deploy on Railway button located above.
Add a volume
Create a volume and mount it at /data (this is mandatory for persistent state).
Set variables
On the service, configure the following required Variables:
OPENCLAW_GATEWAY_PORT=8080(mandatory; this must align with the port specified in Public Networking)OPENCLAW_GATEWAY_TOKEN(mandatory; treat this as an admin-level secret)OPENCLAW_STATE_DIR=/data/.openclaw(mandatory for persistent state)OPENCLAW_WORKSPACE_DIR=/data/workspace(mandatory for a persistent workspace)
Enable public networking
Within Public Networking, activate HTTP Proxy for the service, targeting port 8080.
Connect
Locate your public URL by navigating to Railway -> your service -> Settings -> Domains. This will be either an auto-generated domain (frequently https://<something>.up.railway.app) or a custom domain you've attached.
Access https://<your-railway-domain>/openclaw and authenticate with the shared secret you configured. The template defaults to OPENCLAW_GATEWAY_TOKEN; should you switch to password-based authentication, use that password in its place.
From the Railway shell, execute the read-only deployment preflight:
openclaw doctor --json
What you get
- Hosted OpenClaw Gateway + Control UI
- Persistent storage via the Railway Volume (
/data), ensuringopenclaw.json, per-agentauth-profiles.json, channel/provider state, sessions, and workspace all survive redeploys
Connect a channel
For channel setup guidance, either use the Control UI at /openclaw or execute openclaw onboard through Railway's shell:
- Discord
- Telegram (quickest option, needing only a bot token)
- All channels
Backups and migration
Export your state, config, auth profiles, and workspace:
openclaw backup create
openclaw backup restore <archive.tar.gz> --target <fresh-directory>
Restoration verifies and unpacks into a fresh staging directory; activation is a separate offline step. Consult Restore a full archive for rollback warnings and the activation sequence.
Next steps
- Establish messaging channels: Channels
- Adjust Gateway settings: Gateway configuration
- Ensure OpenClaw stays current: Updating