mattermost-docker icon indicating copy to clipboard operation
mattermost-docker copied to clipboard

docker_app unhealthy connection timeout to psql

Open serhatcalik opened this issue 4 years ago • 4 comments

{"level":"error","ts":1619196399.6142342,"caller":"sqlstore/supplier.go:258","msg":"Failed to ping DB","error":"dial tcp 172.21.0.4:5432: i/o timeout","retrying in seconds":10}

I checked network bridge app and db container in the same network and in same subnet but somehow app can't ping SQL server

Docker -v = Docker version 20.10.5, build 55c4c88 OS = Ubuntu 20.04.2 LTS Compose = docker-compose version 1.24.0, build 0aa59064

serhatcalik avatar Apr 23 '21 16:04 serhatcalik

I get the same errors using the 5.34.2 docker image. I use a managed PSQL-instance though but have declared the following env.variables:

MM_USERNAME DB_HOST DB_PORT_NUMBER MM_DBNAME
MM_PASSWORD

Zebusch avatar Apr 29 '21 08:04 Zebusch

Stopped using PSQL I created my own dockerfile container with MySQL its working now. I still don't know what's causing this issue.

serhatcalik avatar Apr 30 '21 18:04 serhatcalik

@Chillitzel do you mind sharing this new configuration/setup? Is the latest mattermost still working with mysql/mariadb over postgresql? So we could possibly skip all this migration stuff which is not working? :)

renepardon avatar Jul 05 '21 16:07 renepardon

docker-compose.yml ->

version: "3"

services:

  app:
    build:
      context: app
      # uncomment following lines for team edition or change UID/GID
      #args:
      #   - edition=team
      #   - PUID=0
      #  - PGID=0
      #   - MM_VERSION=5.31
    restart: unless-stopped
    volumes:
      - ./volumes/app/mattermost/config:/mattermost/config:rw
      - ./volumes/app/mattermost/data:/mattermost/data:rw
      - ./volumes/app/mattermost/logs:/mattermost/logs:rw
      - ./volumes/app/mattermost/plugins:/mattermost/plugins:rw
      - ./volumes/app/mattermost/client-plugins:/mattermost/client/plugins:rw
      - /etc/localtime:/etc/localtime:ro
      # When you want to use SSO with GitLab, you have to add the cert pki chain of GitLab inside Alpine
      # to avoid Token request failed: certificate signed by unknown authority (link: https://github.com/mattermost/mattermost-server/issues/13059)
      # - <path_to_your_gitlab_pki>/pki_chain.pem:/etc/ssl/certs/pki_chain.pem:ro
    environment:
      # set same as db credentials and dbname
      - MM_USERNAME=mmuser
      - MM_PASSWORD=password
      - MM_DBNAME=mattermost
      - MM_SQLSETTINGS_DRIVERNAME=mysql
      - DB_PORT_NUMBER=3306

      # use the credentials you've set above, in the format:
      # MM_USERNAME:MM_PASSWORD@tcp(DB_HOST:DB_PORT_NUMBER)/MM_DBNAME?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s
      - MM_SQLSETTINGS_DATASOURCE="MM_USERNAME:MM_PASSWORD@some-mysql:DB_PORT_NUMBER)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"

      # in case your config is not in default location
      #- MM_CONFIG=/mattermost/config/config.json

I'm not using web system because i already have Nginx as my load balancer.

on the SQL side

docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest I used this mysql Container then I configured it. From docs you can learn it how to configure it too. https://docs.mattermost.com/install/install-ubuntu-1604-mysql.html

I hope it will help you.

serhatcalik avatar Jul 05 '21 16:07 serhatcalik