Mattermost, Inc.

Dev setup fail - Failed to ping db err:driver: bad connection

I’m trying to set up a local development environment and am getting stuck with database issues. Any help is appreciated.

Running OS X 10.11
Gotten through the setup instructions but when I run make run I get the following:

ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
make: *** [start-docker] Error 255

When I try make clean-docker, then make start-docker, then make run-server, I get this:

[2016/11/16 06:38:42 EST] [INFO] Server is initializing...
[2016/11/16 06:38:42 EST] [INFO] Pinging sql master database
[MySQL] 2016/11/16 06:38:42 packets.go:32: EOF
[2016/11/16 06:38:42 EST] [CRIT] Failed to ping db err:driver: bad connection
exit status 102

docker ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2066b033613e mattermost/webrtc:latest “/bin/sh -c /opt/janu” 12 minutes ago Up 11 minutes 0.0.0.0:7088-7089->7088-7089/tcp, 0.0.0.0:8188-8189->8188-8189/tcp mattermost-webrtc
3c46780a03ef osixia/openldap:1.1.6 “/container/tool/run” 15 minutes ago Up 15 minutes 0.0.0.0:389->389/tcp, 0.0.0.0:636->636/tcp mattermost-openldap
295feb9e3957 postgres:9.4 “/docker-entrypoint.s” 15 minutes ago Up 15 minutes 0.0.0.0:5432->5432/tcp mattermost-postgres
9bc309abd2a2 mysql:5.7 “docker-entrypoint.sh” 16 minutes ago Up 15 minutes 0.0.0.0:3306->3306/tcp mattermost-mysql

Any ideas?

Hi @fraziern,

Are you running Docker for Mac or Docker Toolbox? Depending on which you’re using, you’ll need to map dockerhost to a different address in /etc/hosts.

  • If you’re using Docker for Mac, the first two steps of the latest dev setup instructions cover what you need to do
  • If you’re on using Docker Toolbox, you’ll need to:
    1. Find out what IP address docker-machine is running on using docker-machine ip dev
    2. Add <DOCKER_IP> dockerhost to your /etc/hosts file.

Thanks @hmhealey - I am using Docker for Mac, and had setup /etc/hosts previously. I seem to be up and running now, though, after running make run several times in a row. Not sure what the issue is/was, but for now I’m good. Thanks again.

@fraziern, thanks for posting back! I’ll mark this issue solved for now but if you run into problems again, please feel free to post back.

I have the same issue, but on a linux debian machine.
I ran into the problem when I first ran make run, but I managed to get passed it without really knowing how. I did a make stop and now I’m running into the issue and I can’t manage to get around it.

EDIT:
Oh, I forgot that, in the meantime, I had an issue with a dead container and I tried this, which solved this problem but might be at the root the de bad driver problem.
http://stackoverflow.com/questions/30794108/docker-cannot-remove-dead-container

The only thing I found to solve the problem is rebooting my computer…

OK, I think I found a way to reproduce the issue.

make run (or run-server) while mySQL/postgreSQL services are running.
After that, even if you stop the services, make stop and make clean-docker, the issue will alway reproduce until a system reboot.

1 Like

I’m getting the same issue. make nuke does not properly stop the databases.

Can we mark this as unsolved?
unless restarting is a viable solution

in the meantime I’ll restrict myself to only using make stop.

Another stop gap is to restart docker. So,
-> make stop
-> restart docker

-> make run

Hi @morenoh149,

I’ve edited the issue to be “unsolved”… Could you help to give me a suitable updated title for the issue or does it remain as is?

Once we know the exact issue, it’ll be easier for someone to help with a solution.

Thanks!