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

Add listener health #14747

Merged
merged 2 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
18 changes: 12 additions & 6 deletions docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,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 Expand Up @@ -2514,18 +2520,18 @@ state events are shared with users:
- `m.room.topic`

To change the default behavior, use the following sub-options:
* `disable_default_event_types`: boolean. Set to `true` to disable the above
* `disable_default_event_types`: boolean. Set to `true` to disable the above
defaults. If this is enabled, only the event types listed in
`additional_event_types` are shared. Defaults to `false`.
* `additional_event_types`: A list of additional state events to include in the
events to be shared. By default, this list is empty (so only the default event
* `additional_event_types`: A list of additional state events to include in the
events to be shared. By default, this list is empty (so only the default event
types are shared).

Each entry in this list should be either a single string or a list of two
strings.
strings.
* A standalone string `t` represents all events with type `t` (i.e.
with no restrictions on state keys).
* A pair of strings `[t, s]` represents a single event with type `t` and
* A pair of strings `[t, s]` represents a single event with type `t` and
state key `s`. The same type can appear in two entries with different state
keys: in this situation, both state keys are included in prejoin state.

Expand Down Expand Up @@ -2996,7 +3002,7 @@ Options for each entry include:
* `picture_claim`: name of the claim containing an url for the user's profile picture.
Defaults to 'picture', which OpenID Connect compliant providers should provide
and has to refer to a direct image file such as PNG, JPEG, or GIF image file.

Currently only supported in monolithic (single-process) server configurations
where the media repository runs within the Synapse process.

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