Prompt
How do I get off Heroku without breaking my SaaS app?
Latest observation
Getting off Heroku without breaking your SaaS is mostly about reducing risk and moving in small, reversible steps.
The safe way to do it
1) Inventory everything Heroku is currently doing
Make a list of:
- web dynos
- workers / background jobs
- schedulers / cron jobs
- Postgres / Redis / other add-ons
- file storage
- environment variables
- release phase tasks
- domains / SSL
- logs / metrics / alerts
- one-off scripts and admin jobs
If you don’t map all of this first, migrations usually fail because of hidden dependencies.
2) Separate your app from Heroku-specific assumptions
Common Heroku dependencies:
PORThandling- ephemeral filesystem
- Heroku Postgres quirks
- Redis-backed job queues
- config vars
- buildpack behavior
- release phase migrations
Before moving, make sure your app can run in a more standard container/server setup:
- don’t rely on local disk for persistent uploads
- use object storage like S3
- externalize config via env vars
- make startup commands portable
- ensure your app is stateless
3) Choose the target platform
Pick the destination before moving anything:
- Docker on ECS/Fargate
- Kubernetes
- Render
- Fly.io
- Railway
- DigitalOcean App Platform
- AWS App Runner / EC2
- GCP Cloud Run
- VPS + Nginx + systemd
If you want the least operational work, a managed container platform is usually easier than raw VMs.
4) Recreate your production environment in staging
Set up the target platform with:
- same env vars
- same database engine/version
- same queue/worker setup
- same storage provider
- same domain structure if possible
Then deploy a copy of the app and test:
- login/auth
- billing
- background jobs
- emails
- webhooks
- uploads/downloads
- cron jobs
- admin actions
- error handling
5) Migrate data carefully
If you’re using Heroku Postgres:
- take a backup
- restore it to the new DB
- verify schema, extensions, and migrations
- run read/write tests
For Redis or queues:
- usually you do not migrate live queue state
- drain jobs before cutover if possible
- pause background workers briefly during transition
6) Cut over traffic gradually
Use a staged release:
- deploy new app side-by-side
- lower DNS TTL ahead of time
- switch a small percentage of traffic if you can
- monitor errors, latency, and logs
- keep Heroku running until things look stable
If you can’t do traffic splitting, do a short maintenance window.
7) Keep rollback easy
Before the switch:
- keep the Heroku app untouched
- don’t deprovision anything yet
- snapshot the database
- verify you can point DNS back to Heroku quickly
Rollback plan should be:
- revert DNS
- restore old env vars
- re-enable workers
- if needed, restore backup
8) Only decommission after a burn-in period
Leave Heroku running for at least a few days, ideally a week or two:
- monitor real traffic
- check cron jobs
- verify billing, emails, and webhook retries
- confirm no hidden edge cases
Then remove add-ons and shut down the app.
Common failure points to watch for
- File uploads stored on dyno disk
- Background jobs not running after cutover
- Wrong database extensions or collation
- SMTP/email provider changes
- Environment variables missing
- Webhooks failing due to URL changes
- SSL / domain config mistakes
- Cache/session invalidation
- DNS propagation delays
- Memory/timeouts behaving differently off Heroku
A low-risk migration pattern
A good pattern is:
- Make app platform-independent
- Deploy to new platform in staging
- Clone prod DB to new DB
- Run both systems in parallel briefly
- Switch DNS
- Watch closely
- Decommission Heroku later
If you want the simplest possible migration
Usually the safest “no drama” path is:
- containerize the app
- move DB to managed Postgres
- move files to S3
- move workers to a managed queue/worker service
- deploy to a managed container host
That tends to preserve your architecture while removing Heroku.
If you want, I can give you a step-by-step Heroku exit checklist or a migration plan tailored to your stack (Rails, Django, Node, etc.).