I’ve been considering moving my part-time startup application from Heroku to Openshift for some time now. Heroku is a great platform, but I could forsee the startup costs spiraling out of control long before I could start making any money from my product. I also dont feel as far removed from the infrastructure with openshift.

Perhaps I’ll write another blog post about the merits of Open-shift, but for now here are the steps for migrating your Postgress data  which I hope may save some people some extra googleing.

Step 1. Get the data from heroku

$ heroku pgbackups:capture
$ curl -o latest.dump `heroku pgbackups:url --app my-app-name`

Step 2. Enable Openshift’s port forwarding

$ rhc port-forward -a my-app-name --namespace my-domain

Step 3. Export the data!

$ pg_restore --host --port 0000 --username "db-username" --dbname "-db-name" --no-password -clean no-acl -no-owner  --schema public --verbose "latest.dump"