Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

docker_app unhealthy connection timeout to psql #533

Open
serhatcalik opened this issue Apr 23, 2021 · 4 comments
Open

docker_app unhealthy connection timeout to psql #533

serhatcalik opened this issue Apr 23, 2021 · 4 comments

Comments

@serhatcalik
Copy link

{"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

@Zebusch
Copy link

Zebusch commented Apr 29, 2021

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

@serhatcalik
Copy link
Author

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

@renepardon
Copy link

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

@serhatcalik
Copy link
Author

serhatcalik commented Jul 5, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants