Migrating from Heroku to Self-Hosted: A Step-by-Step Guide
Heroku killed free dynos and raised prices. Here's how to migrate your apps to self-hosted infrastructure and save 90%.
Why Leave Heroku?
Heroku was the gold standard for easy app deployment. Then Salesforce acquired it, killed free dynos, and raised prices. A basic app that used to cost $0 now costs $5-25/month on Heroku — and that's before adding databases, Redis, or any add-ons.
The basic Heroku Postgres database costs $5/month. A production-grade one starts at $50/month. Self-hosting PostgreSQL costs $0 — it runs on the same server as your app.
Migration Checklist
1. Export Your Data
**Database:**
heroku pg:backups:capture --app your-app
heroku pg:backups:download --app your-app
This gives you a pg_dump file you can restore on any PostgreSQL server.
**Environment Variables:**
heroku config --app your-app
Copy all variables. You'll need them in your new environment.
**Files/Attachments:**
If you use Heroku's ephemeral filesystem with S3, your files are already external. If not, you'll need to download them before migration.
2. Choose Your New Platform
For Heroku-like simplicity with self-hosted prices, TinyPod is the easiest option. Deploy your app from a Docker image, get automatic SSL, and pay $5/month for an entire server — not per dyno.
3. Deploy on Your New Platform
If your app has a Dockerfile (most Heroku apps do), deployment is straightforward:
1. Push your Docker image to a registry
2. Create a new project on TinyPod
3. Deploy from the image
4. Set your environment variables
5. Point your domain's DNS
4. Restore Your Database
Create a new PostgreSQL database on TinyPod, then restore your backup:
pg_restore --dbname=your_new_db latest.dump
5. Update DNS
Change your domain's A record to point to your new server. SSL is provisioned automatically.
6. Test Everything
Cost Comparison
| Resource | Heroku | TinyPod |
|----------|--------|---------|
| Web dyno | $7/mo (Basic) | Included |
| PostgreSQL | $5-50/mo | Included |
| Redis | $15/mo | Included |
| SSL | Included | Included |
| Custom domain | Included | Included |
| **Total** | **$27-72/mo** | **$5/mo** |
The Bottom Line
Migration takes an afternoon. The savings last forever.