How to Deploy OpenClaw on Fly.io — Global Edge Deployment Guide
Deploy OpenClaw on Fly.io with persistent volumes and global distribution. Full setup guide including fly.toml config, secrets, and volume mounting.
Fly.io is an excellent hosting choice for OpenClaw — good free tier, 30+ regions, and clean CLI tooling. Here's how to get your agent deployed and running persistently.
Install flyctl
curl -L https://fly.io/install.sh | sh
flyctl auth loginCreate Your Dockerfile
FROM node:20-alpine
WORKDIR /app
RUN npm install -g openclaw
COPY workspace/ /root/.openclaw/workspace/
HEALTHCHECK --interval=30s --timeout=10s \
CMD openclaw gateway status || exit 1
CMD ["openclaw", "gateway", "start"]Create fly.toml
app = "my-openclaw-agent"
primary_region = "ord"
[env]
PORT = "8080"
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
[[mounts]]
source = "openclaw_workspace"
destination = "/root/.openclaw"
[[vm]]
memory = "512mb"
cpu_kind = "shared"
cpus = 1Create the Volume
flyctl volumes create openclaw_workspace \
--region ord \
--size 1Set Secrets
Never put API keys in fly.toml — use secrets:
flyctl secrets set OPENCLAW_LLM_PROVIDER=anthropic
flyctl secrets set OPENCLAW_LLM_API_KEY=sk-ant-YOUR_KEY
flyctl secrets set OPENCLAW_SLACK_TOKEN=xoxb-YOUR_TOKEN
flyctl secrets set OPENCLAW_SLACK_SIGNING_SECRET=YOUR_SECRETDeploy
flyctl launch # First deploy
flyctl deploy # Subsequent deploysVerify and Monitor
flyctl status # Check machine status
flyctl logs # Stream logs
flyctl ssh console # SSH into machine for debuggingMulti-Region Deployment
One of Fly.io's unique strengths — run agents in multiple regions for redundancy:
flyctl regions add lhr # Add London
flyctl regions add sin # Add Singapore
flyctl scale count 2 # Run 2 instancesWant the full setup guide? The OpenClaw Playbook — everything you need to master OpenClaw in one place. Just $9.99.
Frequently Asked Questions
Is Fly.io free for OpenClaw?
Fly.io's free tier includes shared-cpu-1x machines with 256MB RAM. This is enough for a basic agent. For more reliable performance, a $1.94/month shared-cpu-1x with 512MB is recommended.
How is Fly.io different from Railway for OpenClaw?
Fly.io gives you more control over regions and machine specs. Railway is simpler to set up and has better GitHub integration. Fly.io is better if you need specific geographic placement or more fine-grained resource control.
Does Fly.io support persistent volumes for OpenClaw workspace?
Yes. Create a Fly volume and mount it to /root/.openclaw to persist your workspace, memory files, and configuration across machine restarts.
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.