forked-synapse/synapse/app
Jason Little 56efa9b167
Experimental Unix socket support (#15353)
* Add IReactorUNIX to ISynapseReactor type hint.

* Create listen_unix().

Two options, 'path' to the file and 'mode' of permissions(not umask, recommend 666 as default as
nginx/other reverse proxies write to it and it's setup as user www-data)

For the moment, leave the option to always create a PID lockfile turned on by default

* Create UnixListenerConfig and wire it up.

Rename ListenerConfig to TCPListenerConfig, then Union them together into ListenerConfig.
This spidered around a bit, but I think I got it all. Metrics and manhole have been placed
behind a conditional in case of accidental putting them onto a unix socket.

Use new helpers to get if a listener is configured for TLS, and to help create a site tag
for logging.

There are 2 TODO things in parse_listener_def() to finish up at a later point.

* Refactor SynapseRequest to handle logging correctly when using a unix socket.

This prevents an exception when an IP address can not be retrieved for a request.

* Make the 'Synapse now listening on Unix socket' log line a little prettier.

* No silent failures on generic workers when trying to use a unix socket with metrics or manhole.

* Inline variables in app/_base.py

* Update docstring for listen_unix() to remove reference to a hardcoded permission of 0o666 and add a few comments saying where the default IS declared.

* Disallow both a unix socket and a ip/port combo on the same listener resource

* Linting

* Changelog

* review: simplify how listen_unix returns(and get rid of a type: ignore)

* review: fix typo from ConfigError in app/homeserver.py

* review: roll conditional for http_options.tag into get_site_tag() helper(and add docstring)

* review: enhance the conditionals for checking if a port or path is valid, remove a TODO line

* review: Try updating comment in get_client_ip_if_available to clarify what is being retrieved and why

* Pretty up how 'Synapse now listening on Unix Socket' looks by decoding the byte string.

* review: In parse_listener_def(), raise ConfigError if neither socket_path nor port is declared(and fix a typo)
2023-04-03 10:27:51 +01:00
..
__init__.py Use importlib.metadata to read requirements (#12088) 2022-03-01 17:44:41 +00:00
_base.py Experimental Unix socket support (#15353) 2023-04-03 10:27:51 +01:00
admin_cmd.py Add information on uploaded media to user export command. (#15107) 2023-02-23 13:14:17 -05:00
appservice.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
client_reader.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
complement_fork_starter.py Bump black from 22.12.0 to 23.1.0 (#15103) 2023-02-22 15:29:09 -05:00
event_creator.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
federation_reader.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
federation_sender.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
frontend_proxy.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
generic_worker.py Experimental Unix socket support (#15353) 2023-04-03 10:27:51 +01:00
homeserver.py Experimental Unix socket support (#15353) 2023-04-03 10:27:51 +01:00
media_repository.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
phone_stats_home.py Return read-only collections from @cached methods (#13755) 2023-02-10 23:29:00 +00:00
pusher.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
synchrotron.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00
user_dir.py Refactor entry points so that they all have a main function. (#13052) 2022-06-14 17:41:06 +00:00