Skip to content

Instantly share code, notes, and snippets.

@lopezjurip
Created February 9, 2015 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lopezjurip/0634262b5bb070684626 to your computer and use it in GitHub Desktop.
Save lopezjurip/0634262b5bb070684626 to your computer and use it in GitHub Desktop.
Dokker + Postgres, avoiding "PG::ConnectionBad: could not connect to server: Connection refused"
# Create database, save Url for later use, let's call it <saved_url>
dokku postgresql:create <database>
# Link
dokku postgresql:link <app_name> <database>
# Check db url
dokku config <app_name> | grep DATABASE_URL
# if saved url is not equals to the last displayed, then:
dokku config:set <app_name> DATABASE_URL=<saved_url>
# Migrate
dokku run <app_name> bundle exec rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment