Merge pull request #140979 from Ma27/matrix-workers
nixos/matrix-synapse: minor improvements to implement worker-support
This commit is contained in:
commit
cbfe4a42f6
|
@ -122,6 +122,14 @@ in {
|
||||||
options = {
|
options = {
|
||||||
services.matrix-synapse = {
|
services.matrix-synapse = {
|
||||||
enable = mkEnableOption "matrix.org synapse";
|
enable = mkEnableOption "matrix.org synapse";
|
||||||
|
configFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
readOnly = true;
|
||||||
|
description = ''
|
||||||
|
Path to the configuration file on the target system. Useful to configure e.g. workers
|
||||||
|
that also need this.
|
||||||
|
'';
|
||||||
|
};
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.matrix-synapse;
|
default = pkgs.matrix-synapse;
|
||||||
|
@ -706,6 +714,8 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.matrix-synapse.configFile = "${configFile}";
|
||||||
|
|
||||||
users.users.matrix-synapse = {
|
users.users.matrix-synapse = {
|
||||||
group = "matrix-synapse";
|
group = "matrix-synapse";
|
||||||
home = cfg.dataDir;
|
home = cfg.dataDir;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
From 36ffbb7ad2c535180cae473b470a43f9db4fbdcd Mon Sep 17 00:00:00 2001
|
From 36ffbb7ad2c535180cae473b470a43f9db4fbdcd Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Bosch <maximilian@mbosch.me>
|
From: Maximilian Bosch <maximilian@mbosch.me>
|
||||||
Date: Mon, 16 Aug 2021 13:27:28 +0200
|
Date: Mon, 16 Aug 2021 13:27:28 +0200
|
||||||
Subject: [PATCH] setup: add homeserver as console script
|
Subject: [PATCH 1/2] setup: add homeserver as console script
|
||||||
|
|
||||||
With this change, it will be added to `$out/bin` in `nixpkgs` directly.
|
With this change, it will be added to `$out/bin` in `nixpkgs` directly.
|
||||||
This became necessary since our old workaround, calling it as script,
|
This became necessary since our old workaround, calling it as script,
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
From 3089758015c64cc1e6788793c4fe40a0e1783457 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Maximilian Bosch <maximilian@mbosch.me>
|
||||||
|
Date: Tue, 5 Oct 2021 22:33:12 +0200
|
||||||
|
Subject: [PATCH 2/2] Expose generic worker as binary under NixOS
|
||||||
|
|
||||||
|
---
|
||||||
|
setup.py | 3 ++-
|
||||||
|
synapse/app/generic_worker.py | 6 +++++-
|
||||||
|
2 files changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 27f1d842c..6383aed6f 100755
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -135,7 +135,8 @@ setup(
|
||||||
|
python_requires="~=3.6",
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
- 'homeserver = synapse.app.homeserver:main'
|
||||||
|
+ 'homeserver = synapse.app.homeserver:main',
|
||||||
|
+ 'worker = synapse.app.generic_worker:main'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
classifiers=[
|
||||||
|
diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py
|
||||||
|
index 3b7131af8..c77a6a95c 100644
|
||||||
|
--- a/synapse/app/generic_worker.py
|
||||||
|
+++ b/synapse/app/generic_worker.py
|
||||||
|
@@ -491,6 +491,10 @@ def start(config_options):
|
||||||
|
_base.start_worker_reactor("synapse-generic-worker", config)
|
||||||
|
|
||||||
|
|
||||||
|
-if __name__ == "__main__":
|
||||||
|
+def main():
|
||||||
|
with LoggingContext("main"):
|
||||||
|
start(sys.argv[1:])
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+if __name__ == "__main__":
|
||||||
|
+ main()
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
|
@ -36,6 +36,7 @@ buildPythonApplication rec {
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./0001-setup-add-homeserver-as-console-script.patch
|
./0001-setup-add-homeserver-as-console-script.patch
|
||||||
|
./0002-Expose-generic-worker-as-binary-under-NixOS.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [ openssl ];
|
buildInputs = [ openssl ];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user