diff options
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 | 30 |
1 files changed, 13 insertions, 17 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 9aafb28..762f82c 100644 --- a/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix +++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix @@ -1,14 +1,10 @@ -{ - config, - pkgs, - lib, - ... -}: +{ config, lib, ... }: let cfg = config.services.matrix-synapse; workers = lib.range 0 (cfg.federationReaders - 1); - routes = [ + workerName = "federation_reader"; + workerRoutes = [ "~ ^/_matrix/federation/(v1|v2)/event/" "~ ^/_matrix/federation/(v1|v2)/state/" "~ ^/_matrix/federation/(v1|v2)/state_ids/" @@ -38,9 +34,9 @@ in settings = { instance_map = lib.listToAttrs ( lib.map (index: { - name = "federation_reader-${toString index}"; + name = "${workerName}-${toString index}"; value = { - path = "/run/matrix-synapse/federation_reader-${toString index}.sock"; + path = "/run/matrix-synapse/${workerName}-${toString index}.sock"; }; }) workers ); @@ -48,13 +44,13 @@ in workers = lib.listToAttrs ( lib.map (index: { - name = "federation_reader-${toString index}"; + name = "${workerName}-${toString index}"; value = { worker_app = "synapse.app.generic_worker"; worker_listeners = [ { type = "http"; - path = "/run/matrix-synapse/federation_reader-${toString index}.sock"; + path = "/run/matrix-synapse/${workerName}-${toString index}.sock"; resources = [ { names = [ "replication" ]; @@ -64,7 +60,7 @@ in } { type = "http"; - path = "/run/matrix-synapse/federation_reader-federation-${toString index}.sock"; + path = "/run/matrix-synapse/${workerName}-federation-${toString index}.sock"; mode = "666"; resources = [ { @@ -76,7 +72,7 @@ in ]; database = ( import ../db.nix { - workerName = "federation_reader-${toString index}"; + workerName = "${workerName}-${toString index}"; dbGroup = "medium"; } ); @@ -85,14 +81,14 @@ in ); }; - services.nginx.upstreams."federation_reader" = { + services.nginx.upstreams."${workerName}" = { extraConfig = '' keepalive 32; hash $request_uri consistent; ''; servers = lib.listToAttrs ( lib.map (index: { - name = "unix:/run/matrix-synapse/federation_reader-federation-${toString index}.sock"; + name = "unix:/run/matrix-synapse/${workerName}-federation-${toString index}.sock"; value = { max_fails = 0; }; @@ -104,9 +100,9 @@ in lib.map (route: { name = route; value = { - proxyPass = "http://federation_reader"; + proxyPass = "http://${workerName}"; }; - }) routes + }) workerRoutes ); }; } |