alroniks/docker-tao-env

Connecting to the database fails

mrft opened this issue · 6 comments

mrft commented

Having setup everything, I always keep getting the following error in the web based tao setup, while trying to connect to the database (I can go to the next step if I select 'overwrite DB if it exists', but then it fails at the last step, but I guess this is a bug in tao):

Error from server: Unable to connect to database 'taotest' at '172.18.0.2' using driver 'pdo_mysql': An exception occured in driver: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

This suggests we actually have a conncetion to the DB server, but it goes wrong while trying to authenticate.

Because I found reports of this happening in later versions of MySQL, I tried updating docker-compose.yml to use image: mysql:5.5 ( I also tried 5.6 and 5.7), to no avail.
I have also read stuff about a compatibility issue between certain MySQL versions and certain PHP versions, and a 'fix' that consisted of changing the password on mysql, but that didn't work for me.

I also tried using another version of TAO (like alroniks/tao:31RC7) but all of this didn't help.

In the 'db settings page' during tao setup in the browser I also tried to put the IP-address (172.18.0.x) instead of "dbs", but I keep running into the same error.

So I am kind of stuck. (Since docker containers should work the same no matter where they are run, I kind of hoped this would be a painless experience, but so far I didn't get any further.) I am also surprised that you wouldn't have this issue yourself, if I am using the same docker images, one would expect the same behaviour...

I am not sure if this is a bug in this project, it could also have to do with the tao docker container or even with the tao project itself, but I thought I'd put it here first. Maybe you've run into similar issues in the past and know what's actually causing this?

mrft commented

I got around this issue by using postgres.
(I don't like mysql anyway)

Feel free to check out my fork (I made a few changes to separate better between this repo and the 'runtime' files that are added after running make init and and make up): https://github.com/mrft/docker-tao-env

@mrft - Tried your fork, but getting an error...

user@domain:~$ git clone https://github.com/mrft/docker-tao-env taodoc
Cloning into 'taodoc'...
remote: Counting objects: 63, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 63 (delta 2), reused 8 (delta 2), pack-reused 53
Unpacking objects: 100% (63/63), done.

user@domain:~$ cd taodoc/

user@domain:~/taodoc$ sudo make init
chmod +x init.sh && ./init.sh 80

user@domain:~/taodoc$ sudo make up
docker-compose up -d
WARNING: The NGINX_PORT variable is not set. Defaulting to a blank string.
WARNING: The PROJECT_NAME variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.web.ports is invalid: Port ranges don't match in length
Makefile:8: recipe for target 'up' failed
make: *** [up] Error 1

No means to open an issue there.

Ah, I didnt realize the .env.template needed to be cp .env.template .env and edited to suit before trying sudo make up

Now getting...

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/tao/install/class.Installator.php at line 388

...on final ("Finalize Installation") web install screen after hitting "Install".

Just realized, you changed the name of the container for the db to "postgres", thinking that was what was needed for "host" I used that instead of "dbs".

At the final screen, I now get...

SQLSTATE[HY000] [2002] Connection refused in /var/www/html/tao/install/class.Installator.php at line 388

So, with the solution offered here, I was able to get docker-compose up working.

Prepending mapped paths with '/merged' to reflect the actual filesystem was the key to getting your repo working (somewhat) on Windows (10 Pro)

Trying to view the website now merely yields the default nginx page, unfortunately.