Can't get port forwarding working (if that's what it's called)

Hi,
I've spent days trying to get a very basic flask (python) app running with minimal success. I used the code in the post "Traefik v2.0 does not work for me with any other port other than 80" to get traefik WebUI on a subdomain, which now works great but using the same code on gunicorn is unsuccessful. I have no idea where I am going wrong so any help would be greatly appreciated.
PS. I tried changing the gunicorn command to use port 80 instead but that was also unsuccessful.

I also seem to have broken the logging also, it was working at on point and now it's not... ???

# Traefik Docker Stack
version: "3.7"

services:

  traefik:
    image: "traefik:v2.0.0-rc3"
    command:
      - "--log.level=DEBUG" # DEBUG, ERROR
      - "--log.filePath=/traefik.log"
      - "--log.format=json"
      # [rc3 dashboard security] (https://community.containo.us/t/no-dashboard-with-2-0-0-rc3/1560/2)
      - "--api=true"
      - "--api.dashboard=true"
      - "--api.insecure=true"
      
      #- "--api.debug=true"  
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik-public"
      - "traefik.http.routers.traefik.rule=Host(`traefik.mywebsite.com`)"
      - "traefik.http.routers.traefik.entrypoints=web"
      - "traefik.http.routers.traefik.service=api@internal" # needed for API security from rc3
      - "traefik.http.routers.traefik.service=traefik_service"
      - "traefik.http.services.traefik_service.loadbalancer.server.port=8080"
    ports:
      # The HTTP ports
      - "80:80"
      # The Web UI (enabled by --api)
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - ./logs/traefik.log:/traefik.log
    networks:
      - traefik
      
networks:
  traefik:
    driver: overlay
    name: traefik-public
# Flask Docker Stack
version: "3.7"

services:
      
  pjryan126:
    image: "registry.gitlab.com/mindgonemad/swarm-sites/pjryan126/flask"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik-public"
      - "traefik.http.routers.pjryan126.rule=Host(`pjryan126.mywebsite.com`)"
      - "traefik.http.routers.pjryan126.entrypoints=web"
      - "traefik.http.routers.pjryan126.service=pjryan126_service"
      #- "traefik.http.services.pjryan126_service.loadbalancer.server.port=80"
      - "traefik.http.services.pjryan126_service.loadbalancer.server.port=5000"
    ports:
      - "5000:5000"
    #expose:
    #  - "5000"
    #command: /usr/local/bin/gunicorn -w 2 -b :80 wsgi:app
    command: /usr/local/bin/gunicorn -w 2 -b :5000 wsgi:app
      
networks:
  traefik:
    driver: overlay
    name: traefik-public

Hello,

You have to fix the traefik docker-compose file:

# Traefik Docker Stack
version: "3.7"

services:

  traefik:
    image: "traefik:v2.0.0-rc3"
    command:
      - "--log.level=DEBUG" # DEBUG, ERROR
      - "--log.filePath=/traefik.log"
      - "--log.format=json"
      # [rc3 dashboard security] (https://community.containo.us/t/no-dashboard-with-2-0-0-rc3/1560/2)
      - "--api=true" 
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik-public"
      - "traefik.http.routers.traefik.rule=Host(`traefik.mywebsite.com`)"
      - "traefik.http.routers.traefik.entrypoints=web"
      - "traefik.http.routers.traefik.service=api@internal" # needed for API security from rc3
      - "traefik.http.services.traefik.loadbalancer.server.port=8080" # ONLY FOR SWARM
    ports:
      # The HTTP ports
      - "80:80"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - ./logs/traefik.log:/traefik.log
    networks:
      - traefik
      
networks:
  traefik:
    driver: overlay
    name: traefik-public

Could you provide a reproducible sample, because registry.gitlab.com/mindgonemad/swarm-sites/pjryan126/flask is private.

Thanks Idez, finally got it to work though took way too long. I must say, trying to figure Traefik out with next to no experience and choosing to use a beta version without complete documentation and tutorials has been a nightmare (self inflicted of course :grin:).

Turned out to all be networking, so once I changed the 'networks:' to use the same id as the 'name:' property (and everywhere that was used through the file) on both stacks and changed the second stack to use external and 'name:' property it finally worked.

Posting working code below in case it helps anybody else as naive as me.

Traefik stack:

version: "3.7"

services:

  traefik:
    image: "traefik:v2.0.0-rc3"
    command:
      - "--log.level=DEBUG" # DEBUG, ERROR
      - "--log.filePath=/traefik.log"
      - "--log.format=json"
      # [rc3 dashboard security] (https://community.containo.us/t/no-dashboard-with-2-0-0-rc3/1560/2)
      - "--api=true"
      - "--api.dashboard=true"
      - "--api.insecure=true"
      #- "--api.debug=true"  
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik-public"
      - "traefik.http.routers.traefik.rule=Host(`traefik.mywebsite.com`)"
      - "traefik.http.routers.traefik.entrypoints=web"
      - "traefik.http.routers.traefik.service=api@internal" # needed for API security from rc3
      - "traefik.http.services.traefik.loadbalancer.server.port=8080"
    ports:
      - "80:80"
      #- "8080:8080" # The Web UI (enabled by --api) - Disabled as using subdomain (traefik.)
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - ./logs/traefik.log:/traefik.log
    networks:
      - traefik-public
      
networks:
  traefik-public:
    driver: overlay
    name: traefik-public

Flask app:

version: "3.7"

services:
      
  pjryan126:
    image: "registry.gitlab.com/mindgonemad/swarm-sites/pjryan126/flask"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik-public"
      - "traefik.http.routers.pjryan126.rule=Host(`pjryan126.mywebsite.com`)"
      - "traefik.http.routers.pjryan126.entrypoints=web"
      - "traefik.http.services.pjryan126.loadbalancer.server.port=5000"
    networks:
      - traefik-public
    command: /usr/local/bin/gunicorn -w 2 -b :5000 wsgi:app
      
networks:
  traefik-public:
    external: true
    name: traefik-public