Clawdbot running on fly.io
This repository contains the configuration to deploy Clawdbot to Fly.io with automatic deployments via GitHub Actions.
- flyctl CLI installed
- Fly.io account (free tier works)
- Anthropic API key (for Claude access)
- Optional: Discord bot token, Telegram token, etc. for channel integrations
- Optional: Cloudflare Zero Trust account (for tunnel access)
-
Create the Fly.io app:
flyctl apps create flying-jarvis
-
Create a persistent volume:
flyctl volumes create clawdbot_data --region dfw --size 1
-
Set up GitHub Actions secrets:
- Go to your repository Settings > Secrets and variables > Actions
- Add the following repository secrets:
Required secrets:
FLY_API_TOKEN- Get your token with:flyctl auth tokenFLY_APP_NAME- Your Fly.io app name (e.g.,flying-jarvis)FLY_REGION- Your Fly.io region (e.g.,dfw)CLAWDBOT_GATEWAY_TOKEN- Generate with:openssl rand -hex 32ANTHROPIC_API_KEY- Your Anthropic API key (e.g.,sk-ant-...)
Optional secrets (add as needed):
OPENAI_API_KEY- Your OpenAI API keyGOOGLE_API_KEY- Your Google API keyDISCORD_BOT_TOKEN- Your Discord bot tokenDISCORD_GUILD_ID- Your Discord server/guild ID (automatically replacesYOUR_GUILD_IDplaceholder in config)- Add other channel tokens as needed
CLOUDFLARE_TUNNEL_TOKEN- Cloudflare Tunnel token (for private access)CLAWDBOT_CONTROL_UI_ALLOW_INSECURE_AUTH- Set totrueto allow token-only Control UI auth over tunnels (skips device pairing)
-
Deploy:
- Push to the
mainbranch to trigger automatic deployment via GitHub Actions - The workflow will automatically sync all secrets to Fly.io and deploy
- By default, deployments now use the latest stable release of Clawdbot instead of the main branch
Manual deployment with options:
- Go to Actions tab > Deploy to Fly.io workflow
- Click "Run workflow"
- Clawdbot version: Choose which version to deploy:
latest(default): Uses the latest stable release tagmain: Uses the main branch (bleeding edge)- Any specific tag (e.g.,
v1.2.3) or commit SHA
- Reset config to default: Check to delete the existing config and create a fresh one
- This is useful when you want to start over with the default configuration
- Push to the
After deployment, you can:
-
Access the Control UI:
- If you configure Cloudflare Tunnel, use the hostname you attach to the tunnel
(example:
https://jarvis.example.com/). - Otherwise, use
flyctl openorhttps://{your-app-name}.fly.dev/.
The default config is automatically created on first run. You can customize it through the UI or by editing
/data/clawdbot.jsondirectly. - If you configure Cloudflare Tunnel, use the hostname you attach to the tunnel
(example:
-
View logs:
flyctl logs
-
SSH into the machine (optional):
flyctl ssh console
You can edit the config file at
/data/clawdbot.jsonif needed. The default config includes:- Discord integration enabled (requires
DISCORD_BOT_TOKENenvironment variable) - Placeholder guild ID (
YOUR_GUILD_ID) that gets automatically replaced with your actual Discord server ID from theDISCORD_GUILD_IDenvironment variable on startup - Claude Opus 4.5 as primary model with Sonnet 4.5 and GPT-4o as fallbacks
- Discord integration enabled (requires
The application automatically creates a default config at /data/clawdbot.json on first startup. To customize:
-
Via the Control UI (recommended):
- Access the UI at your Cloudflare Tunnel hostname (recommended), or
https://{your-app-name}.fly.dev/if you are using the public app URL - Navigate to the configuration section
- Make your changes through the interface
- Access the UI at your Cloudflare Tunnel hostname (recommended), or
-
Via SSH (advanced):
- SSH into the machine:
flyctl ssh console - Edit the config:
vi /data/clawdbot.json - Note: If you set the
DISCORD_GUILD_IDenvironment variable, theYOUR_GUILD_IDplaceholder will be automatically replaced on each startup - Add or modify channels, agents, or other settings
- Exit and the changes will take effect (may require restart)
- SSH into the machine:
If you need to build the Docker image locally with a specific version:
# Use the latest release (default)
docker build --build-arg CLAWDBOT_VERSION=latest -t flying-jarvis .
# Use the main branch
docker build --build-arg CLAWDBOT_VERSION=main -t flying-jarvis .
# Use a specific tag
docker build --build-arg CLAWDBOT_VERSION=v1.2.3 -t flying-jarvis .
# Use a specific commit
docker build --build-arg CLAWDBOT_VERSION=abc1234 -t flying-jarvis .- OOM/Memory Issues: The fly.toml is configured with 2GB RAM (recommended). If issues persist, increase memory.
- Gateway lock issues: If the gateway won't start, delete lock files:
flyctl ssh console -C "rm -f /data/gateway.*.lock" - Config not persisting: Ensure
CLAWDBOT_STATE_DIR=/datais set (already configured in fly.toml) - Cloudflare Tunnel not reachable: Ensure
CLOUDFLARE_TUNNEL_TOKENis set and the tunnel points tohttp://127.0.0.1:3000 - Control UI token rejected over tunnel: Set
CLAWDBOT_CONTROL_UI_ALLOW_INSECURE_AUTH=trueand redeploy to allow token-only auth (skips device pairing). - Discord bot doesn't respond:
- Ensure
DISCORD_BOT_TOKENis set in secrets and the app was redeployed. - Ensure
DISCORD_GUILD_IDis set in secrets. The placeholderYOUR_GUILD_IDin the config will be automatically replaced on startup. - The default config uses
groupPolicy: "allowlist"and a per-guild channel allowlist; add the target channel ID underchannels.discord.guilds.<guild-id>.channelsor switch the policy to open. - Restart the app after config changes.
- Ensure
For more details, see the official Clawdbot Fly.io documentation.