manala / manalize

Provides ready-to-use environments for various projects through manala ansible roles
http://www.manala.io
MIT License
36 stars 2 forks source link

Unable to connect to database when initializing a postgresql server #125

Open Dreeckan opened 7 years ago

Dreeckan commented 7 years ago

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 !

chalasr commented 7 years ago

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

What version of postgesql are you using?

Dreeckan commented 7 years ago

You're very welcome :) .

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

nervo commented 7 years ago

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 ?

Dreeckan commented 7 years ago

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 commented 7 years ago

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

chalasr commented 7 years ago

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 commented 7 years ago

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

nervo commented 7 years ago

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

Dreeckan commented 7 years ago

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 commented 7 years ago

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

nervo commented 7 years ago

@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)

chalasr commented 7 years ago

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

Dreeckan commented 7 years ago

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

hyvs commented 6 years ago

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

chalasr commented 6 years ago

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