refactor(rest) : add json annotation on configuration
- update Web UI - update documentation
This commit is contained in:
parent
adca5dc55b
commit
c11cf801ca
6 changed files with 177 additions and 174 deletions
|
@ -32,38 +32,45 @@ func NewGlobalConfiguration() *GlobalConfiguration {
|
||||||
return globalConfiguration
|
return globalConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Backend configuration
|
||||||
type Backend struct {
|
type Backend struct {
|
||||||
Servers map[string]Server
|
Servers map[string]Server `json:"servers,omitempty"`
|
||||||
CircuitBreaker *CircuitBreaker
|
CircuitBreaker *CircuitBreaker `json:"circuitBreaker,omitempty"`
|
||||||
LoadBalancer *LoadBalancer
|
LoadBalancer *LoadBalancer `json:"loadBalancer,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadBalancer configuration
|
||||||
type LoadBalancer struct {
|
type LoadBalancer struct {
|
||||||
Method string
|
Method string `json:"method,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CircuitBreaker configuration
|
||||||
type CircuitBreaker struct {
|
type CircuitBreaker struct {
|
||||||
Expression string
|
Expression string `json:"expression,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Server configuration
|
||||||
type Server struct {
|
type Server struct {
|
||||||
URL string
|
URL string `json:"url,omitempty"`
|
||||||
Weight int
|
Weight int `json:"weight,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Route configuration
|
||||||
type Route struct {
|
type Route struct {
|
||||||
Rule string
|
Rule string `json:"rule,omitempty"`
|
||||||
Value string
|
Value string `json:"value,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Frontend configuration
|
||||||
type Frontend struct {
|
type Frontend struct {
|
||||||
Backend string
|
Backend string `json:"backend,omitempty"`
|
||||||
Routes map[string]Route
|
Routes map[string]Route `json:"routes,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configuration of a provider
|
||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
Backends map[string]*Backend
|
Backends map[string]*Backend `json:"backends,omitempty"`
|
||||||
Frontends map[string]*Frontend
|
Frontends map[string]*Frontend `json:"frontends,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load Balancer Method
|
// Load Balancer Method
|
||||||
|
|
258
docs/index.md
258
docs/index.md
|
@ -4,17 +4,17 @@ ___
|
||||||
|
|
||||||
# <a id="top"></a> Documentation
|
# <a id="top"></a> Documentation
|
||||||
|
|
||||||
* [Basics](#basics)
|
- [Basics](#basics)
|
||||||
* [Global configuration](#global)
|
- [Global configuration](#global)
|
||||||
* [File backend](#file)
|
- [File backend](#file)
|
||||||
* [API backend](#api)
|
- [API backend](#api)
|
||||||
* [Docker backend](#docker)
|
- [Docker backend](#docker)
|
||||||
* [Mesos/Marathon backend](#marathon)
|
- [Mesos/Marathon backend](#marathon)
|
||||||
* [Consul backend](#consul)
|
- [Consul backend](#consul)
|
||||||
* [Etcd backend](#etcd)
|
- [Etcd backend](#etcd)
|
||||||
* [Zookeeper backend](#zk)
|
- [Zookeeper backend](#zk)
|
||||||
* [Boltdb backend](#boltdb)
|
- [Boltdb backend](#boltdb)
|
||||||
* [Benchmarks](#benchmarks)
|
- [Benchmarks](#benchmarks)
|
||||||
|
|
||||||
|
|
||||||
## <a id="basics"></a> Basics
|
## <a id="basics"></a> Basics
|
||||||
|
@ -29,12 +29,12 @@ Basically, Træfɪk is a http router, which sends traffic from frontends to http
|
||||||
|
|
||||||
Frontends can be defined using the following rules:
|
Frontends can be defined using the following rules:
|
||||||
|
|
||||||
* `Headers`: Headers adds a matcher for request header values. It accepts a sequence of key/value pairs to be matched. For example: `application/json`
|
- `Headers`: Headers adds a matcher for request header values. It accepts a sequence of key/value pairs to be matched. For example: `application/json`
|
||||||
* `HeadersRegexp`: Regular expressions can be used with headers as well. It accepts a sequence of key/value pairs, where the value has regex support. For example: `application/(text|json)`
|
- `HeadersRegexp`: Regular expressions can be used with headers as well. It accepts a sequence of key/value pairs, where the value has regex support. For example: `application/(text|json)`
|
||||||
* `Host`: Host adds a matcher for the URL host. It accepts a template with zero or more URL variables enclosed by `{}`. Variables can define an optional regexp pattern to be matched: `www.traefik.io`, `{subdomain:[a-z]+}.traefik.io`
|
- `Host`: Host adds a matcher for the URL host. It accepts a template with zero or more URL variables enclosed by `{}`. Variables can define an optional regexp pattern to be matched: `www.traefik.io`, `{subdomain:[a-z]+}.traefik.io`
|
||||||
* `Methods`: Methods adds a matcher for HTTP methods. It accepts a sequence of one or more methods to be matched, e.g.: `GET`, `POST`, `PUT`
|
- `Methods`: Methods adds a matcher for HTTP methods. It accepts a sequence of one or more methods to be matched, e.g.: `GET`, `POST`, `PUT`
|
||||||
* `Path`: Path adds a matcher for the URL path. It accepts a template with zero or more URL variables enclosed by `{}`. The template must start with a `/`. For exemple `/products/` `/articles/{category}/{id:[0-9]+}`
|
- `Path`: Path adds a matcher for the URL path. It accepts a template with zero or more URL variables enclosed by `{}`. The template must start with a `/`. For exemple `/products/` `/articles/{category}/{id:[0-9]+}`
|
||||||
* `PathPrefix`: PathPrefix adds a matcher for the URL path prefix. This matches if the given template is a prefix of the full URL path.
|
- `PathPrefix`: PathPrefix adds a matcher for the URL path prefix. This matches if the given template is a prefix of the full URL path.
|
||||||
|
|
||||||
|
|
||||||
A frontend is a set of rules that forwards the incoming http traffic to a backend.
|
A frontend is a set of rules that forwards the incoming http traffic to a backend.
|
||||||
|
@ -44,19 +44,19 @@ Frontends can be defined using the following rules:
|
||||||
A backend is responsible to load-balance the traffic coming from one or more frontends to a set of http servers.
|
A backend is responsible to load-balance the traffic coming from one or more frontends to a set of http servers.
|
||||||
Various methods of load-balancing is supported:
|
Various methods of load-balancing is supported:
|
||||||
|
|
||||||
* `wrr`: Weighted Round Robin
|
- `wrr`: Weighted Round Robin
|
||||||
* `drr`: Dynamic Round Robin: increases weights on servers that perform better than others. It also rolls back to original weights if the servers have changed.
|
- `drr`: Dynamic Round Robin: increases weights on servers that perform better than others. It also rolls back to original weights if the servers have changed.
|
||||||
|
|
||||||
A circuit breaker can also be applied to a backend, preventing high loads on failing servers.
|
A circuit breaker can also be applied to a backend, preventing high loads on failing servers.
|
||||||
It can be configured using:
|
It can be configured using:
|
||||||
|
|
||||||
* Methods: `LatencyAtQuantileMS`, `NetworkErrorRatio`, `ResponseCodeRatio`
|
- Methods: `LatencyAtQuantileMS`, `NetworkErrorRatio`, `ResponseCodeRatio`
|
||||||
* Operators: `AND`, `OR`, `EQ`, `NEQ`, `LT`, `LE`, `GT`, `GE`
|
- Operators: `AND`, `OR`, `EQ`, `NEQ`, `LT`, `LE`, `GT`, `GE`
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
* `NetworkErrorRatio() > 0.5`
|
- `NetworkErrorRatio() > 0.5`
|
||||||
* `LatencyAtQuantileMS(50.0) > 50`
|
- `LatencyAtQuantileMS(50.0) > 50`
|
||||||
* `ResponseCodeRatio(500, 600, 0, 600) > 0.5`
|
- `ResponseCodeRatio(500, 600, 0, 600) > 0.5`
|
||||||
|
|
||||||
## <a id="global"></a> Global configuration
|
## <a id="global"></a> Global configuration
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ For example:
|
||||||
|
|
||||||
Like any other reverse proxy, Træfɪk can be configured with a file. You have two choices:
|
Like any other reverse proxy, Træfɪk can be configured with a file. You have two choices:
|
||||||
|
|
||||||
* simply add your configuration at the end of the global configuration file `traefik.toml` :
|
- simply add your configuration at the end of the global configuration file `traefik.toml` :
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# traefik.toml
|
# traefik.toml
|
||||||
|
@ -158,7 +158,7 @@ logLevel = "DEBUG"
|
||||||
value = "/test"
|
value = "/test"
|
||||||
```
|
```
|
||||||
|
|
||||||
* or put your rules in a separate file, for example `rules.tml`:
|
- or put your rules in a separate file, for example `rules.tml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# traefik.toml
|
# traefik.toml
|
||||||
|
@ -230,12 +230,12 @@ address = ":8080"
|
||||||
# KeyFile = "traefik.key"
|
# KeyFile = "traefik.key"
|
||||||
```
|
```
|
||||||
|
|
||||||
* `/`: provides a simple HTML frontend of Træfik
|
- `/`: provides a simple HTML frontend of Træfik
|
||||||
|
|
||||||
![Web UI Providers](img/web.frontend.png)
|
![Web UI Providers](img/web.frontend.png)
|
||||||
![Web UI Health](img/traefik-health.png)
|
![Web UI Health](img/traefik-health.png)
|
||||||
|
|
||||||
* `/health`: `GET` json metrics
|
- `/health`: `GET` json metrics
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ curl -s "http://localhost:8080/health" | jq .
|
$ curl -s "http://localhost:8080/health" | jq .
|
||||||
|
@ -275,64 +275,63 @@ $ curl -s "http://localhost:8080/health" | jq .
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
* `/api`: `GET` configuration for all providers
|
- `/api`: `GET` configuration for all providers
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ curl -s "http://localhost:8080/api" | jq .
|
$ curl -s "http://localhost:8080/api" | jq .
|
||||||
{
|
{
|
||||||
"file": {
|
"file": {
|
||||||
"Frontends": {
|
"frontends": {
|
||||||
"frontend2": {
|
"frontend2": {
|
||||||
"Routes": {
|
"routes": {
|
||||||
"test_2": {
|
"test_2": {
|
||||||
"Value": "/test",
|
"value": "/test",
|
||||||
"Rule": "Path"
|
"rule": "Path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Backend": "backend1"
|
"backend": "backend1"
|
||||||
},
|
},
|
||||||
"frontend1": {
|
"frontend1": {
|
||||||
"Routes": {
|
"routes": {
|
||||||
"test_1": {
|
"test_1": {
|
||||||
"Value": "test.localhost",
|
"value": "test.localhost",
|
||||||
"Rule": "Host"
|
"rule": "Host"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Backend": "backend2"
|
"backend": "backend2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Backends": {
|
"backends": {
|
||||||
"backend2": {
|
"backend2": {
|
||||||
"LoadBalancer": {
|
"loadBalancer": {
|
||||||
"Method": "drr"
|
"method": "drr"
|
||||||
},
|
},
|
||||||
"CircuitBreaker": null,
|
"servers": {
|
||||||
"Servers": {
|
|
||||||
"server2": {
|
"server2": {
|
||||||
"Weight": 2,
|
"weight": 2,
|
||||||
"URL": "http://172.17.0.5:80"
|
"URL": "http://172.17.0.5:80"
|
||||||
},
|
},
|
||||||
"server1": {
|
"server1": {
|
||||||
"Weight": 1,
|
"weight": 1,
|
||||||
"URL": "http://172.17.0.4:80"
|
"url": "http://172.17.0.4:80"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"backend1": {
|
"backend1": {
|
||||||
"LoadBalancer": {
|
"loadBalancer": {
|
||||||
"Method": "wrr"
|
"method": "wrr"
|
||||||
},
|
},
|
||||||
"CircuitBreaker": {
|
"circuitBreaker": {
|
||||||
"Expression": "NetworkErrorRatio() > 0.5"
|
"expression": "NetworkErrorRatio() > 0.5"
|
||||||
},
|
},
|
||||||
"Servers": {
|
"servers": {
|
||||||
"server2": {
|
"server2": {
|
||||||
"Weight": 1,
|
"weight": 1,
|
||||||
"URL": "http://172.17.0.3:80"
|
"url": "http://172.17.0.3:80"
|
||||||
},
|
},
|
||||||
"server1": {
|
"server1": {
|
||||||
"Weight": 10,
|
"weight": 10,
|
||||||
"URL": "http://172.17.0.2:80"
|
"url": "http://172.17.0.2:80"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,14 +393,13 @@ watch = true
|
||||||
# filename = "docker.tmpl"
|
# filename = "docker.tmpl"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
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 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.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.host=bar`: override the default routing from {containerName}.{domain} to bar.{domain}
|
- `traefik.host=bar`: override the default routing from `{containerName}.{domain}` to `bar.{domain}`
|
||||||
* `traefik.domain=traefik.localhost`: override the default domain
|
* `traefik.domain=traefik.localhost`: override the default domain
|
||||||
|
|
||||||
## <a id="marathon"></a> Marathon backend
|
## <a id="marathon"></a> Marathon backend
|
||||||
|
@ -456,12 +454,12 @@ 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.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.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.host=bar`: override the default routing from {appName}.{domain} to bar.{domain}
|
- `traefik.host=bar`: override the default routing from `{appName}.{domain}` to `bar.{domain}`
|
||||||
* `traefik.prefixes=pf1,pf2`: use PathPrefix(es) instead of hostname for routing, use filename="providerTemplates/marathon-prefix.tmpl" with this option
|
- `traefik.prefixes=pf1,pf2`: use `PathPrefix(es)` instead of hostname for routing, use `filename="providerTemplates/marathon-prefix.tmpl"` with this option
|
||||||
* `traefik.domain=traefik.localhost`: override the default domain
|
* `traefik.domain=traefik.localhost`: override the default domain
|
||||||
|
|
||||||
## <a id="consul"></a> Consul backend
|
## <a id="consul"></a> Consul backend
|
||||||
|
@ -509,38 +507,38 @@ The Keys-Values structure should look (using `prefix = "/traefik"`):
|
||||||
- backend 1
|
- backend 1
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|--------------------------------------------------------|-----------------------------|
|
||||||
| /traefik/backends/backend1/circuitbreaker/expression | `NetworkErrorRatio() > 0.5` |
|
| `/traefik/backends/backend1/circuitbreaker/expression` | `NetworkErrorRatio() > 0.5` |
|
||||||
| /traefik/backends/backend1/servers/server1/url | `http://172.17.0.2:80` |
|
| `/traefik/backends/backend1/servers/server1/url` | `http://172.17.0.2:80` |
|
||||||
| /traefik/backends/backend1/servers/server1/weight | `10` |
|
| `/traefik/backends/backend1/servers/server1/weight` | `10` |
|
||||||
| /traefik/backends/backend1/servers/server2/url | `http://172.17.0.3:80` |
|
| `/traefik/backends/backend1/servers/server2/url` | `http://172.17.0.3:80` |
|
||||||
| /traefik/backends/backend1/servers/server2/weight | `1` |
|
| `/traefik/backends/backend1/servers/server2/weight` | `1` |
|
||||||
|
|
||||||
- backend 2
|
- backend 2
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|-----------------------------------------------------|------------------------|
|
||||||
| /traefik/backends/backend2/loadbalancer/method | `drr` |
|
| `/traefik/backends/backend2/loadbalancer/method` | `drr` |
|
||||||
| /traefik/backends/backend2/servers/server1/url | `http://172.17.0.4:80` |
|
| `/traefik/backends/backend2/servers/server1/url` | `http://172.17.0.4:80` |
|
||||||
| /traefik/backends/backend2/servers/server1/weight | `1` |
|
| `/traefik/backends/backend2/servers/server1/weight` | `1` |
|
||||||
| /traefik/backends/backend2/servers/server2/url | `http://172.17.0.5:80` |
|
| `/traefik/backends/backend2/servers/server2/url` | `http://172.17.0.5:80` |
|
||||||
| /traefik/backends/backend2/servers/server2/weight | `2` |
|
| `/traefik/backends/backend2/servers/server2/weight` | `2` |
|
||||||
|
|
||||||
- frontend 1
|
- frontend 1
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|----------------------------------------------------|------------------|
|
||||||
| /traefik/frontends/frontend1/backend | `backend2` |
|
| `/traefik/frontends/frontend1/backend` | `backend2` |
|
||||||
| /traefik/frontends/frontend1/routes/test_1/rule | `Host` |
|
| `/traefik/frontends/frontend1/routes/test_1/rule` | `Host` |
|
||||||
| /traefik/frontends/frontend1/routes/test_1/value | `test.localhost` |
|
| `/traefik/frontends/frontend1/routes/test_1/value` | `test.localhost` |
|
||||||
|
|
||||||
- frontend 2
|
- frontend 2
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|----------------------------------------------------|------------|
|
||||||
| /traefik/frontends/frontend2/backend | `backend1` |
|
| `/traefik/frontends/frontend2/backend` | `backend1` |
|
||||||
| /traefik/frontends/frontend2/routes/test_2/rule | `Path` |
|
| `/traefik/frontends/frontend2/routes/test_2/rule` | `Path` |
|
||||||
| /traefik/frontends/frontend2/routes/test_2/value | `/test` |
|
| `/traefik/frontends/frontend2/routes/test_2/value` | `/test` |
|
||||||
|
|
||||||
|
|
||||||
## <a id="etcd"></a> Etcd backend
|
## <a id="etcd"></a> Etcd backend
|
||||||
|
@ -588,38 +586,38 @@ The Keys-Values structure should look (using `prefix = "/traefik"`):
|
||||||
- backend 1
|
- backend 1
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|--------------------------------------------------------|-----------------------------|
|
||||||
| /traefik/backends/backend1/circuitbreaker/expression | `NetworkErrorRatio() > 0.5` |
|
| `/traefik/backends/backend1/circuitbreaker/expression` | `NetworkErrorRatio() > 0.5` |
|
||||||
| /traefik/backends/backend1/servers/server1/url | `http://172.17.0.2:80` |
|
| `/traefik/backends/backend1/servers/server1/url` | `http://172.17.0.2:80` |
|
||||||
| /traefik/backends/backend1/servers/server1/weight | `10` |
|
| `/traefik/backends/backend1/servers/server1/weight` | `10` |
|
||||||
| /traefik/backends/backend1/servers/server2/url | `http://172.17.0.3:80` |
|
| `/traefik/backends/backend1/servers/server2/url` | `http://172.17.0.3:80` |
|
||||||
| /traefik/backends/backend1/servers/server2/weight | `1` |
|
| `/traefik/backends/backend1/servers/server2/weight` | `1` |
|
||||||
|
|
||||||
- backend 2
|
- backend 2
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|-----------------------------------------------------|------------------------|
|
||||||
| /traefik/backends/backend2/loadbalancer/method | `drr` |
|
| `/traefik/backends/backend2/loadbalancer/method` | `drr` |
|
||||||
| /traefik/backends/backend2/servers/server1/url | `http://172.17.0.4:80` |
|
| `/traefik/backends/backend2/servers/server1/url` | `http://172.17.0.4:80` |
|
||||||
| /traefik/backends/backend2/servers/server1/weight | `1` |
|
| `/traefik/backends/backend2/servers/server1/weight` | `1` |
|
||||||
| /traefik/backends/backend2/servers/server2/url | `http://172.17.0.5:80` |
|
| `/traefik/backends/backend2/servers/server2/url` | `http://172.17.0.5:80` |
|
||||||
| /traefik/backends/backend2/servers/server2/weight | `2` |
|
| `/traefik/backends/backend2/servers/server2/weight` | `2` |
|
||||||
|
|
||||||
- frontend 1
|
- frontend 1
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|----------------------------------------------------|------------------|
|
||||||
| /traefik/frontends/frontend1/backend | `backend2` |
|
| `/traefik/frontends/frontend1/backend` | `backend2` |
|
||||||
| /traefik/frontends/frontend1/routes/test_1/rule | `Host` |
|
| `/traefik/frontends/frontend1/routes/test_1/rule` | `Host` |
|
||||||
| /traefik/frontends/frontend1/routes/test_1/value | `test.localhost` |
|
| `/traefik/frontends/frontend1/routes/test_1/value` | `test.localhost` |
|
||||||
|
|
||||||
- frontend 2
|
- frontend 2
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|----------------------------------------------------|------------|
|
||||||
| /traefik/frontends/frontend2/backend | `backend1` |
|
| `/traefik/frontends/frontend2/backend` | `backend1` |
|
||||||
| /traefik/frontends/frontend2/routes/test_2/rule | `Path` |
|
| `/traefik/frontends/frontend2/routes/test_2/rule` | `Path` |
|
||||||
| /traefik/frontends/frontend2/routes/test_2/value | `/test` |
|
| `/traefik/frontends/frontend2/routes/test_2/value` | `/test` |
|
||||||
|
|
||||||
|
|
||||||
## <a id="zk"></a> Zookeeper backend
|
## <a id="zk"></a> Zookeeper backend
|
||||||
|
@ -666,38 +664,38 @@ The Keys-Values structure should look (using `prefix = "/traefik"`):
|
||||||
- backend 1
|
- backend 1
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|--------------------------------------------------------|-----------------------------|
|
||||||
| /traefik/backends/backend1/circuitbreaker/expression | `NetworkErrorRatio() > 0.5` |
|
| `/traefik/backends/backend1/circuitbreaker/expression` | `NetworkErrorRatio() > 0.5` |
|
||||||
| /traefik/backends/backend1/servers/server1/url | `http://172.17.0.2:80` |
|
| `/traefik/backends/backend1/servers/server1/url` | `http://172.17.0.2:80` |
|
||||||
| /traefik/backends/backend1/servers/server1/weight | `10` |
|
| `/traefik/backends/backend1/servers/server1/weight` | `10` |
|
||||||
| /traefik/backends/backend1/servers/server2/url | `http://172.17.0.3:80` |
|
| `/traefik/backends/backend1/servers/server2/url` | `http://172.17.0.3:80` |
|
||||||
| /traefik/backends/backend1/servers/server2/weight | `1` |
|
| `/traefik/backends/backend1/servers/server2/weight` | `1` |
|
||||||
|
|
||||||
- backend 2
|
- backend 2
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|-----------------------------------------------------|------------------------|
|
||||||
| /traefik/backends/backend2/loadbalancer/method | `drr` |
|
| `/traefik/backends/backend2/loadbalancer/method` | `drr` |
|
||||||
| /traefik/backends/backend2/servers/server1/url | `http://172.17.0.4:80` |
|
| `/traefik/backends/backend2/servers/server1/url` | `http://172.17.0.4:80` |
|
||||||
| /traefik/backends/backend2/servers/server1/weight | `1` |
|
| `/traefik/backends/backend2/servers/server1/weight` | `1` |
|
||||||
| /traefik/backends/backend2/servers/server2/url | `http://172.17.0.5:80` |
|
| `/traefik/backends/backend2/servers/server2/url` | `http://172.17.0.5:80` |
|
||||||
| /traefik/backends/backend2/servers/server2/weight | `2` |
|
| `/traefik/backends/backend2/servers/server2/weight` | `2` |
|
||||||
|
|
||||||
- frontend 1
|
- frontend 1
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|---------------------------------------------------|------------------|
|
||||||
| /traefik/frontends/frontend1/backend | `backend2` |
|
| `/traefik/frontends/frontend1/backend | `backend2` |
|
||||||
| /traefik/frontends/frontend1/routes/test_1/rule | `Host` |
|
| `/traefik/frontends/frontend1/routes/test_1/rule | `Host` |
|
||||||
| /traefik/frontends/frontend1/routes/test_1/value | `test.localhost` |
|
| `/traefik/frontends/frontend1/routes/test_1/value | `test.localhost` |
|
||||||
|
|
||||||
- frontend 2
|
- frontend 2
|
||||||
|
|
||||||
| Key | Value |
|
| Key | Value |
|
||||||
| ------------- | ----------- |
|
|----------------------------------------------------|------------|
|
||||||
| /traefik/frontends/frontend2/backend | `backend1` |
|
| `/traefik/frontends/frontend2/backend` | `backend1` |
|
||||||
| /traefik/frontends/frontend2/routes/test_2/rule | `Path` |
|
| `/traefik/frontends/frontend2/routes/test_2/rule` | `Path` |
|
||||||
| /traefik/frontends/frontend2/routes/test_2/value | `/test` |
|
| `/traefik/frontends/frontend2/routes/test_2/value` | `/test` |
|
||||||
|
|
||||||
|
|
||||||
## <a id="boltdb"></a> BoltDB backend
|
## <a id="boltdb"></a> BoltDB backend
|
||||||
|
@ -745,7 +743,7 @@ Træfɪk can be configured to use BoltDB as a backend configuration:
|
||||||
|
|
||||||
Here are some early Benchmarks between Nginx and Træfɪk acting as simple load balancers between two servers.
|
Here are some early Benchmarks between Nginx and Træfɪk acting as simple load balancers between two servers.
|
||||||
|
|
||||||
* Nginx:
|
- Nginx:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ docker run -d -e VIRTUAL_HOST=test1.localhost emilevauge/whoami
|
$ docker run -d -e VIRTUAL_HOST=test1.localhost emilevauge/whoami
|
||||||
|
@ -805,10 +803,9 @@ Percentage of the requests served within a certain time (ms)
|
||||||
98% 12
|
98% 12
|
||||||
99% 13
|
99% 13
|
||||||
100% 36 (longest request)
|
100% 36 (longest request)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* Træfɪk:
|
- Træfɪk:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ docker run -d -l traefik.backend=test1 -l traefik.host=test1 emilevauge/whoami
|
$ docker run -d -l traefik.backend=test1 -l traefik.host=test1 emilevauge/whoami
|
||||||
|
@ -868,5 +865,4 @@ Percentage of the requests served within a certain time (ms)
|
||||||
98% 11
|
98% 11
|
||||||
99% 13
|
99% 13
|
||||||
100% 22 (longest request)
|
100% 22 (longest request)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(function () {
|
(function (d3) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('traefik.section.health')
|
angular.module('traefik.section.health')
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
vm.graph = {
|
vm.graph = {
|
||||||
averageResponseTime: {},
|
averageResponseTime: {},
|
||||||
totalStatusCodeCount: {}
|
totalStatusCodeCount: {}
|
||||||
}
|
};
|
||||||
|
|
||||||
vm.graph.totalStatusCodeCount.options = {
|
vm.graph.totalStatusCodeCount.options = {
|
||||||
"chart": {
|
"chart": {
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
vm.graph.totalStatusCodeCount.data[0].values.push({
|
vm.graph.totalStatusCodeCount.data[0].values.push({
|
||||||
label: code,
|
label: code,
|
||||||
value: totalStatusCodeCount[code]
|
value: totalStatusCodeCount[code]
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,4 +201,4 @@
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
})();
|
})(d3);
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
<td><em>URL</em></td>
|
<td><em>URL</em></td>
|
||||||
<td><em>Weight</em></td>
|
<td><em>Weight</em></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-repeat="(serverId, server) in backendCtrl.backend.Servers">
|
<tr data-ng-repeat="(serverId, server) in backendCtrl.backend.servers">
|
||||||
<td>{{serverId}}</td>
|
<td>{{serverId}}</td>
|
||||||
<td><code><a data-ng-href="{{server.url}}">{{server.URL}}</a></code></td>
|
<td><code><a data-ng-href="{{server.url}}">{{server.url}}</a></code></td>
|
||||||
<td>{{server.Weight}}</td>
|
<td>{{server.weight}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer" data-ng-show="backendCtrl.backend.LoadBalancer || backendCtrl.backend.CircuitBreaker">
|
<div class="panel-footer" data-ng-show="backendCtrl.backend.loadBalancer || backendCtrl.backend.circuitBreaker">
|
||||||
<span data-ng-show="backendCtrl.backend.LoadBalancer" class="label label-success">Load Balancer: {{backendCtrl.backend.LoadBalancer.Method}}</span>
|
<span data-ng-show="backendCtrl.backend.loadBalancer" class="label label-success">Load Balancer: {{backendCtrl.backend.loadBalancer.method}}</span>
|
||||||
<span data-ng-show="backendCtrl.backend.CircuitBreaker" class="label label-success">Circuit Breaker: {{backendCtrl.backend.CircuitBreaker.Expression}}</span>
|
<span data-ng-show="backendCtrl.backend.circuitBreaker" class="label label-success">Circuit Breaker: {{backendCtrl.backend.circuitBreaker.expression}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
<td><em>Rule</em></td>
|
<td><em>Rule</em></td>
|
||||||
<td><em>Value</em></td>
|
<td><em>Value</em></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-repeat="(routeId, route) in frontendCtrl.frontend.Routes">
|
<tr data-ng-repeat="(routeId, route) in frontendCtrl.frontend.routes">
|
||||||
<td>{{routeId}}</td>
|
<td>{{routeId}}</td>
|
||||||
<td>{{route.Rule}}</td>
|
<td>{{route.rule}}</td>
|
||||||
<td><code>{{route.Value}}</code></td>
|
<td><code>{{route.value}}</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div data-bg-show="frontendCtrl.frontend.Backend" class="panel-footer">
|
<div data-bg-show="frontendCtrl.frontend.backend" class="panel-footer">
|
||||||
<span class="label label-warning" role="button" data-toggle="collapse" href="#{{frontendCtrl.frontend.Backend}}" aria-expanded="false">{{frontendCtrl.frontend.Backend}}</span>
|
<span class="label label-warning" role="button" data-toggle="collapse" href="#{{frontendCtrl.frontend.backend}}" aria-expanded="false">{{frontendCtrl.frontend.backend}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
<div class="row tabset-row__providers">
|
<div class="row tabset-row__providers">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div data-ng-repeat="(frontendId, frontend) in provider.Frontends">
|
<div data-ng-repeat="(frontendId, frontend) in provider.frontends">
|
||||||
<frontend-monitor data-provider-id="providerId" data-frontend-id="frontendId" data-frontend="frontend"></frontend-monitor>
|
<frontend-monitor data-provider-id="providerId" data-frontend-id="frontendId" data-frontend="frontend"></frontend-monitor>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div data-ng-repeat="(backendId, backend) in provider.Backends">
|
<div data-ng-repeat="(backendId, backend) in provider.backends">
|
||||||
<backend-monitor data-provider-id="providerId" data-backend-id="backendId" data-backend="backend"></backend-monitor>
|
<backend-monitor data-provider-id="providerId" data-backend-id="backendId" data-backend="backend"></backend-monitor>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue