Capistrano postgresql: FATAL: Peer authentication error for user

This is my first time deploying an application in the digital ocean and is facing two (maybe more) problems.

1) I cannot bundle install after adding gem 'unicorn' to the Gemfile. I found that kgio is not compatible with windows. Should I have Gemfile.lock when deploying via capistrano? How do I solve this problem?

 group :production do gem 'pg', '0.14.1' gem "nginx" gem 'unicorn' end 

2) I am having problems with authentication on postgresql on the server.

 production: adapter: postgresql encoding: unicode database: postgresql pool: 5 username: postgresql password: secret 

I executed these commands (along with some other options):

 create user postgresql with password 'secret'; create database postgresql with owner postgresql; 

Every time I close the deployment, I get this error:

 FATAL: Peer authentication failed for user "postgresql" 

I tried to put an invalid username that I know does not exist, an invalid database, but the error message is always the same. According to postgresql website, I should get different errors for those who ...

If I can get any help, it will be awesome. Thanks!

+4
source share
2 answers

You need to specify a host for password authentication.

 production: adapter: postgresql encoding: unicode database: postgresql pool: 5 host: localhost username: postgresql password: secret 

More here

+7
source

First you must configure Postgres for password or md5 authentication . You usually do this in the pg_hba.conf .

As long as only authentication or peer verification is allowed, the password will not help you. You can only log in as the db user corresponding to your system user.

BTW, the user is usually called postgres , not postgresql, this is not a typo, is it?

You can try in the shell:

 sudo su - postgres 

And then log in as postgres db user, which will be authorized automatically if my assumption is fulfilled.

More details here:
PostgreSQL error: Fatal: role "username" does not exist
Run batch file with psql command without password

+1
source

Source: https://habr.com/ru/post/1493049/


All Articles