feat(controller): Add health endpoint (#1882)
* feat(controller): New health service and server This change also implements a new listener purpose, `ops`. `ops` (short for operations) is a new listener purpose that is responsible for serving Boundary's operations endpoints, like health and possibly metrics. At Startup: `ops` listeners get configured as late as possible to catch any errors with the startup process; At Shutdown: If the health endpoint has been set-up, we introduce a configurable delay in the process. This is to enable the health endpoint to report unhealthy for that amount of time. `ops` listeners are also the last listeners to be shutdown.
This commit is contained in:
25 files changed
+2034
-23
No files matched your search
@@ -61,15 +61,23 @@ description will be read.
|
||||
- `auth_token_time_to_live` - Maximum time to live (TTL) for all auth tokens globally (pertains
|
||||
to all tokens from all auth methods). Valid time units are anything specified by Golang's
|
||||
[ParseDuration()](https://golang.org/pkg/time/#ParseDuration) method. Default is 7 days.
|
||||
|
||||
- `auth_token_time_to_stale` - Maximum time of inactivity for all auth tokens globally (pertains
|
||||
to all tokens from all auth methods). Valid time units are anything specified by Golang's
|
||||
[ParseDuration()](https://golang.org/pkg/time/#ParseDuration) method. Default is 1 day.
|
||||
|
||||
- `graceful_shutdown_wait_duration` - Amount of time Boundary will wait before initiating the shutdown procedure,
|
||||
after receiving a shutdown signal. In this state, Boundary still processes requests as normal but replies
|
||||
with `503 Service Unavailable` to any health requests. This is designed to allow an operator to configure
|
||||
load-balancers to preemptively stop new traffic to a Boundary instance that is going away. Valid time units
|
||||
are anything specified by Go's [ParseDuration()](https://golang.org/pkg/time/#ParseDuration) method. Only
|
||||
used when an `ops` listener is set and the Controller is present. Default is 0 seconds.
|
||||
|
||||
## KMS Configuration
|
||||
|
||||
The controller requires two KMS stanzas for `root` and `worker-auth` purposes:
|
||||
|
||||
```kms
|
||||
```hcl
|
||||
# Root KMS configuration block: this is the root key for Boundary
|
||||
# Use a production KMS such as AWS KMS in production installs
|
||||
kms "aead" {
|
||||
@@ -130,6 +138,9 @@ controller {
|
||||
name = "demo-controller-1"
|
||||
description = "A controller for a demo!"
|
||||
|
||||
# After receiving a shutdown signal, Boundary will wait 10s before initiating the shutdown process.
|
||||
graceful_shutdown_wait_duration = "10s"
|
||||
|
||||
# Database URL for postgres. This can be a direct "postgres://"
|
||||
# URL, or it can be "file://" to read the contents of a file to
|
||||
# supply the url, or "env://" to name an environment variable
|
||||
@@ -162,6 +173,16 @@ listener "tcp" {
|
||||
purpose = "cluster"
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
# Should be the address of the NIC where your external systems'
|
||||
# (eg: Load-Balancer) will connect on.
|
||||
address = "10.0.0.1"
|
||||
# The purpose of this listener block
|
||||
purpose = "ops"
|
||||
|
||||
tls_disable = false
|
||||
}
|
||||
|
||||
# Root KMS configuration block: this is the root key for Boundary
|
||||
# Use a production KMS such as AWS KMS in production installs
|
||||
kms "aead" {
|
||||
|
||||
@@ -30,13 +30,15 @@ After the configuration is written, use the `-config` flag to specify a local pa
|
||||
- [`listener`](/docs/configuration/listener): Configures the listeners on which
|
||||
Boundary serves traffic (API, cluster, and proxy).
|
||||
|
||||
Controllers will have two listener blocks: one marked for `api` purpose and
|
||||
the other marked for `cluster` purpose. By default, the API listener runs on
|
||||
:9200 and the cluster listener (currently used for worker communication) uses
|
||||
:9201.
|
||||
Controllers must have at least two listener blocks defined: one marked for
|
||||
`api` purpose and the other marked for `cluster` purpose.
|
||||
|
||||
Workers will have only one listener, marked for `proxy` purpose.
|
||||
|
||||
Optionally, the `ops` purpose listener block serves as a higher-level listener
|
||||
where Boundary's operational endpoints live (eg: /health).
|
||||
|
||||
|
||||
- [`kms`](/docs/configuration/kms): Configures KMS blocks [for various
|
||||
purposes](/docs/concepts/security/data-encryption).
|
||||
|
||||
|
||||
@@ -9,7 +9,35 @@ description: |-
|
||||
# `listener` Stanza
|
||||
|
||||
The `listener` stanza configures the addresses and ports on which Boundary will
|
||||
respond to requests. At this time, there are two listeners - [TCP][tcp] and [Unix][unix].
|
||||
respond to requests. At this time, there are two listener types:
|
||||
[TCP](/docs/configuration/listener/tcp) and [Unix](/docs/configuration/listener/unix).
|
||||
|
||||
|
||||
## `listener` Purpose
|
||||
|
||||
The `purpose` field is used to determine what part of Boundary's functionality is
|
||||
started and exposed for a given listener block. Each listener must have a `purpose` set.
|
||||
|
||||
Currently, Boundary recognizes the following listener purposes:
|
||||
|
||||
- `api`: Starts up and exposes Boundary's controller API.
|
||||
At least one `api` listener must be present if a Boundary
|
||||
instance is set-up as a controller.
|
||||
By default, it runs on `:9200`.
|
||||
|
||||
- `cluster`: Starts up and exposes Boundary's worker and
|
||||
controller communication layer. Only one `cluster` listener
|
||||
is allowed per Boundary instance. Must be present if a Boundary
|
||||
instance is set-up as a controller.
|
||||
By default, it runs on `:9201`.
|
||||
|
||||
- `proxy`: Starts up a Boundary Worker. By default, it runs
|
||||
on `:9202`.
|
||||
|
||||
- `ops`: Starts up and exposes Boundary's operational
|
||||
endpoints (eg: /health). By default, it runs on `:9203`.
|
||||
This listener's exposed functionality depends on what Boundary
|
||||
components you're running on any given Boundary instance (eg: Health does not
|
||||
run unless your Boundary instance has a controller running)
|
||||
|
||||
|
||||
[tcp]: /docs/configuration/listener/tcp
|
||||
[unix]: /docs/configuration/listener/unix
|
||||
@@ -25,8 +25,8 @@ allowed.
|
||||
|
||||
### General
|
||||
|
||||
- `purpose` `(string: "")` - Specifies the purpose. Can be `api`, `cluster`, or
|
||||
`proxy`.
|
||||
- `purpose` `(string: "")` - Specifies the purpose. Can be `api`, `cluster`,
|
||||
`proxy`, or `ops`.
|
||||
|
||||
- `address` `(string: "127.0.0.1:9200")` – Specifies the address to bind to for
|
||||
listening.
|
||||
@@ -86,9 +86,9 @@ allowed.
|
||||
|
||||
### TLS
|
||||
|
||||
~> All `tls` parameters are valid only for the `api` listener. `cluster` and
|
||||
`proxy` connections use their own ephemeral TLS stacks. For more information,
|
||||
see [the connections security concepts
|
||||
~> `tls` parameters are valid for `api` and `ops` listeners. `cluster`
|
||||
and `proxy` connections use their own ephemeral TLS stacks. For more
|
||||
information, see [the connections security concepts
|
||||
page](https://www.boundaryproject.io/docs/concepts/security/connections-tls).
|
||||
|
||||
- `tls_disable` `(string: "false")` – Specifies if TLS will be disabled. Boundary
|
||||
|
||||
@@ -27,7 +27,7 @@ allowed.
|
||||
|
||||
### General
|
||||
|
||||
- `purpose` `(string: "")` - Specifies the purpose. Can be `api` or `cluster`.
|
||||
- `purpose` `(string: "")` - Specifies the purpose. Can be `api`, `ops` or `cluster`.
|
||||
|
||||
- `address` `(string: "")` – Specifies the address (filesystem path) to bind to
|
||||
for listening.
|
||||
@@ -87,9 +87,9 @@ allowed.
|
||||
|
||||
### TLS
|
||||
|
||||
~> All `tls` parameters are valid only for the `api` listener. `cluster` and
|
||||
`proxy` connections use their own ephemeral TLS stacks. For more information,
|
||||
see [the connections security concepts
|
||||
~> `tls` parameters are valid for `api` and `ops` listeners. `cluster`
|
||||
and `proxy` connections use their own ephemeral TLS stacks. For more
|
||||
information, see [the connections security concepts
|
||||
page](https://www.boundaryproject.io/docs/concepts/security/connections-tls).
|
||||
|
||||
- `tls_disable` `(string: "false")` – Specifies if TLS will be disabled. Boundary
|
||||
|
||||
Reference in new issue
Block a user