Correct BoltDB backend. Fixes #68

This commit is contained in:
emile 2015-10-23 18:59:08 +02:00
parent 32bfecff83
commit aaeb7cdffd
6 changed files with 11 additions and 7 deletions

View file

@ -99,8 +99,8 @@ func (provider *DockerProvider) loadDockerConfig(dockerClient *docker.Client) *C
} }
return provider.Domain return provider.Domain
}, },
"getProtocole": func(container docker.Container) string { "getProtocol": func(container docker.Container) string {
if label, err := provider.getLabel(container, "traefik.protocole"); err == nil { if label, err := provider.getLabel(container, "traefik.protocol"); err == nil {
return label return label
} }
return "http" return "http"

View file

@ -407,6 +407,7 @@ Labels can be used on containers to override default behaviour:
- `traefik.backend=foo`: assign the container to `foo` backend - `traefik.backend=foo`: assign the container to `foo` backend
- `traefik.port=80`: register this port. Useful when the container exposes multiples ports. - `traefik.port=80`: register this port. Useful when the container exposes multiples ports.
- `traefik.protocol=https`: override the default `http` protocol
- `traefik.weight=10`: assign this weight to the container - `traefik.weight=10`: assign this weight to the container
- `traefik.enable=false`: disable this container in Træfɪk - `traefik.enable=false`: disable this container in Træfɪk
- `traefik.frontend.rule=Host`: override the default frontend rule (Default: Host). See [frontends](#frontends). - `traefik.frontend.rule=Host`: override the default frontend rule (Default: Host). See [frontends](#frontends).
@ -466,7 +467,9 @@ domain = "marathon.localhost"
Labels can be used on containers to override default behaviour: Labels can be used on containers to override default behaviour:
- `traefik.backend=foo`: assign the application to `foo` backend
- `traefik.port=80`: register this port. Useful when the application exposes multiples ports. - `traefik.port=80`: register this port. Useful when the application exposes multiples ports.
- `traefik.protocol=https`: override the default `http` protocol
- `traefik.weight=10`: assign this weight to the application - `traefik.weight=10`: assign this weight to the application
- `traefik.enable=false`: disable this application in Træfɪk - `traefik.enable=false`: disable this application in Træfɪk
- `traefik.frontend.rule=Host`: override the default frontend rule (Default: Host). See [frontends](#frontends). - `traefik.frontend.rule=Host`: override the default frontend rule (Default: Host). See [frontends](#frontends).

1
kv.go
View file

@ -88,6 +88,7 @@ func (provider *KvProvider) provide(configurationChan chan<- configMessage) erro
[]string{provider.Endpoint}, []string{provider.Endpoint},
&store.Config{ &store.Config{
ConnectionTimeout: 30 * time.Second, ConnectionTimeout: 30 * time.Second,
Bucket: "traefik",
}, },
) )
if err != nil { if err != nil {

View file

@ -83,13 +83,13 @@ func (provider *MarathonProvider) loadMarathonConfig() *Configuration {
"replace": func(s1 string, s2 string, s3 string) string { "replace": func(s1 string, s2 string, s3 string) string {
return strings.Replace(s3, s1, s2, -1) return strings.Replace(s3, s1, s2, -1)
}, },
"getProtocole": func(task marathon.Task, applications []marathon.Application) string { "getProtocol": func(task marathon.Task, applications []marathon.Application) string {
application := getApplication(task, applications) application := getApplication(task, applications)
if application == nil { if application == nil {
log.Errorf("Unable to get marathon application from task %s", task.AppID) log.Errorf("Unable to get marathon application from task %s", task.AppID)
return "http" return "http"
} }
if label, err := provider.getLabel(*application, "traefik.protocole"); err == nil { if label, err := provider.getLabel(*application, "traefik.protocol"); err == nil {
return label return label
} }
return "http" return "http"

View file

@ -1,6 +1,6 @@
[backends]{{range .Containers}} [backends]{{range .Containers}}
[backends.backend-{{getBackend .}}.servers.server-{{.Name | replace "/" "" | replace "." "-"}}] [backends.backend-{{getBackend .}}.servers.server-{{.Name | replace "/" "" | replace "." "-"}}]
url = "{{getProtocole .}}://{{.NetworkSettings.IPAddress}}:{{getPort .}}" url = "{{getProtocol .}}://{{.NetworkSettings.IPAddress}}:{{getPort .}}"
weight = {{getWeight .}} weight = {{getWeight .}}
{{end}} {{end}}

View file

@ -1,7 +1,7 @@
{{$apps := .Applications}} {{$apps := .Applications}}
[backends]{{range .Tasks}} [backends]{{range .Tasks}}
[backends.backend{{.AppID | replace "/" "-"}}.servers.server-{{.ID | replace "." "-"}}] [backends.backend{{.AppID | replace "/" "-"}}.servers.server-{{.ID | replace "." "-"}}]
url = "{{getProtocole . $apps}}://{{.Host}}:{{getPort .}}" url = "{{getProtocol . $apps}}://{{.Host}}:{{getPort .}}"
weight = {{getWeight . $apps}} weight = {{getWeight . $apps}}
{{end}} {{end}}