Skip to content
Snippets Groups Projects
Commit 28e30c65 authored by Richard van der Hoff's avatar Richard van der Hoff
Browse files

Docker: generate our own log config

When running under docker, we want to use docker's own logging stuff rather
than losing the logs somewhere on the container's filesystem, so let's use log
configs that spit logs out to stdout instead.
parent 6347dc1b
No related branches found
No related tags found
No related merge requests found
...@@ -116,9 +116,16 @@ def run_generate_config(environ, ownership): ...@@ -116,9 +116,16 @@ def run_generate_config(environ, ownership):
if v not in environ: if v not in environ:
error("Environment variable '%s' is mandatory in `generate` mode." % (v,)) error("Environment variable '%s' is mandatory in `generate` mode." % (v,))
server_name = environ["SYNAPSE_SERVER_NAME"]
config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data") config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
data_dir = environ.get("SYNAPSE_DATA_DIR", "/data") data_dir = environ.get("SYNAPSE_DATA_DIR", "/data")
# 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):
log("Creating log config %s" % (log_config_file,))
convert("/conf/log.config", log_config_file, environ)
# make sure that synapse has perms to write to the data dir. # make sure that synapse has perms to write to the data dir.
subprocess.check_output(["chown", ownership, data_dir]) subprocess.check_output(["chown", ownership, data_dir])
...@@ -127,7 +134,7 @@ def run_generate_config(environ, ownership): ...@@ -127,7 +134,7 @@ def run_generate_config(environ, ownership):
"-m", "-m",
"synapse.app.homeserver", "synapse.app.homeserver",
"--server-name", "--server-name",
environ["SYNAPSE_SERVER_NAME"], server_name,
"--report-stats", "--report-stats",
environ["SYNAPSE_REPORT_STATS"], environ["SYNAPSE_REPORT_STATS"],
"--config-path", "--config-path",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment