summary refs log tree commit diff
path: root/docker/start.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2024-05-22 15:01:09 +0100
committerErik Johnston <erik@matrix.org>2024-05-22 15:01:09 +0100
commit56e6abfecc3a386affd2230d442b71dcfd39e3e7 (patch)
treec26295411b35bfe5b138a175f2e05951c7de0047 /docker/start.py
parentReduce work of calculating outbound device pokes (#17211) (diff)
downloadsynapse-56e6abfecc3a386affd2230d442b71dcfd39e3e7.tar.xz
Allow loading modules in Docker image
This is done by mounting a `/modules` directory and installing packages
into that.
Diffstat (limited to '')
-rwxr-xr-xdocker/start.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/docker/start.py b/docker/start.py
index 818a5355ca..bd0ef60420 100755
--- a/docker/start.py
+++ b/docker/start.py
@@ -269,6 +269,15 @@ running with 'migrate_config'. See the README for more details.
 
         args += ["--config-path", config_path]
 
+    # Add the `/modules` directly to python search path, which allows users to
+    # add custom modules.
+    #
+    # We want to add the directory *last* so that nothing can overwrite the
+    # existing package versions. Therefore we load the current path and append
+    # `/modules` to that
+    path = ":".join(sys.path)
+    environ["PYTHONPATH"] = f"{path}:/modules"
+
     log("Starting synapse with args " + " ".join(args))
 
     args = [sys.executable] + args