docker override port, host, backend
reuse loadbalancer
This commit is contained in:
parent
0af872e661
commit
730fbfe9c5
5 changed files with 76 additions and 45 deletions
29
docker.tmpl
29
docker.tmpl
|
@ -1,25 +1,12 @@
|
|||
[backends]{{range .Containers}}
|
||||
[backends.backend-{{.Config.Hostname}}]
|
||||
[backends.backend-{{.Config.Hostname}}.servers.server-{{.Config.Hostname}}]
|
||||
|
||||
{{/* Only one exposed port! */}}
|
||||
{{if eq (len .Config.ExposedPorts) 1}}
|
||||
{{$ip := .NetworkSettings.IPAddress}}
|
||||
{{range $keyPort, $valuePort := .Config.ExposedPorts}}
|
||||
url = "http://{{$ip}}:{{$keyPort.Port}}"
|
||||
{{end}}
|
||||
{{else}}
|
||||
|
||||
{{end}}
|
||||
[backends.backend-{{getBackend .}}.servers.server-{{.Name | replace "/"}}]
|
||||
url = "http://{{.NetworkSettings.IPAddress}}:{{getPort .}}"
|
||||
{{end}}
|
||||
|
||||
[routes]{{range .Containers}}
|
||||
[routes.route-{{.Config.Hostname}}]
|
||||
backends = ["backend-{{.Config.Hostname}}"]
|
||||
[routes.route-{{.Config.Hostname}}.rules.rule-{{.Config.Hostname}}-hostname]
|
||||
[routes]{{range $host, $containers := .Hosts}}
|
||||
[routes.route-{{$host}}]
|
||||
backends = [{{range $container := $containers}}"backend-{{getBackend $container}}",{{end}}]
|
||||
[routes.route-{{$host}}.rules.rule-host-{{$host}}]
|
||||
category = "Host"
|
||||
value = "{{.Config.Hostname}}.zenika.fr"
|
||||
[routes.route-{{.Config.Hostname}}.rules.rule-{{.Config.Hostname}}-name]
|
||||
category = "Host"
|
||||
value = "{{.Name | replace "/"}}.zenika.fr"
|
||||
{{end}}
|
||||
value = "{{$host}}.zenika.fr"
|
||||
{{end}}
|
Loading…
Add table
Add a link
Reference in a new issue