diff options
author | Sam Wedgwood <28223854+swedgwood@users.noreply.github.com> | 2024-03-21 17:55:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 17:55:44 +0000 |
commit | bef765b2624a16a9f896aab670b4509c8b06628e (patch) | |
tree | 07247fb3a566894e080ce66cd8a0df5252c919ec | |
parent | Bump dawidd6/action-download-artifact from 3.1.2 to 3.1.4 (#17008) (diff) | |
download | synapse-bef765b2624a16a9f896aab670b4509c8b06628e.tar.xz |
generate configuration with correct user in start.py for docker (#16978)
Diffstat (limited to '')
-rw-r--r-- | changelog.d/16978.docker | 1 | ||||
-rwxr-xr-x | docker/start.py | 15 |
2 files changed, 9 insertions, 7 deletions
diff --git a/changelog.d/16978.docker b/changelog.d/16978.docker new file mode 100644 index 0000000000..2e095c6aa9 --- /dev/null +++ b/changelog.d/16978.docker @@ -0,0 +1 @@ +Updated start.py to generate config using the correct user ID when running as root (fixes #16824, #15202). diff --git a/docker/start.py b/docker/start.py index 12c444da9a..818a5355ca 100755 --- a/docker/start.py +++ b/docker/start.py @@ -160,11 +160,6 @@ def run_generate_config(environ: Mapping[str, str], ownership: Optional[str]) -> config_path = environ.get("SYNAPSE_CONFIG_PATH", config_dir + "/homeserver.yaml") data_dir = environ.get("SYNAPSE_DATA_DIR", "/data") - if ownership is not None: - # make sure that synapse has perms to write to the data dir. - log(f"Setting ownership on {data_dir} to {ownership}") - subprocess.run(["chown", ownership, data_dir], check=True) - # create a suitable log config from our template log_config_file = "%s/%s.log.config" % (config_dir, server_name) if not os.path.exists(log_config_file): @@ -189,9 +184,15 @@ def run_generate_config(environ: Mapping[str, str], ownership: Optional[str]) -> "--generate-config", "--open-private-ports", ] + + if ownership is not None: + # make sure that synapse has perms to write to the data dir. + log(f"Setting ownership on {data_dir} to {ownership}") + subprocess.run(["chown", ownership, data_dir], check=True) + args = ["gosu", ownership] + args + # log("running %s" % (args, )) - flush_buffers() - os.execv(sys.executable, args) + subprocess.run(args, check=True) def main(args: List[str], environ: MutableMapping[str, str]) -> None: |