I'd like to create a haproxy-like roundrobin loadbalancing with traefik. I have the following infrastrucute:
Server_1: It has traefik hosted on it (in docker container) working in an bridged network (called 'ext) and exposed ports 80 and 443. I have apache service working on it in docker container in the same 'ext' network with no ports exposed (as it's communicating with traefik over the bridged docker network).
Server_2: It has an apache service running in a docker container with port 8080 exposed.
I want to accomplish haproxy-like roundrobin loadbalancing between the two services while keeping it as simple as possible. I'm trying to accomplish this with a simple docker-compose file that looks like this:
version: '3.9'
services:
apache:
image: httpd:latest
container_name: apache
networks:
- ext
volumes:
- /home/user1/apache/app:/usr/local/apache2/htdocs
labels:
- "traefik.enable=true"
- "traefik.http.routers.apache-lb0.rule=Host(`apache.mywebsite.com`)"
- "traefik.http.routers.apache-lb0.service=apache"
- "traefik.http.routers.apache-lb0.entrypoints=http"
- "traefik.http.services.apache-lb0.loadbalancer.server.port=80"
- "traefik.http.services.apache-lb0.loadbalancer.server.scheme=h2c"
- "traefik.http.routers.apache-lb1.rule=Host(`apache.mywebsite.com`)"
- "traefik.http.routers.apache-lb1.service=apache"
- "traefik.http.services.apache-lb1.loadbalancer.server.url=http://10.0.0.205:8080"
- "traefik.docker.network=ext"
networks:
external:
ext: true
Traefik doesn't return any error, but it only serves content from my local server (Server_1 - the one that has traefik and apache on it).
What am I doing wrong here?