Connect to db container using database editor

Hi everyone. I'm new to Traefik but so far pretty happy with the results. I'm trying to set up a new development environment with docker. I have 5 different interconnecting apps that I need to run simultaneously and thus I'm using Traefik to manage the requests. I managed to get Traefik up and running (dashboard and everything is working) and the first app also works perfectly using HTTP (HTTPS still WIP). However, I can't connect my native OS database editor (Sequel Pro in my case) to my mysql container. I found this issue on this forum but sadly it's not working out for me.

traefic.yml

entryPoints:
  http:
    address: ":80"
  https:
    address: ":443"
  mysql:
    address: ":3306"
  dashboard:
    address: ":8080"
api:
  dashboard: true
  debug: true
providers:
  docker:
    exposedByDefault: false
    network: gateway
  file:
    filename: dynamic_conf.yml
    watch: true
accessLog: {}

dynamic_conf.yml

http:
  routers:
    my-api:
      entryPoints:
        # Expose on :8080 aka 'dashboard'
        - dashboard
      # Activate this Router if Client asks for '/dashboard' or '/api'
      rule: "PathPrefix(`/dashboard`) || PathPrefix(`/api`)"
      # Expose the API
      service: api@internal
      # Use basic auth Middleware define below
    my-secure-api:
      entryPoints:
        # Expose via https
        - https
      # Activate this Router if Client requests specific subdomain and '/dashboard' or '/api'
      rule: "Host(`traefik.develop`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
      service: api@internal
      tls:
        # Use ACME HTTP Challgen defined in 'traefik.yml' to get valid cert
        certResolver: myhttpchallenge
    # Catch all global Router for redirects
    https-redirect:
      entryPoints:
        - http
      # Activate this Router on any Host requested
      rule: "hostregexp(`{host:.+}`)"
      # A service definition is mandatory that's why we use a dummy service define at the bottom
      service: dummy
      middlewares:
        - redirect-to-https
    redirect-to-https:
      redirectScheme:
        scheme: https
        permanent: true
  services:
    dummy:
      loadBalancer:
        servers:
          - url: localhost

Traefik docker-compose.yml

version: "3"
services:
  traefik:
    image: traefik
    container_name: global_traefik
    restart: "always"
    ports:
      # Port 80 is used for HTTP traffic
      - "80:80"
      # Port 443 is used for HTTPS traffic
      - "443:443"
      # Port 3306 is used for MySQL traffic
      - "3306:3306"
      # Port 8080 is used for traefik's own dashboard
      - "8080:8080"
    volumes:
      # Here is the mount of the traefik config
      - ./traefik.yml:/etc/traefik/traefik.yml:ro
      # Here is the mount of the local ~/ssl directory
      - ~/docker/ssl:/etc/traefik/ssl:ro
      # The docker socket is mounted for auto-discovery of new services
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      # Attach the traefik container to the default network (which is the global "gateway" network)
      - default
    labels:
      # Super important!
      - "traefik.enable=true"
      # HTTP to HTTPS redirection
      - "traefik.http.routers.http_catchall.rule=HostRegexp(`{any:.+}`)"
      - "traefik.http.routers.http_catchall.entrypoints=http"
      - "traefik.http.routers.http_catchall.middlewares=https_redirect"
      - "traefik.http.middlewares.https_redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.https_redirect.redirectscheme.permanent=true"
      # Traefik dashboard
      - "traefik.http.routers.traefik.rule=Host(`traefik.develop`)"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.service=api@internal"
# Make the externally created network "gateway" available as network "default"
networks:
  default:
    external:
      name: gateway

App docker-compose.yml

version: '3'
services:
  nginx:
    container_name: my_app_nginx
    build: docker/nginx
    links:
      - php
    volumes:
      - ./:/app
    restart: "always"
    labels:
      - "traefik.enable=true"
      # CRM HTTP Router
      - "traefik.http.routers.my_app.entrypoints=http"
      - "traefik.http.routers.my_app.rule=Host(`my-app.develop`, `www.my-app.develop`)"
      # CRM HTTPS Router
      - "traefik.http.routers.my_app-secure.tls=true"
      - "traefik.http.routers.my_app-secure.service=crm"
      - "traefik.http.services.my_app.loadbalancer.server.port=80"
      - "traefik.docker.network=gateway"
    networks:
      - default
      - my_app
  php:
    container_name: my_app_php
    build: docker/php
    links:
      - db
    volumes:
      - ./:/app
    working_dir: /app
    restart: "always"
    networks:
      - my_app
  db:
    container_name: my_app_db
    image: mariadb
    volumes:
      - ./tests/_data/functional-dump.sql:/docker-entrypoint-initdb.d/data.sql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: admin
      MYSQL_USER: admin
      MYSQL_PASSWORD: admin
      DNSDOCK_ALIAS: mysql.my_app.develop
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=gateway"
      - "traefik.tcp.routers.db.rule=HostSNI(`mysql.my_app.develop`)"
      - "traefik.tcp.routers.db.entrypoints=mysql"
      - "traefik.tcp.services.db.loadbalancer.server.port=3306"
    restart: "always"
    networks:
      - my_app
networks:
  default:
    external:
      name: gateway
  my_app:
    internal: true

Before Traefik, when I only had one app running at any one time, I could simply use my-app.develop and my mysql credentials to log in to the container using Sequel Pro. Right now, I just get a timeout. I also tried to use the IP of the vagrant box or the container alias as host name, but that also doesn't work.

Can someone tell me what I'm doing wrong? Any help is greatly appreciated. FYI: as I mentioned, I'm new at Traefik and I've been at this for hours now, pasting things together from various posts and tutotials. If I'm making mistakes or if my setup can be improved, I'd love to hear more.

Thanks in advance

Hi,
i had the same problem, some weeks ago.
You can check this post Access to mysql containers

Hi @mbrioski Thanks for your reply. I was already aware of your issue, I even linked it in my original post. Sadly, I it doesn't work for me. I still get the same error