Question

PostgresSQL deploy:migrate issue while deploying with Capistrano Rails

Hello ! I’m trying to deploy a rails 5 app with ubuntu 16.04 etc… On cap production deploy I get the following error on deploy:migrate

INFO [deploy:migrate] Run rake db:migrate DEBUG [15816e11] Running if test ! -d /home/deploy/app/releases/20170313091718; then echo “Directory does not exist ‘/home/deploy/app/releases/20170313091718’” 1>&2; false; fi as deploy@138.68.83.124 DEBUG [15816e11] Command: if test ! -d /home/deploy/app/releases/20170313091718; then echo “Directory does not exist ‘/home/deploy/app/releases/20170313091718’” 1>&2; false; fi DEBUG [15816e11] Finished in 0.306 seconds with exit status 0 (successful). INFO [64a72276] Running ~/.rvm/bin/rvm default do bundle exec rake db:migrate as deploy@138.68.83.124 DEBUG [64a72276] Command: cd /home/deploy/app/releases/20170313091718 && ( export RAILS_ENV=“production” ; ~/.rvm/bin/rvm default do bundle exec rake db:migrate ) DEBUG [64a72276] rake aborted! DEBUG [64a72276] PG::ConnectionBad: could not connect to server: Connection refused Is the server running on host “138.68.83.124” and accepting TCP/IP connections on port 5432? DEBUG [64a72276] /home/deploy/app/shared/bundle/ruby/2.4.0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `initialize’

Do you have any pointers? to make it work can’t seem to find similar issue on deployment server

note i tried this it didn’t work: https://www.digitalocean.co

All input welcomed thanks! Thanks

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

You’ve configured Rails or the apps to connect to the database via 138.68.83.124, which is failing. So are you running PostgreSQL locally? If yes (running locally), then change the configuration host to 127.0.0.1 or a socket. If no (running externally), then there’s probably a firewall blocking on the database server.

Thanks I had typed in 138 etc instead of 127… in the database.yml :/