From 04c14636a2abff4620b94d0040507c63f52ab1d3 Mon Sep 17 00:00:00 2001 From: Hans van Zijst Date: Thu, 19 Dec 2024 14:03:27 +0100 Subject: [PATCH] Added mediaworker. --- matrix/draupnir/README.md | 2 +- matrix/synapse/workers.md | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/matrix/draupnir/README.md b/matrix/draupnir/README.md index 2d3c350..94fa8f3 100644 --- a/matrix/draupnir/README.md +++ b/matrix/draupnir/README.md @@ -54,7 +54,7 @@ Copy it to `production.yaml` and change what you must. | Option | Value | Meaning | | :---- | :---- | :---- | | `homeserverUrl` | `http://localhost:8008` | Where to communicate with Synapse when using network port| -| `homeserverUrl` | `http://unix://run/matrix-synapse/incoming_main.sock` | Where to communicate with Synapse when using UNIX sockets (see [Workers](../synapse/workers.md)) | +| `homeserverUrl` | `http://unix:/run/matrix-synapse/incoming_main.sock` | Where to communicate with Synapse when using UNIX sockets (see [Workers](../synapse/workers.md)) | | `rawHomeserverUrl` | `https://matrix.example.com` | Same as `server_name` | | `accessToken` | access token | Copy from login session or create in [Synapse Admin](../synapse-admin)) | | `password` | password | Password for the account | diff --git a/matrix/synapse/workers.md b/matrix/synapse/workers.md index 2475880..bf5e021 100644 --- a/matrix/synapse/workers.md +++ b/matrix/synapse/workers.md @@ -252,6 +252,9 @@ chown matrix-synapse:matrix-synapse /etc/matrix-synapse/workers chmod 750 /etc/matrix-synapse-workers ``` + +### Generic worker + Workers look very much the same, very little configuration is needed. This is what you need: @@ -306,6 +309,44 @@ the network. This creates extra overhead, so you want to use sockets whenever possible. +### Media worker + +The media worker is slightly different than the generic one. It doesn't use the +`synapse.app.generic_worker`, but a specialised one: `synapse.app.media_repository`. +To prevent the main process from handling media itself, you have to explicitly +tell it to leave that to the worker, by adding this to the configuration (in +our setup `conf.d/listeners.yaml`): + +``` +enable_media_repo: false +media_instance_running_background_jobs: mediaworker +``` + +The worker `mediaworker` looks like this: + +``` +worker_app: "synapse.app.media_repository" +worker_name: "mediaworker" +worker_log_config: "/etc/matrix-synapse/logconf.d/media.yaml" + +worker_listeners: + - path: "/run/matrix-synapse/inbound_mediaworker.sock" + type: http + resources: + - names: + - media + - federation + + - path: "/run/matrix-synapse/replication_mediaworker.sock" + type: http + resources: + - names: [replication] +``` + +If you use more than one mediaworker, know that they must all run on the same +machine; scaling it over more than one machine will not work. + + ## Worker logging As stated before, you configure the logging of workers in a separate yaml