Deploy OpenClaw to Fly.io
Global edge deployment with minimal config. Great for low-latency agents.
Install Fly CLI
Install the Fly CLI and sign up or log in to your Fly.io account.
# Install flyctl
curl -L https://fly.io/install.sh | sh
fly auth login
Create App and Volume
Create a new Fly app and a persistent volume for OpenClaw data. Replace YOUR-PREFERRED-REGION with a region like iad (Virginia) or lax (Los Angeles).
# Create a new app
fly apps create my-openclaw
# Create a new volume
fly volumes create openclaw_data --size 2 --region YOUR-PREFERRED-REGION
Create Dockerfile
In your OpenClaw project directory, create a Dockerfile with the following content:
FROM ghcr.io/openclaw/openclaw:2026.2.22
USER root
# Install clawhub globally
RUN npm install -g clawhub
# Create skills directory (will be volume-mounted)
RUN mkdir -p /data/skills
RUN chown -R 1000:1000 /data
USER node Create fly.toml
Create a fly.toml in the same directory. Update app to match your app name and primary_region to your volume region.
app = "my-openclaw"
primary_region = "iad"
kill_signal = "SIGINT"
kill_timeout = 30
[build]
dockerfile = "Dockerfile"
[env]
NODE_ENV = "production"
OPENCLAW_STATE_DIR = "/data"
CLAWDHUB_WORKDIR = "/data/workspace"
NODE_OPTIONS = "--max-old-space-size=2048"
[processes]
app = "node dist/index.js gateway --port 3000 --bind lan"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
processes = ["app"]
[http_service.concurrency]
type = "connections"
hard_limit = 150
soft_limit = 120
[[vm]]
size = "shared-cpu-2x"
memory = "2048mb"
[mounts]
source = "openclaw_data"
destination = "/data"
[deploy]
strategy = "rolling"
[checks]
[checks.alive]
type = "tcp"
interval = "15s"
timeout = "2s" Set Env Vars and Secrets
Add your AI provider API key and any other secrets. Use fly secrets set for sensitive values (they are encrypted and not shown in the dashboard).
# Example: Anthropic API key
fly secrets set ANTHROPIC_API_KEY=your-key-here
# Or OpenAI, OpenRouter, etc. depending on your config
fly secrets set OPENAI_API_KEY=your-key-here
Launch Your App
From your OpenClaw project directory, deploy to Fly.io.
# Deploy
fly deploy