API: remove configuration of Entrypoint and Middlewares

Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
This commit is contained in:
mpl 2019-07-19 12:28:07 +02:00 committed by Traefiker Bot
parent f75f73f3d2
commit 092aa8fa6d
17 changed files with 48 additions and 269 deletions

View file

@ -44,54 +44,6 @@ metrics:
--metrics.prometheus.buckets=0.100000, 0.300000, 1.200000, 5.000000
```
#### `entryPoint`
_Optional, Default=traefik_
Entry-point used by prometheus to expose metrics.
```toml tab="File (TOML)"
[metrics]
[metrics.prometheus]
entryPoint = traefik
```
```yaml tab="File (TOML)"
metrics:
prometheus:
entryPoint: traefik
```
```bash tab="CLI"
--metrics
--metrics.prometheus.entryPoint=traefik
```
#### `middlewares`
_Optional, Default=""_
Middlewares.
```toml tab="File (TOML)"
[metrics]
[metrics.prometheus]
middlewares = ["xxx", "yyy"]
```
```yaml tab="File (TOML)"
metrics:
prometheus:
middlewares:
- xxx
- yyy
```
```bash tab="CLI"
--metrics
--metrics.prometheus.middlewares="xxx,yyy"
```
#### `addEntryPointsLabels`
_Optional, Default=true_

View file

@ -1,5 +1,8 @@
# API
!!! important
In the beta version, you can't configure middlewares (basic authentication or white listing) anymore, but as security is important, this will change before the RC version.
Traefik exposes a number of information through an API handler, such as the configuration of all routers, services, middlewares, etc.
As with all features of Traefik, this handler can be enabled with the [static configuration](../getting-started/configuration-overview.md#the-static-configuration).
@ -14,14 +17,14 @@ In production, it should be at least secured by authentication and authorization
A good sane default (non exhaustive) set of recommendations
would be to apply the following protection mechanisms:
* At the application level:
securing with middlewares such as [basic authentication](../middlewares/basicauth.md) or [white listing](../middlewares/ipwhitelist.md).
* At the transport level:
NOT publicly exposing the API's port,
keeping it restricted to internal networks
(as in the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege), applied to networks).
!!! important
In the beta version, you can't configure middlewares (basic authentication or white listing) anymore, but as security is important, this will change before the RC version.
## Configuration
To enable the API handler:
@ -49,37 +52,6 @@ Enable the dashboard. More about the dashboard features [here](./dashboard.md).
--api.dashboard
```
### `entrypoint`
_Optional, Default="traefik"_
The entry point that the API handler will be bound to.
The default ("traefik") is an internal entry point (which is always defined).
```toml tab="File"
[api]
entrypoint = "web"
```
```bash tab="CLI"
--api.entrypoint="web"
```
### `middlewares`
_Optional, Default=empty_
The list of [middlewares](../middlewares/overview.md) applied to the API handler.
```toml tab="File"
[api]
middlewares = ["api-auth", "api-prefix"]
```
```bash tab="CLI"
--api.middlewares="api-auth,api-prefix"
```
### `debug`
_Optional, Default=false_
@ -120,51 +92,3 @@ All the following endpoints must be accessed with a `GET` HTTP request.
| `/debug/pprof/profile` | See the [pprof Profile](https://golang.org/pkg/net/http/pprof/#Profile) Go documentation. |
| `/debug/pprof/symbol` | See the [pprof Symbol](https://golang.org/pkg/net/http/pprof/#Symbol) Go documentation. |
| `/debug/pprof/trace` | See the [pprof Trace](https://golang.org/pkg/net/http/pprof/#Trace) Go documentation. |
## Common Configuration Use Cases
### Address / Port
You can define a custom address/port like this:
```toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.foo]
address = ":8082"
[entryPoints.bar]
address = ":8083"
[ping]
entryPoint = "foo"
[api]
entryPoint = "bar"
```
In the above example, you would access a service at /foo, an api endpoint, or the health-check as follows:
* Service: `http://hostname:80/foo`
* API: `http://hostname:8083/api/http/routers`
* Ping URL: `http://hostname:8082/ping`
### Authentication
To restrict access to the API handler, one can add authentication with the [basic auth middleware](../middlewares/basicauth.md).
```toml
[api]
middlewares=["api-auth"]
```
```toml
[http.middlewares]
[http.middlewares.api-auth.basicAuth]
users = [
"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
"test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0",
]
```

View file

@ -11,26 +11,10 @@ Checking the Health of Your Traefik Instances
[ping]
```
??? example "Enabling /ping on a dedicated EntryPoint"
```toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.ping]
address = ":8082"
[ping]
entryPoint = "ping"
```
| Path | Method | Description |
|---------|---------------|-----------------------------------------------------------------------------------------------------|
| `/ping` | `GET`, `HEAD` | A simple endpoint to check for Traefik process liveness. Return a code `200` with the content: `OK` |
## Configuration Options
The `/ping` health-check URL is enabled with the command-line `--ping` or config file option `[ping]`.
You can customize the `entryPoint` where the `/ping` is active with the `entryPoint` option (default value: `traefik`)
The `/ping` health-check URL is enabled with the command-line `--ping` or config file option `[ping]`.

View file

@ -45,18 +45,6 @@ Activate dashboard. (Default: ```true```)
`--api.debug`:
Enable additional endpoints for debugging and profiling. (Default: ```false```)
`--api.entrypoint`:
The entry point that the API handler will be bound to. (Default: ```traefik```)
`--api.middlewares`:
Middleware list.
`--api.statistics`:
Enable more detailed statistics. (Default: ```false```)
`--api.statistics.recenterrors`:
Number of recent errors logged. (Default: ```10```)
`--certificatesresolvers.<name>`:
Certificates resolvers configuration. (Default: ```false```)
@ -219,12 +207,6 @@ Enable metrics on services. (Default: ```true```)
`--metrics.prometheus.buckets`:
Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```)
`--metrics.prometheus.entrypoint`:
EntryPoint. (Default: ```traefik```)
`--metrics.prometheus.middlewares`:
Middlewares.
`--metrics.statsd`:
StatsD metrics exporter type. (Default: ```false```)
@ -241,13 +223,7 @@ Enable metrics on services. (Default: ```true```)
StatsD push interval. (Default: ```10```)
`--ping`:
Enable ping. (Default: ```false```)
`--ping.entrypoint`:
Ping entryPoint. (Default: ```traefik```)
`--ping.middlewares`:
Middleware list.
Enable ping. (Default: ```true```)
`--providers.docker`:
Enable Docker backend with default settings. (Default: ```false```)
@ -457,10 +433,7 @@ Defines the polling interval in seconds. (Default: ```15```)
Watch provider. (Default: ```true```)
`--providers.rest`:
Enable Rest backend with default settings. (Default: ```false```)
`--providers.rest.entrypoint`:
EntryPoint. (Default: ```traefik```)
Enable Rest backend with default settings. (Default: ```true```)
`--serverstransport.forwardingtimeouts.dialtimeout`:
The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists. (Default: ```30```)

View file

@ -45,18 +45,6 @@ Activate dashboard. (Default: ```true```)
`TRAEFIK_API_DEBUG`:
Enable additional endpoints for debugging and profiling. (Default: ```false```)
`TRAEFIK_API_ENTRYPOINT`:
The entry point that the API handler will be bound to. (Default: ```traefik```)
`TRAEFIK_API_MIDDLEWARES`:
Middleware list.
`TRAEFIK_API_STATISTICS`:
Enable more detailed statistics. (Default: ```false```)
`TRAEFIK_API_STATISTICS_RECENTERRORS`:
Number of recent errors logged. (Default: ```10```)
`TRAEFIK_CERTIFICATESRESOLVERS_<NAME>`:
Certificates resolvers configuration. (Default: ```false```)
@ -219,12 +207,6 @@ Enable metrics on services. (Default: ```true```)
`TRAEFIK_METRICS_PROMETHEUS_BUCKETS`:
Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```)
`TRAEFIK_METRICS_PROMETHEUS_ENTRYPOINT`:
EntryPoint. (Default: ```traefik```)
`TRAEFIK_METRICS_PROMETHEUS_MIDDLEWARES`:
Middlewares.
`TRAEFIK_METRICS_STATSD`:
StatsD metrics exporter type. (Default: ```false```)
@ -241,13 +223,7 @@ Enable metrics on services. (Default: ```true```)
StatsD push interval. (Default: ```10```)
`TRAEFIK_PING`:
Enable ping. (Default: ```false```)
`TRAEFIK_PING_ENTRYPOINT`:
Ping entryPoint. (Default: ```traefik```)
`TRAEFIK_PING_MIDDLEWARES`:
Middleware list.
Enable ping. (Default: ```true```)
`TRAEFIK_PROVIDERS_DOCKER`:
Enable Docker backend with default settings. (Default: ```false```)
@ -457,10 +433,7 @@ Defines the polling interval in seconds. (Default: ```15```)
Watch provider. (Default: ```true```)
`TRAEFIK_PROVIDERS_REST`:
Enable Rest backend with default settings. (Default: ```false```)
`TRAEFIK_PROVIDERS_REST_ENTRYPOINT`:
EntryPoint. (Default: ```traefik```)
Enable Rest backend with default settings. (Default: ```true```)
`TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_DIALTIMEOUT`:
The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists. (Default: ```30```)