2016-04-12 07:49:37 +00:00
|
|
|
[backends]
|
2016-04-15 07:56:06 +00:00
|
|
|
{{range $index, $node := .Nodes}}
|
|
|
|
{{if ne (getAttribute "enable" $node.Service.Tags "true") "false"}}
|
2016-06-22 20:43:20 +00:00
|
|
|
[backends."backend-{{getBackend $node}}".servers."{{getBackendName $node $index}}"]
|
2016-04-15 07:56:06 +00:00
|
|
|
url = "{{getAttribute "protocol" $node.Service.Tags "http"}}://{{getBackendAddress $node}}:{{$node.Service.Port}}"
|
|
|
|
{{$weight := getAttribute "backend.weight" $node.Service.Tags ""}}
|
2016-04-12 07:49:37 +00:00
|
|
|
{{with $weight}}
|
|
|
|
weight = {{$weight}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{range .Services}}
|
|
|
|
{{$service := .ServiceName}}
|
|
|
|
{{$circuitBreaker := getAttribute "backend.circuitbreaker" .Attributes ""}}
|
|
|
|
{{with $circuitBreaker}}
|
2016-06-22 20:43:20 +00:00
|
|
|
[backends."backend-{{$service}}".circuitbreaker]
|
2016-04-12 07:49:37 +00:00
|
|
|
expression = "{{$circuitBreaker}}"
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{$loadBalancer := getAttribute "backend.loadbalancer" .Attributes ""}}
|
|
|
|
{{with $loadBalancer}}
|
2016-06-22 20:43:20 +00:00
|
|
|
[backends."backend-{{$service}}".loadbalancer]
|
2016-04-12 07:49:37 +00:00
|
|
|
method = "{{$loadBalancer}}"
|
|
|
|
{{end}}
|
2016-08-25 03:46:47 +00:00
|
|
|
|
|
|
|
{{if hasMaxconnAttributes .Attributes}}
|
|
|
|
[backends."backend-{{$service}}".maxconn]
|
|
|
|
amount = {{getAttribute "backend.maxconn.amount" .Attributes "" }}
|
|
|
|
extractorfunc = "{{getAttribute "backend.maxconn.extractorfunc" .Attributes "" }}"
|
|
|
|
{{end}}
|
|
|
|
|
2016-02-02 17:03:40 +00:00
|
|
|
{{end}}
|
|
|
|
|
2016-04-15 07:56:06 +00:00
|
|
|
[frontends]
|
|
|
|
{{range .Services}}
|
2016-06-22 20:43:20 +00:00
|
|
|
[frontends."frontend-{{.ServiceName}}"]
|
2016-04-12 07:49:37 +00:00
|
|
|
backend = "backend-{{.ServiceName}}"
|
2016-05-10 11:43:24 +00:00
|
|
|
passHostHeader = {{getAttribute "frontend.passHostHeader" .Attributes "true"}}
|
2016-06-06 20:30:23 +00:00
|
|
|
priority = {{getAttribute "frontend.priority" .Attributes "0"}}
|
2016-04-12 07:49:37 +00:00
|
|
|
{{$entryPoints := getAttribute "frontend.entrypoints" .Attributes ""}}
|
|
|
|
{{with $entryPoints}}
|
|
|
|
entrypoints = [{{range getEntryPoints $entryPoints}}
|
|
|
|
"{{.}}",
|
|
|
|
{{end}}]
|
|
|
|
{{end}}
|
2016-06-22 20:43:20 +00:00
|
|
|
[frontends."frontend-{{.ServiceName}}".routes."route-host-{{.ServiceName}}"]
|
2016-04-12 07:49:37 +00:00
|
|
|
rule = "{{getFrontendRule .}}"
|
2016-02-02 17:03:40 +00:00
|
|
|
{{end}}
|