bad gateway or gateway timeout alternatively with traefik and directus

1.7k views Asked by At

I try to run a directus container with a reverse-proxy.

First try without reverse-proxy: it works on http://my.ip:8585

version: '2'
#
# [ server stack ]
#
services:
  mysql:
    image: mariadb:latest
    container_name: directus-mrdb
    restart: always
    environment:
     - MYSQL_ROOT_PASSWORD=directus
     - MYSQL_DATABASE=directus
     - MYSQL_USER=directus
     - MYSQL_PASSWORD=directus
    # If you need to specify a persistent volume for mysql
    volumes:
      - ./data/db:/var/lib/mysql
  directus:
    depends_on:
       - mysql
    image: getdirectus/directus:6.4
    container_name: directus
    # links:
    #  - mysql:mysql
    ports:
     - 8585:8080
    restart: always
    volumes:
    # Switch between named storage, path storage
     - ./data/storage:/var/www/html/storage 
    environment:
     - MYSQL_USER=directus
     - MYSQL_PASSWORD=directus
     - MYSQL_ENV_MYSQL_DATABASE=directus
     - MYSQL_PORT_3306_TCP_ADDR=mysql
     - MYSQL_PORT_3306_TCP_PORT=3306
     - MYSQL_ENV_MYSQL_PASSWORD=directus
     - MYSQL_ENV_MYSQL_USER=directus

Second try: i get an gateway timeout error on https://admin.domain.com

version: '2'
#
# [ server stack ]
#
services:
  mysql:
    image: mariadb:latest
    container_name: directus-mrdb
    restart: always
    environment:
     - MYSQL_ROOT_PASSWORD=directus
     - MYSQL_DATABASE=directus
     - MYSQL_USER=directus
     - MYSQL_PASSWORD=directus
    # If you need to specify a persistent volume for mysql
    volumes:
      - ./data/db:/var/lib/mysql
  directus:
    depends_on:
       - mysql
    image: getdirectus/directus:6.4
    container_name: directus
    # links:
    #  - mysql:mysql
    ports:
     - 8585:8080
    restart: always
    volumes:
    # Switch between named storage, path storage
     - ./data/storage:/var/www/html/storage 
    environment:
     - MYSQL_USER=directus
     - MYSQL_PASSWORD=directus
     - MYSQL_ENV_MYSQL_DATABASE=directus
     - MYSQL_PORT_3306_TCP_ADDR=mysql
     - MYSQL_PORT_3306_TCP_PORT=3306
     - MYSQL_ENV_MYSQL_PASSWORD=directus
     - MYSQL_ENV_MYSQL_USER=directus
    labels:
     - "traefik.frontend.rule=Host:admin.domain.com"
     - "traefik.backend=admin"
     - "traefik.port=8585"
     - "traefik.frontend.entryPoints=http,https"
     - "traefik.enable=true"
     - "traefik.docker.network=config_traefik_network"

I understand because directus container is not connected with traefik container.

Third try: i get an bad gateway error on https://admin.domain.com

version: '2'
#
# [ server stack ]
#
services:
  mysql:
    image: mariadb:latest
    container_name: directus-mrdb
    restart: always
    environment:
     - MYSQL_ROOT_PASSWORD=directus
     - MYSQL_DATABASE=directus
     - MYSQL_USER=directus
     - MYSQL_PASSWORD=directus
    # If you need to specify a persistent volume for mysql
    volumes:
      - ./data/db:/var/lib/mysql
  directus:
    depends_on:
       - mysql
    image: getdirectus/directus:6.4
    container_name: directus
    # links:
    #  - mysql:mysql
    ports:
     - 8585:8080
    restart: always
    volumes:
    # Switch between named storage, path storage
     - ./data/storage:/var/www/html/storage 
    networks:
     - config_traefik_network
    environment:
     - MYSQL_USER=directus
     - MYSQL_PASSWORD=directus
     - MYSQL_ENV_MYSQL_DATABASE=directus
     - MYSQL_PORT_3306_TCP_ADDR=mysql
     - MYSQL_PORT_3306_TCP_PORT=3306
     - MYSQL_ENV_MYSQL_PASSWORD=directus
     - MYSQL_ENV_MYSQL_USER=directus
    labels:
     - "traefik.frontend.rule=Host:admin.domain.com"
     - "traefik.backend=admin"
     - "traefik.port=8585"
     - "traefik.frontend.entryPoints=http,https"
     - "traefik.enable=true"
     - "traefik.docker.network=config_traefik_network"
#
# [ networks definition ]
#
networks:
    config_traefik_network:
        external: true

I don't understand in this case. There is a connection between the container. Backend url is http://172.18.0.7:8585. The certificate seems to be well generated.

Any help will be appreciate.

Thank you in advance. jB

0

There are 0 answers