Hi @Twisterking,
Thanks for your interest in Traefik!
First, you have mixed Traefik v1 and v2 configuration in the entrypoint
configuration. The Traefik container configuration should look like the following (I've also removed some unnecessary configurations).
Is it normal that there is no entrypoint
attached to port 443
?
traefik:
image: traefik:v2.3
container_name: traefik
networks:
- frontend
- backend
command:
- --entrypoints.web.address=:80
- --providers.docker.network=backend
- --providers.docker.exposedbydefault=false
- --api.insecure=true
- --accesslog.filepath=/var/log/traefik_access.log
- --log.filepath=/var/log/traefik.log
- --log.level=DEBUG
ports:
- 80:80
- 8080:8080
- 443:443
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- loadbalancerdata:/data
deploy:
restart_policy:
condition: on-failure
Then, if you want to load balance all the incoming traffic on port 80 (web)
to your app containers you will have to configure the same router
and service
on your apps. Something like:
app-test-1:
build:
context: /opt/my-app
dockerfile: ~/scripts/docker/Dockerfile
image: myapp:build1
container_name: app-test-1
networks:
- backend
environment:
- PORT=3000
- METEOR_SETTINGS
ports:
- 3000:3000
labels:
- traefik.enable=true
- traefik.docker.network=backend
- traefik.http.routers.app-test.rule=Host(`test.mydomain.com`)
- traefik.http.routers.app-test.entrypoints=web
- traefik.http.services.app-test.loadbalancer.server.port=3000
- traefik.http.services.app-test.loadbalancer.sticky=true
app-test-2:
build:
context: /opt/my-app
dockerfile: ~/scripts/docker/Dockerfile
image: myapp:build1
container_name: app-test-2
networks:
- backend
environment:
- PORT=3002
- METEOR_SETTINGS
ports:
- 3002:3002
labels:
- traefik.enable=true
- traefik.docker.network=backend
- traefik.http.routers.app-test.rule=Host(`test.mydomain.com`)
- traefik.http.routers.app-test.entrypoints=web
- traefik.http.services.app-test.loadbalancer.server.port=3002
- traefik.http.services.app-test.loadbalancer.sticky=true
As a side note, if your apps are the same maybe you could look at the docker-compose scale option. By doing that, you will have to configure your app router
and service
only once and leverage docker-compose to scale your service.
Hope this helps!