Hi.
I’m trying to create a stack for a “universal” load balancer for all the services in my env: elastic, rabbit, my webapps etc.
Since I want to be able to use custom stacks names of all the services ad deploy time, I’m adding a set of option blocks to the balancer’s rancher-compose.
Then I need to bring these stack/service combinations in the docker-compose’s labels dedicated to the balancers, e.g.:
I am also trying to automate the creation of a load-balancer for my project but: I am not even able to use a rancher-compose variable with external links. This is what I am trying to accomplish:
lb:
ports:
- 80:80
image: rancher/load-balancer-service
external_links:
- {$stack_1}/{$service_1}:{$service_1}
# - {$stack_2}/{$service_2}:{$service_2}
# - {$stack_3}/{$service_3}:{$service_3}
# - {$stack_4}/{$service_4}:{$service_4}
# - {$stack_5}/{$service_5}:{$service_5}
labels:
# Put load balancer containers only on hosts without label availability=temporal
io.rancher.scheduler.affinity:host_label_ne: availability=temporal
# Requests to http://app.example.com/foo:80 should be routed to web1 over port 8000
io.rancher.loadbalancer.target.{$stack_1}/{$service_1}: {$subdomain_1}.{$hostname}:80={$port_1}
# io.rancher.loadbalancer.target.{$stack_2}/{$service_2}: {$subdomain_2}.{$hostname}:80={$port_2}
# io.rancher.loadbalancer.target.{$stack_3}/{$service_3}: {$subdomain_3}.{$hostname}:80={$port_3}
# io.rancher.loadbalancer.target.{$stack_4}/{$service_4}: {$subdomain_4}.{$hostname}:80={$port_4}
# io.rancher.loadbalancer.target.{$stack_5}/{$service_5}: {$subdomain_5}.{$hostname}:80={$port_5}