All posts
Tutorial8 min read

From Heroku to OpenClaw: A Migration Guide

How to migrate your Heroku-deployed bots to OpenClaw. Step-by-step guide with common pitfalls and how to avoid them.

Heroku's elimination of free dynos left many developers looking for a new home. Here's how to migrate your bot to OpenClaw.

Why Migrate Now

Heroku's paid plans start at $7/month (hobby tier) but scale quickly:

  • Production dynos: $25-50/month
  • Database add-ons: $50+/month
  • Total: $100-200/month for a real production app

OpenClaw on Fly.io: $5-20/month for equivalent compute.

Migration Steps

Step 1: Assess Your Current Setup

List:

  • What dynos are you running?
  • What add-ons (database, Redis, etc.)?
  • What environment variables?
  • What buildpacks or Docker image?

Step 2: Set Up Fly.io

# Install Fly CLI
curl -L https://fly.io/install.sh | sh

# Authenticate
fly auth login

# Launch your app
fly launch --name your-bot-name

Step 3: Migrate Your Database

Replace Heroku Postgres with a managed alternative:

Option A: Neon (recommended)

# Export from Heroku
heroku pg:pull DATABASE_URL local_db --app your-app
# Import to Neon
psql $NEON_DATABASE_URL < local_db

Option B: Supabase

heroku pg:pull DATABASE_URL local_db --app your-app
pg_dump local_db | psql $SUPABASE_DB_URL

Step 4: Set Environment Variables

fly secrets set DATABASE_URL=postgres://...
fly secrets set REDIS_URL=redis://...
fly secrets set TELEGRAM_BOT_TOKEN=...

Step 5: Deploy

fly deploy

Step 6: Verify

fly logs
fly ssh console
curl localhost:3000/health

Common Pitfalls

1. Buildpacks: Fly.io auto-detects buildpacks but Heroku-specific ones may fail. Use a Dockerfile for more control.

2. Environment variables: Heroku uses ENV vars differently. Ensure all required vars are set on Fly.

3. Database connection: Change DATABASE_URL in your code. Use env vars consistently.

4. SSL: Most managed databases require SSL. Add ?sslmode=require to your connection string.

Timeline

  • Small bot (no database): 1-2 hours
  • Medium bot (Postgres): 2-4 hours
  • Complex bot (multiple add-ons): 1-2 days

Post-Migration

  • Update DNS if using custom domain
  • Set up monitoring (Sentry, Fly logs)
  • Test all functionality thoroughly
  • Monitor costs for first month

Skip the self-hosting

Deploy OpenClaw in under a minute

No servers. No SSH. No terminal. Pick a model, connect Telegram, and go.

Deploy free with Testflight