Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add listener health (#14747)
Browse files Browse the repository at this point in the history
Fixes: #8780
  • Loading branch information
dklimpel committed Jan 11, 2023
1 parent 7b3a8f2 commit 73f0978
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/14747.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a dedicated listener configuration for `health` endpoint.
6 changes: 6 additions & 0 deletions docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ Valid resource names are:

* `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:
```yaml
listeners:
Expand Down
3 changes: 3 additions & 0 deletions synapse/app/generic_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ def _listen_http(self, listener_config: ListenerConfig) -> None:
"A 'media' listener is configured but the media"
" repository is disabled. Ignoring."
)
elif name == "health":
# Skip loading, health resource is always included
continue

if name == "openid" and "federation" not in res.names:
# Only load the openid resource separately if federation resource
Expand Down
3 changes: 3 additions & 0 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def _listener_http(
# Skip loading openid resource if federation is defined
# since federation resource will include openid
continue
if name == "health":
# Skip loading, health resource is always included
continue
resources.update(self._configure_named_resource(name, res.compress))

additional_resources = listener_config.http_options.additional_resources
Expand Down

0 comments on commit 73f0978

Please sign in to comment.