I have a docker compose file with the following LB config
`vms-portal:
ports:
- 80:80
- 801:80
- 802:80
restart: always
external_links: - vms-backend/gateway:gateway
- vms-backend/console:console
- vms-backend/idm:idm
labels:
io.rancher.loadbalancer.target.vms-backend/console: 80=80
io.rancher.loadbalancer.target.vms-backend/idm: 801=49001
io.rancher.loadbalancer.target.vms-backend/gateway: 802=49000
io.rancher.scheduler.global: 'true’
tty: true
image: rancher/load-balancer-service
stdin_open: true
`
My intent is to use inbound port to route onto a different back end service - I cant use sub-domain, and Rancher LB doesnt support URL path mapping. It almost works, the Haproxy config contains 3 ‘frontends’ and three backends, however each backend contains routes for all the hosts - see below - and I need to modify the haproxy.cfg to get it to work - again see below. Basically it includes all ports in all backends which was not my intent.
PS - What is the purpose of the 'load_balancer_config'
entry in the LB rancher-compose file ?
Original Config
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
maxpipes 1024
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults
log global
mode tcp
option tcplog
option dontlognull
option redispatch
option http-server-close
option forwardfor
retries 3
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend 64fa4c77-f37d-47a7-8d3c-9d83dfee2b2a_frontend
bind 10.42.101.210:801
mode http
default_backend 64fa4c77-f37d-47a7-8d3c-9d83dfee2b2a_1_backend
backend 64fa4c77-f37d-47a7-8d3c-9d83dfee2b2a_1_backend
mode http
balance roundrobin
server 42846e88-4e48-4cfa-b088-5fbce8c9696a 10.42.237.59:80
server c8951b1c-a5df-4c08-b6cb-a498f460c9f0 10.42.0.188:49001
server 6aa3b2fa-ae2d-4fb8-95b7-0bc743627ed3 10.42.115.248:80
frontend 7d50c1f0-b21e-4058-9a16-f4d512457289_frontend
bind 10.42.101.210:802
mode http
default_backend 7d50c1f0-b21e-4058-9a16-f4d512457289_2_backend
backend 7d50c1f0-b21e-4058-9a16-f4d512457289_2_backend
mode http
balance roundrobin
server 42846e88-4e48-4cfa-b088-5fbce8c9696a 10.42.237.59:80
server c8951b1c-a5df-4c08-b6cb-a498f460c9f0 10.42.0.188:80
server 6aa3b2fa-ae2d-4fb8-95b7-0bc743627ed3 10.42.115.248:49000
frontend 13d06aea-e46f-4a38-a28d-ea26210ab284_frontend
bind 10.42.101.210:80
mode http
default_backend 13d06aea-e46f-4a38-a28d-ea26210ab284_0_backend
backend 13d06aea-e46f-4a38-a28d-ea26210ab284_0_backend
mode http
balance roundrobin
server 42846e88-4e48-4cfa-b088-5fbce8c9696a 10.42.237.59:80
server c8951b1c-a5df-4c08-b6cb-a498f460c9f0 10.42.0.188:80
server 6aa3b2fa-ae2d-4fb8-95b7-0bc743627ed3 10.42.115.248:80
listen default 0.0.0.0:42
Modified Config - note deleted entries from backends
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
maxpipes 1024
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults
log global
mode tcp
option tcplog
option dontlognull
option redispatch
option http-server-close
option forwardfor
retries 3
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend 70c52fd3-d690-4d9f-a528-f89308303728_frontend
bind 10.42.186.58:801
mode http
default_backend 70c52fd3-d690-4d9f-a528-f89308303728_1_backend
backend 70c52fd3-d690-4d9f-a528-f89308303728_1_backend
mode http
balance roundrobin
server c8951b1c-a5df-4c08-b6cb-a498f460c9f0 10.42.0.188:49001
frontend e56f622b-7610-4221-8b3c-9e81ac355293_frontend
bind 10.42.186.58:802
mode http
default_backend e56f622b-7610-4221-8b3c-9e81ac355293_2_backend
backend e56f622b-7610-4221-8b3c-9e81ac355293_2_backend
mode http
balance roundrobin
server 6aa3b2fa-ae2d-4fb8-95b7-0bc743627ed3 10.42.115.248:49000
frontend 2e9631ff-4e62-4883-8cfb-e432dbb85927_frontend
bind 10.42.186.58:80
mode http
default_backend 2e9631ff-4e62-4883-8cfb-e432dbb85927_0_backend
backend 2e9631ff-4e62-4883-8cfb-e432dbb85927_0_backend
mode http
balance roundrobin
server 42846e88-4e48-4cfa-b088-5fbce8c9696a 10.42.237.59:80
listen default 0.0.0.0:42