diff options
author | Rory& <root@rory.gay> | 2024-08-16 12:16:21 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-08-16 12:16:21 +0200 |
commit | 9778db57511950cda9d5c0f8955597d6b2282302 (patch) | |
tree | e946d27d44b425986240dd731afea7944894df1a /host/Rory-nginx/services/matrix/synapse/workers/single/background.nix | |
parent | Nginx log request times (diff) | |
download | Rory-Open-Architecture-9778db57511950cda9d5c0f8955597d6b2282302.tar.xz |
Some synapse workers cleanup
Diffstat (limited to 'host/Rory-nginx/services/matrix/synapse/workers/single/background.nix')
-rw-r--r-- | host/Rory-nginx/services/matrix/synapse/workers/single/background.nix | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix b/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix new file mode 100644 index 0000000..acc423d --- /dev/null +++ b/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix @@ -0,0 +1,79 @@ +{ config, lib, ... }: + +let + cfg = config.services.matrix-synapse; + dbGroup = "small"; + hasClientResource = false; + hasFederationResource = false; + workerName = "background"; + workerRoutes = [ ]; +in +{ + config = lib.mkIf cfg.enableBackgroundWorker { + services.matrix-synapse = { + settings = { + instance_map = { + ${workerName} = { + path = "/run/matrix-synapse/${workerName}.sock"; + }; + }; + + run_background_tasks_on = workerName; + }; + + workers = { + ${workerName} = { + worker_app = "synapse.app.generic_worker"; + worker_listeners = + [ + { + type = "http"; + path = "/run/matrix-synapse/${workerName}.sock"; + resources = [ + { + names = [ "replication" ]; + compress = false; + } + ]; + } + ] + ++ lib.optional hasClientResource { + type = "http"; + path = "/run/matrix-synapse/${workerName}-client.sock"; + mode = "666"; + resources = [ + { + names = [ "client" ]; + compress = false; + } + ]; + } + ++ lib.optional hasFederationResource { + type = "http"; + path = "/run/matrix-synapse/${workerName}-federation.sock"; + mode = "666"; + resources = [ + { + names = [ "federation" ]; + compress = false; + } + ]; + }; + + database = (import ../../db.nix { inherit workerName dbGroup; }); + }; + }; + }; + + services.nginx = { + virtualHosts."${cfg.nginxVirtualHostName}".locations = lib.listToAttrs ( + lib.map (route: { + name = route; + value = { + proxyPass = "http://${workerName}"; + }; + }) workerRoutes + ); + }; + }; +} |