summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-06-25 18:23:17 +0100
committerRichard van der Hoff <richard@matrix.org>2019-06-26 15:48:38 +0100
commit28e30c6581b051c13d53d5abc6eab8b6c7d0f96f (patch)
treecb26a61693fa17b351ed24f4267027b68e1a12f1
parentAdd support for SYNAPSE_CONFIG_DIR (diff)
downloadsynapse-28e30c6581b051c13d53d5abc6eab8b6c7d0f96f.tar.xz
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.
-rwxr-xr-xdocker/start.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/docker/start.py b/docker/start.py
index 99107a9d54..06b38ec9db 100755
--- a/docker/start.py
+++ b/docker/start.py
@@ -116,9 +116,16 @@ def run_generate_config(environ, ownership):
         if v not in environ:
             error("Environment variable '%s' is mandatory in `generate` mode." % (v,))
 
+    server_name = environ["SYNAPSE_SERVER_NAME"]
     config_dir = environ.get("SYNAPSE_CONFIG_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.
     subprocess.check_output(["chown", ownership, data_dir])
 
@@ -127,7 +134,7 @@ def run_generate_config(environ, ownership):
         "-m",
         "synapse.app.homeserver",
         "--server-name",
-        environ["SYNAPSE_SERVER_NAME"],
+        server_name,
         "--report-stats",
         environ["SYNAPSE_REPORT_STATS"],
         "--config-path",