Search code examples
dockerdocker-swarmtraefik

Traefik 2.0 gate way timeouts


Created a simple Traefik instance with 2 services, only by http. I'm getting Gateway timeout in both instances, this is my only file where I created my services and traefik proxy.

version: '3.4'

services:
  reverse-proxy:
    image: traefik:2.0 # The official Traefik docker image
    ports:
      - "80:80"     # The HTTP port
      - "10553:8080"    # The Web UI (enabled by --api)
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
    networks:
      - default
    command:
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.network=demo_swarm_network"
      - "--providers.docker.exposedbydefault=false"      
      - "--providers.docker.swarmMode=true"
      - "--entrypoints.web.address=:80"
    deploy:
      mode: global
      placement:
        constraints:
          - node.role == manager
      update_config:
        parallelism: 1
        delay: 10s
      restart_policy:
        condition: on-failure  
  xxxxx-authentication-api:
    image: xxxx_authentication_api_nightly:9999
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.docker.lbswarm=true"
        - "traefik.docker.network=demo_swarm_network"
        - "traefik.http.routers.authenticationapi.rule=PathPrefix(`/api/authentication`)"
        - "traefik.http.routers.authenticationapi.entrypoints=web"        
        - "traefik.http.services.xxxxx-authentication-api.loadbalancer.server.port=3000"
        - "traefik.http.services.xxxxx-authentication-api.loadbalancer.server.scheme=http"
      replicas: 1
      update_config:
        parallelism: 1
        delay: 10s
        order: stop-first
    command: node ./server.js
    environment:
      - NODE_ENV=authentication 
      - LOG_LEVEL=info 
      - NODE_CONFIG_DIR=./config
    networks:
      - default
    ports:
      - "3000"
  xxxxx-authentication-app:
    image: xxxxx_authentication_app_nightly:9999
    deploy:
      labels:
        - "traefik.enable=true"       
        - "traefik.docker.lbswarm=true"
        - "traefik.docker.network=demo_swarm_network"
        - "traefik.http.routers.authenticationapp.rule=PathPrefix(`/authentication`)"    
        - "traefik.http.routers.authenticationapp.entrypoints=web"
        - "traefik.http.services.xxxxx-authentication-app.loadbalancer.server.port=80"
        - "traefik.http.services.xxxxx-authentication-app.loadbalancer.server.scheme=http"
      replicas: 1
      update_config:
        parallelism: 1
        delay: 10s
        order: stop-first
    networks:
      - default
    ports:
      - "80"
networks:
  default:
    external:
      name: demo_swarm_network

The services are up and running, are so are the containers. Traefik is also running, just when I try to localhost:80/api/authentication or localhost:80/authentication I get gateway timeout.

Where is traefik sending my requests ? I've confirmed in the host ports, that the apps in both endpoints are running.

What's missing in my configuration ?


Solution

  • Huzzah! The timeouts disapeared when I updated the demo_swarm_network network to have overlay.