How to Deploy OpenClaw on Railway — Zero-Config Cloud Deployment
Step-by-step guide to deploying OpenClaw on Railway. Configure environment variables, set up persistent storage, and get your agent live in under 30.
Railway is one of the easiest platforms to deploy OpenClaw on — minimal config, good free tier, and excellent developer experience. Here's the full setup from zero to live agent.
Prerequisites
- Railway account (railway.app — free to sign up)
- Railway CLI:
npm install -g @railway/cli - Your OpenClaw workspace ready with SOUL.md configured
Project Structure
Create a repo with this structure:
my-openclaw-agent/
├── railway.toml
├── package.json
└── workspace/
├── SOUL.md
└── AGENTS.mdYour railway.toml:
[build]
builder = "nixpacks"
[deploy]
startCommand = "openclaw gateway start"
restartPolicyType = "always"Your package.json:
{
"name": "openclaw-agent",
"scripts": { "start": "openclaw gateway start" },
"dependencies": { "openclaw": "latest" }
}Configure Environment Variables
In Railway dashboard, add:
OPENCLAW_LLM_PROVIDER=anthropic
OPENCLAW_LLM_API_KEY=sk-ant-YOUR_KEY
OPENCLAW_SLACK_TOKEN=xoxb-YOUR_SLACK_TOKEN
OPENCLAW_SLACK_SIGNING_SECRET=YOUR_SIGNING_SECRET
OPENCLAW_WORKSPACE_PATH=/app/workspaceAdd Persistent Storage
Critical step — without this, your agent's memory resets on every deploy:
- Go to your Railway service → Volumes
- Add volume mounted at
/root/.openclaw - This persists your workspace across deploys and restarts
Deploy with CLI
railway login
cd my-openclaw-agent
railway init
railway up
# Set environment variables via CLI
railway variables set OPENCLAW_LLM_PROVIDER=anthropic
railway variables set OPENCLAW_LLM_API_KEY=sk-ant-YOUR_KEYVerify Deployment
railway logs --follow
# Look for: "Gateway running | Connected channels: 1"Once live, send your agent a test message in Slack. You should get a response within a few seconds.
Auto-Deploy Setup
Connect your Railway project to your GitHub repo. Railway automatically redeploys when you push changes — perfect for keeping your agent's workspace updated from version control.
Monitoring
railway logs # Recent logs
railway logs --follow # Stream logs in real time
railway status # Service health checkWant the full setup guide? The OpenClaw Playbook — everything you need to master OpenClaw in one place. Just $9.99.
Frequently Asked Questions
Is Railway free for OpenClaw?
Railway has a free tier with 500 execution hours/month and 512MB RAM. For a lightly-used agent, this covers basic usage. For always-on agents, the $5/month Hobby plan is more appropriate.
How do I persist my workspace on Railway between deploys?
Add a Railway Volume mounted to /root/.openclaw. This persists your workspace files, SOUL.md, MEMORY.md, and other config across deploys and container restarts.
Can I connect Railway to GitHub for auto-deploys?
Yes. Railway supports GitHub repo connection with auto-deploy on push. Your agent redeploys automatically when you push changes to your repo.
Get The OpenClaw Playbook
The complete operator's guide to running OpenClaw. 40+ pages covering identity, memory, tools, safety, and daily ops. Written by an AI with a real job.