Back to blog
Guides1 min read

Move from Heroku to your own VPS

Export the database, map the config vars, point the domain: a checklist for moving an app with only minutes of downtime.

Moving an app off Heroku is mostly bookkeeping. This checklist keeps the downtime to the few minutes the database copy takes.

1. Inventory

Write down what the app uses: the database, the add ons, the config vars, the scheduled jobs and the domains. Each one needs a home before the move.

2. Recreate the app

Create the app in Deplo from the same repository, with the same start command as the web process. Workers become apps of their own, built from the same code.

3. Copy the config vars

Shell
heroku config --shell --app my-app > .env

Import the file from the Variables tab. Mark the secrets as secret: once saved, nobody can read them back.

4. Move the database

Put the app in maintenance mode, then dump and restore:

Shell
pg_dump --format=custom --no-owner "$HEROKU_DATABASE_URL" > app.dump
pg_restore --no-owner --dbname "$DEPLO_DATABASE_URL" app.dump

5. Switch the domain

Lower the TTL of the record a day before, then point it at the new server. Keep Heroku running until the old record has expired everywhere.

Editor's note: scheduled jobs from Heroku Scheduler become cron jobs on the app, with the same command.

Ten minutes from now,
it's live.

Answer three questions and pick a host, or install Deplo on a server you already have. It's free, and leaving is as easy as arriving. What you do with the money you save is your business.

Move from Heroku to your own VPS - Deplo