Skip to content

Instantly share code, notes, and snippets.

@henrik
Last active October 30, 2018 20:48
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/e6817dd10d9c9a36c22a to your computer and use it in GitHub Desktop.
Save henrik/e6817dd10d9c9a36c22a to your computer and use it in GitHub Desktop.
Copying a Heroku DB to dokku-psql-single-container.
cd my_heroku_app
# Make sure DB doesn't update on Heroku. This may be enough depending on your needs.
heroku maintenance:on
# Dump from Heroku.
heroku pg:pull DATABASE_URL heroku_dump
pg_dump heroku_dump -Fc > /tmp/db.dump # Fc for binary dump (otherwise the import will complain)
# Restore to Dokku.
scp /tmp/db.dump my-dokku-server:/tmp
ssh my-dokku-server "dokku psql:restore my-dokku-app < /tmp/db.dump"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment