OpenClaw on Fly.io: Global Edge Deployment Guide
Deploy OpenClaw on Fly.io for low-latency global edge hosting. Setup guide with persistent storage, secrets management, and multi-region tips.
Fly.io deploys Docker containers to edge data centres around the world, giving your OpenClaw instance low latency regardless of where your users are. This guide covers the complete setup from a Dockerfile to a running instance with persistent storage and secrets management.
Why Fly.io for OpenClaw?
- Global edge: 30+ regions worldwide, with anycast routing to the closest
- Persistent volumes: native support for stateful apps like OpenClaw
- Secrets management: encrypted environment variables via
fly secrets - Free tier: limited resources but enough to test
Install flyctl
curl -L https://fly.io/install.sh | sh
fly auth signup # or fly auth login
Create fly.toml
In your OpenClaw directory, create fly.toml:
app = "my-openclaw-agent"
primary_region = "sin" # Singapore
[build]
image = "openclaw/openclaw:latest"
[env]
PORT = "8080"
[http_service]
internal_port = 8080
force_https = true
[[mounts]]
source = "openclaw_data"
destination = "/root/.openclaw"
Set Secrets
fly secrets set ANTHROPIC_API_KEY=your_key_here
fly secrets set SECRET_KEY=$(openssl rand -hex 32)
fly secrets set TELEGRAM_BOT_TOKEN=your_token
Create Volume and Deploy
fly volumes create openclaw_data --size 10 --region sin
fly deploy
fly open # Opens your app in browser
Multi-Region Setup
# Add a second region for redundancy
fly regions add iad # Washington DC
fly scale count 2 # Run 2 instances across regions
Fly.io handles load balancing between regions automatically.
Cost Estimate
Fly.io billing is per-second resource usage. A typical OpenClaw instance:
- 1 shared-CPU-1x with 256MB RAM: ~$1.94/month
- 1 shared-CPU-1x with 512MB RAM: ~$3.83/month (recommended minimum)
- 10GB persistent volume: $1.50/month
Total: approximately $5–6/month, competitive with Hetzner for a managed PaaS experience.
Frequently Asked Questions
Does Fly.io support WebSockets?
Yes. Fly.io's HTTP service supports WebSocket upgrades, which OpenClaw uses for real-time updates. No special configuration needed.
What happens if my app crashes?
Fly.io automatically restarts crashed containers. Configure min_machines_running = 1 in fly.toml to ensure at least one instance is always running.
nacre.sh
Run OpenClaw without the server headaches
Dedicated instance, automatic TLS, nightly backups, and 290+ LLM integrations. Live in under 90 seconds from $12/month.
Deploy your agent →