Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --generate-only option to the Complement launcher. #16828

Merged
merged 2 commits into from Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/16828.misc
@@ -0,0 +1 @@
Add a `--generate-only` option to the Complement launcher.
15 changes: 14 additions & 1 deletion docker/configure_workers_and_start.py
Expand Up @@ -58,6 +58,7 @@
import re
import subprocess
import sys
from argparse import ArgumentParser
from collections import defaultdict
from itertools import chain
from pathlib import Path
Expand Down Expand Up @@ -1024,6 +1025,14 @@ def generate_worker_log_config(


def main(args: List[str], environ: MutableMapping[str, str]) -> None:
parser = ArgumentParser()
parser.add_argument(
"--generate-only",
action="store_true",
help="Only generate configuration; don't run Synapse.",
)
opts = parser.parse_args(args)

config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
config_path = environ.get("SYNAPSE_CONFIG_PATH", config_dir + "/homeserver.yaml")
data_dir = environ.get("SYNAPSE_DATA_DIR", "/data")
Expand Down Expand Up @@ -1065,6 +1074,10 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:
else:
log("Worker config exists—not regenerating")

if opts.generate_only:
log("--generate-only: won't run Synapse")
return

# Lifted right out of start.py
jemallocpath = "/usr/lib/%s-linux-gnu/libjemalloc.so.2" % (platform.machine(),)

Expand All @@ -1087,4 +1100,4 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:


if __name__ == "__main__":
main(sys.argv, os.environ)
main(sys.argv[1:], os.environ)