diff options
author | Rory& <root@rory.gay> | 2024-08-04 05:08:05 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-08-04 05:08:05 +0200 |
commit | 4402873891edace4b678af537236ff1d81bba585 (patch) | |
tree | 343f32b070b98eaba7e11ab77bd27ce98a464bc7 /host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix | |
parent | Update flake lock (diff) | |
download | Rory-Open-Architecture-4402873891edace4b678af537236ff1d81bba585.tar.xz |
Server config cleanup
Diffstat (limited to 'host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix')
-rw-r--r-- | host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix b/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix index ff7352b..c89b147 100644 --- a/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix +++ b/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix @@ -1,13 +1,9 @@ -{ - config, - pkgs, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.services.matrix-synapse; workers = lib.range 0 (cfg.clientReaders - 1); + workerName = "client_reader"; routes = [ "~ ^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$" "~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$" @@ -44,9 +40,9 @@ in settings = { instance_map = lib.listToAttrs ( lib.map (index: { - name = "client_reader-${toString index}"; + name = "${workerName}-${toString index}"; value = { - path = "/run/matrix-synapse/client_reader-${toString index}.sock"; + path = "/run/matrix-synapse/${workerName}-${toString index}.sock"; }; }) workers ); @@ -54,13 +50,13 @@ in workers = lib.listToAttrs ( lib.map (index: { - name = "client_reader-${toString index}"; + name = "${workerName}-${toString index}"; value = { worker_app = "synapse.app.generic_worker"; worker_listeners = [ { type = "http"; - path = "/run/matrix-synapse/client_reader-${toString index}.sock"; + path = "/run/matrix-synapse/${workerName}-${toString index}.sock"; resources = [ { names = [ "replication" ]; @@ -70,7 +66,7 @@ in } { type = "http"; - path = "/run/matrix-synapse/client_reader-client-${toString index}.sock"; + path = "/run/matrix-synapse/${workerName}-client-${toString index}.sock"; mode = "666"; resources = [ { @@ -82,7 +78,7 @@ in ]; database = ( import ../db.nix { - workerName = "client_reader-${toString index}"; + workerName = "${workerName}-${toString index}"; dbGroup = "medium"; } ); @@ -91,13 +87,13 @@ in ); }; - services.nginx.upstreams."client_reader" = { + services.nginx.upstreams."${workerName}" = { extraConfig = '' keepalive 32; ''; servers = lib.listToAttrs ( lib.map (index: { - name = "unix:/run/matrix-synapse/client_reader-client-${toString index}.sock"; + name = "unix:/run/matrix-synapse/${workerName}-client-${toString index}.sock"; value = { max_fails = 0; }; @@ -109,7 +105,7 @@ in lib.map (route: { name = route; value = { - proxyPass = "http://client_reader"; + proxyPass = "http://${workerName}"; }; }) routes ); |