# OpenClaw on Fly.io ## Overview This guide enables deploying OpenClaw Gateway on Fly.io with persistent storage, automatic HTTPS, and multi-channel access (Discord, Telegram, etc.). ## Key Requirements - flyctl CLI installation - Fly.io account (free tier eligible) - API credentials (Anthropic, OpenAI, etc.) - Channel tokens (Discord bot token, etc.) ## Core Setup Steps ### 1) App & Volume Creation Clone the repository, create a Fly app, and establish a 1GB persistent volume in your preferred region (London, Virginia, or San Jose). ### 2) Configuration The `fly.toml` file requires: - `--bind lan` flag to expose the gateway to Fly's proxy - `--allow-unconfigured` to launch without initial config - Port 3000 binding for health checks - Minimum 2GB RAM allocation (512MB insufficient) ### 3) Security Setup Set secrets via command line for gateway tokens, API keys, and channel credentials. Prefer env vars over config file for all API keys and tokens. ### 4) Deployment & Config Deploy using `fly deploy`, then SSH into the machine to create `/data/openclaw.json` with agent, authentication, and channel bindings. ## Access Methods - **Control UI**: Browser at `https://my-openclaw.fly.dev/` - **SSH Console**: `fly ssh console` - **Logs**: `fly logs` for monitoring ## Private Deployment Option Use `fly.private.toml` for hardened deployments without public IP exposure, ideal for outbound-only use cases or webhook delivery via ngrok/Tailscale tunnels. ## Troubleshooting Highlights - **Binding issues**: Ensure `--bind lan` in process command - **Memory errors**: Increase to 2GB minimum - **Lock file problems**: Remove `/data/gateway.*.lock` - **State persistence**: Verify `OPENCLAW_STATE_DIR=/data` configuration ## Estimated Cost $10-15 monthly with recommended specifications.