0

So i've been trying to deploy my app to production using capistrano, but getting this error. i have changed my postgres configuration from peer to md5. i manually created the db job_portal production in psql and added the details to database.yml file. i have tried many things but nothing seems to work, could i get some help?

database.yml test: <<: *default database: job_portal_test host: localhost port: 5432 username: elrich_3 password: 12345 production: <<: *default database: job_portal_production host: localhost port: 5432 username: elr_4 password: 12345

pg_hba.conf

`

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5

` ERROR IMAGE

  • Does this answer your question? [PostgreSQL: FATAL - Peer authentication failed for user (PG::ConnectionBad)](https://stackoverflow.com/questions/15306770/postgresql-fatal-peer-authentication-failed-for-user-pgconnectionbad) – Karoid Apr 21 '20 at 15:01
  • yes i restarted the server @jjanes – elrich rodrigues Apr 21 '20 at 17:49
  • it works when i run psql -d -U -h in psql, but get erroe while deploying @SeoungHoJeoung – elrich rodrigues Apr 21 '20 at 17:58
  • peer authentication is only possible over unix-domain sockets ("local" lines from pg_hba), while `host: localhost` should not be using those. I don't see how to explain this, other than that your `database.yml` you show is not the one being used. – jjanes Apr 21 '20 at 18:19
  • I'm not getting how is it not selecting the db i have specified in database.yml file @jjanes – elrich rodrigues Apr 27 '20 at 17:03

0 Answers0