Add listener `health` (#14747)

Fixes: #8780
This commit is contained in:
Dirk Klimpel 2023-01-11 13:00:38 +01:00 committed by GitHub
parent 7b3a8f2b0c
commit 73f097888e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1 @@
Add a dedicated listener configuration for `health` endpoint.

View File

@ -480,6 +480,12 @@ Valid resource names are:
* `static`: static resources under synapse/static (/_matrix/static). (Mostly useful for 'fallback authentication'.) * `static`: static resources under synapse/static (/_matrix/static). (Mostly useful for 'fallback authentication'.)
* `health`: the [health check endpoint](../../reverse_proxy.md#health-check-endpoint). This endpoint
is by default active for all other resources and does not have to be activated separately.
This is only useful if you want to use the health endpoint explicitly on a dedicated port or
for [workers](../../workers.md) and containers without listener e.g.
[application services](../../workers.md#notifying-application-services).
Example configuration #1: Example configuration #1:
```yaml ```yaml
listeners: listeners:

View File

@ -199,6 +199,9 @@ class GenericWorkerServer(HomeServer):
"A 'media' listener is configured but the media" "A 'media' listener is configured but the media"
" repository is disabled. Ignoring." " repository is disabled. Ignoring."
) )
elif name == "health":
# Skip loading, health resource is always included
continue
if name == "openid" and "federation" not in res.names: if name == "openid" and "federation" not in res.names:
# Only load the openid resource separately if federation resource # Only load the openid resource separately if federation resource

View File

@ -96,6 +96,9 @@ class SynapseHomeServer(HomeServer):
# Skip loading openid resource if federation is defined # Skip loading openid resource if federation is defined
# since federation resource will include openid # since federation resource will include openid
continue continue
if name == "health":
# Skip loading, health resource is always included
continue
resources.update(self._configure_named_resource(name, res.compress)) resources.update(self._configure_named_resource(name, res.compress))
additional_resources = listener_config.http_options.additional_resources additional_resources = listener_config.http_options.additional_resources