summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-11-30 17:52:45 +0100
committerGitHub <noreply@github.com>2021-11-30 16:52:45 +0000
commit42bf0204635213e2c75188b19ee66dc7e7d8a35e (patch)
treed7d04296b0ec8a15e198eae800a84ceb1ee262f5
parentBundle relations of relations into the `/relations` result. (#11284) (diff)
downloadsynapse-42bf0204635213e2c75188b19ee66dc7e7d8a35e.tar.xz
Expose worker & homeserver as entrypoints in `setup.py` (#11449)
Co-authored-by: reivilibre <oliverw@matrix.org>
-rw-r--r--changelog.d/11449.feature1
-rwxr-xr-xsetup.py6
-rw-r--r--synapse/app/generic_worker.py6
3 files changed, 12 insertions, 1 deletions
diff --git a/changelog.d/11449.feature b/changelog.d/11449.feature
new file mode 100644
index 0000000000..94bc175db9
--- /dev/null
+++ b/changelog.d/11449.feature
@@ -0,0 +1 @@
+Expose synapse_homeserver and synapse_worker commands as entry points to run Synapse's main process and worker processes, respectively. Contributed by @Ma27.
diff --git a/setup.py b/setup.py
index ad99b3bd2c..2c6fb9aacb 100755
--- a/setup.py
+++ b/setup.py
@@ -152,6 +152,12 @@ setup(
     long_description=long_description,
     long_description_content_type="text/x-rst",
     python_requires="~=3.6",
+    entry_points={
+        "console_scripts": [
+            "synapse_homeserver = synapse.app.homeserver:main",
+            "synapse_worker = synapse.app.generic_worker:main",
+        ]
+    },
     classifiers=[
         "Development Status :: 5 - Production/Stable",
         "Topic :: Communications :: Chat",
diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py
index b4bed5bf40..e256de2003 100644
--- a/synapse/app/generic_worker.py
+++ b/synapse/app/generic_worker.py
@@ -505,6 +505,10 @@ def start(config_options: List[str]) -> None:
     _base.start_worker_reactor("synapse-generic-worker", config)
 
 
-if __name__ == "__main__":
+def main() -> None:
     with LoggingContext("main"):
         start(sys.argv[1:])
+
+
+if __name__ == "__main__":
+    main()