manalize icon indicating copy to clipboard operation
manalize copied to clipboard

Unable to connect to database when initializing a postgresql server

Open Dreeckan opened this issue 8 years ago • 15 comments

Hello everyone ! First of all, thanks for this great project, it helps a lot ! ^^

I have an error when initializing a new Symfony (v3.3) project and using manalize. I just download Symfony (using Symfony's command line) and tried to use manalize.

The error :

TASK [manala.postgresql : roles > Handle] **************************************
failed: [localhost] (item={u'attributes': [u'SUPERUSER'], u'password': None, u'role': u'app'}) => {"failed": true, "item": {"attributes": ["SUPERUSER"], "password": null, "role": "app"}, "msg": "unable to connect to database: fe_sendauth: no password supplied\n"}

Do I have to create it myself inside the vagrant ? Or do I need anything before starting you command ?

Thanks !

Dreeckan avatar Sep 07 '17 14:09 Dreeckan

Hey. Thanks for the feedback, very pleased to read that.

What version of postgesql are you using?

chalasr avatar Sep 08 '17 12:09 chalasr

You're very welcome :) .

I need to use version 9.5 of postgresql (as on my current production server ;) )

Dreeckan avatar Sep 08 '17 12:09 Dreeckan

I'm afraid we still don't have tests for postgresql 9.5, only for 9.4: https://github.com/manala/ansible-roles/blob/master/manala.postgresql/tests/0100_install.yml

Could you try with 9.4 ?

nervo avatar Sep 08 '17 21:09 nervo

Hello :) .

I just tried with postgresql 9.4 and yes, it works, until this appends :

> symfony-scripts: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget

                                                                             
  [Doctrine\DBAL\Exception\ConnectionException]                              
  An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused  
                                                                             

                                             
  [Doctrine\DBAL\Driver\PDOException]        
  SQLSTATE[HY000] [2002] Connection refused  
                                             

                                             
  [PDOException]                             
  SQLSTATE[HY000] [2002] Connection refused  
                                             

doctrine:database:create [--shard SHARD] [--connection [CONNECTION]] [--if-not-exists] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

Makefile:66: recipe for target 'install' failed

I guess I just have to create my db by hand and re-start the make install command ;) .

By the way : if version 9.5 is not tested, how about stay in 9.4 by default ?

Dreeckan avatar Sep 11 '17 08:09 Dreeckan

Erratum : Database is created, but I still can't connect to the database.

Dreeckan avatar Sep 11 '17 08:09 Dreeckan

Do you have app as username and no password in your doctrine config? That should be the default pgsql credentials. Be sure that the driver is set to pdo_pgsql and that the port is either null or 5432 also.

chalasr avatar Sep 11 '17 08:09 chalasr

By the way : if version 9.5 is not tested, how about stay in 9.4 by default ?

Yea, even remove 9.5 from the alternatives until it's not fully supported I'd say

chalasr avatar Sep 11 '17 08:09 chalasr

I've just add an issue: https://github.com/manala/ansible-roles/issues/40 @Dreeckan could you confirm your doctrine parameters ?

nervo avatar Sep 11 '17 09:09 nervo

Ok, I completely forgot to update the driver parameter in config.yml -_-... Thanks for pointing that out ;) .

Parameters.yml :

parameters:
    database_host: 127.0.0.1
    database_port: 5432
    database_name: app
    database_user: app
    database_password: null
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    secret: 2088e948c33d10e100a0f9c372ac7f992530d121

Dreeckan avatar Sep 11 '17 09:09 Dreeckan

Thanks @nervo ! Do you need me to comment on that new issue with more details about the problem ?

Dreeckan avatar Sep 11 '17 09:09 Dreeckan

@Dreeckan fyi you can leave the database_port parameter to null, it will be defaulted to 5432 And yes, if you can provide the ansible logs in the issue, that would help :) (only the "manala.postgresql" parts)

nervo avatar Sep 11 '17 10:09 nervo

Unless I'm mistaken we're done for this one.

chalasr avatar Sep 12 '17 08:09 chalasr

Hello again ! I had to install the project on a second machine, and I'm afraid to tell you I have now the same problem with postgresql 9.4.

So no, I'm afraid you're not done with me, yet ;) . I'll send the ansible logs tomorrow

Dreeckan avatar Sep 12 '17 15:09 Dreeckan

Related issue : https://github.com/manala/ansible-roles/issues/123

hyvs avatar Dec 01 '17 08:12 hyvs

@Dreeckan we just released a fix, can you retry using the role in its latest version and confirm it fixes your issue?

chalasr avatar Dec 01 '17 14:12 chalasr