diff options
author | Rory& <root@rory.gay> | 2024-08-16 14:39:37 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-08-16 14:39:37 +0200 |
commit | 4a60627f7f5f4e6a64a93635bd0df2c7f6b2cd17 (patch) | |
tree | 8159e19ce6762e40f538a9a40f11b05eb4da7d09 /host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix | |
parent | Unify single workers (diff) | |
download | Rory-Open-Architecture-4a60627f7f5f4e6a64a93635bd0df2c7f6b2cd17.tar.xz |
Start reworking other workers
Diffstat (limited to 'host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix')
-rw-r--r-- | host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix | 85 |
1 files changed, 50 insertions, 35 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix b/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix index ceefefb..29223d7 100644 --- a/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix +++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix @@ -3,35 +3,37 @@ let cfg = config.services.matrix-synapse; dbGroup = "medium"; - hasClientResource = false; - hasFederationResource = false; workers = lib.range 0 (cfg.federationReaders - 1); workerName = "federation_reader"; - workerRoutes = [ - "~ ^/_matrix/federation/(v1|v2)/event/" - "~ ^/_matrix/federation/(v1|v2)/state/" - "~ ^/_matrix/federation/(v1|v2)/state_ids/" - "~ ^/_matrix/federation/(v1|v2)/backfill/" - "~ ^/_matrix/federation/(v1|v2)/get_missing_events/" - "~ ^/_matrix/federation/(v1|v2)/publicRooms" - "~ ^/_matrix/federation/(v1|v2)/query/" - "~ ^/_matrix/federation/(v1|v2)/make_join/" - "~ ^/_matrix/federation/(v1|v2)/make_leave/" - "~ ^/_matrix/federation/(v1|v2)/send_join/" - "~ ^/_matrix/federation/(v1|v2)/send_leave/" - "~ ^/_matrix/federation/v1/make_knock/" - "~ ^/_matrix/federation/v1/send_knock/" - "~ ^/_matrix/federation/(v1|v2)/invite/" - "~ ^/_matrix/federation/(v1|v2)/query_auth/" - "~ ^/_matrix/federation/(v1|v2)/event_auth/" - "~ ^/_matrix/federation/v1/timestamp_to_event/" - "~ ^/_matrix/federation/(v1|v2)/exchange_third_party_invite/" - "~ ^/_matrix/federation/(v1|v2)/user/devices/" - "~ ^/_matrix/federation/(v1|v2)/get_groups_publicised$" - "~ ^/_matrix/key/v2/query" - # extra - "~ ^/_matrix/key/v2/server$" - ]; + workerRoutes = { + client = [ ]; + federation = [ + "~ ^/_matrix/federation/(v1|v2)/event/" + "~ ^/_matrix/federation/(v1|v2)/state/" + "~ ^/_matrix/federation/(v1|v2)/state_ids/" + "~ ^/_matrix/federation/(v1|v2)/backfill/" + "~ ^/_matrix/federation/(v1|v2)/get_missing_events/" + "~ ^/_matrix/federation/(v1|v2)/publicRooms" + "~ ^/_matrix/federation/(v1|v2)/query/" + "~ ^/_matrix/federation/(v1|v2)/make_join/" + "~ ^/_matrix/federation/(v1|v2)/make_leave/" + "~ ^/_matrix/federation/(v1|v2)/send_join/" + "~ ^/_matrix/federation/(v1|v2)/send_leave/" + "~ ^/_matrix/federation/v1/make_knock/" + "~ ^/_matrix/federation/v1/send_knock/" + "~ ^/_matrix/federation/(v1|v2)/invite/" + "~ ^/_matrix/federation/(v1|v2)/query_auth/" + "~ ^/_matrix/federation/(v1|v2)/event_auth/" + "~ ^/_matrix/federation/v1/timestamp_to_event/" + "~ ^/_matrix/federation/(v1|v2)/exchange_third_party_invite/" + "~ ^/_matrix/federation/(v1|v2)/user/devices/" + "~ ^/_matrix/federation/(v1|v2)/get_groups_publicised$" + "~ ^/_matrix/key/v2/query" + # extra + "~ ^/_matrix/key/v2/server$" + ]; + media = [ ]; + }; in { config = lib.mkIf (cfg.federationReaders > 0) { @@ -101,13 +103,26 @@ in ); }; - services.nginx.virtualHosts."${cfg.nginxVirtualHostName}".locations = lib.listToAttrs ( - lib.map (route: { - name = route; - value = { - proxyPass = "http://${workerName}"; - }; - }) workerRoutes - ); + services.nginx = { + virtualHosts."${cfg.nginxVirtualHostName}".locations = lib.listToAttrs ( + lib.flatten ( + lib.forEach + [ + "client" + "federation" + "media" + ] + ( + type: + lib.map (route: { + name = route; + value = { + proxyPass = "http://unix:/run/matrix-synapse/${workerName}-${type}.sock"; + }; + }) workerRoutes.${type} + ) + ) + ); + }; }; } |