summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-06-27 11:19:37 +0100
committerGitHub <noreply@github.com>2019-06-27 11:19:37 +0100
commitb4db70e1676be291fe3da7b71b753f5db67d65b5 (patch)
treeb013cfb241562d7159ab032198beab314607720b
parentReduce the amount of stuff we send in the docker context (#5564) (diff)
parentchangelog (diff)
downloadsynapse-b4db70e1676be291fe3da7b71b753f5db67d65b5.tar.xz
Merge pull request #5565 from matrix-org/rav/docker/fix_log_config
Docker: generate our own log config
-rw-r--r--changelog.d/5565.feature1
-rw-r--r--docker/README.md2
-rwxr-xr-xdocker/start.py12
3 files changed, 14 insertions, 1 deletions
diff --git a/changelog.d/5565.feature b/changelog.d/5565.feature
new file mode 100644
index 0000000000..4b0665af03
--- /dev/null
+++ b/changelog.d/5565.feature
@@ -0,0 +1 @@
+Docker: Send synapse logs to the docker logging system, by default.
diff --git a/docker/README.md b/docker/README.md
index 5c85c538a8..a42d1d24b6 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -186,6 +186,8 @@ The following environment variables are supported in this mode:
 * `SYNAPSE_REPORT_STATS` (mandatory, `yes` or `no`): whether to enable
   anonymous statistics reporting.
 * `SYNAPSE_CONFIG_PATH` (mandatory): path to the file to be generated.
+* `SYNAPSE_CONFIG_DIR`: where additional config files (such as the log config
+  and event signing key) will be stored. Defaults to `/data`.
 * `SYNAPSE_DATA_DIR`: where the generated config will put persistent data
   such as the datatase and media store. Defaults to `/data`.
 * `UID`, `GID`: the user id and group id to use for creating the data
diff --git a/docker/start.py b/docker/start.py
index 1e6acb464c..fdc3d59d86 100755
--- a/docker/start.py
+++ b/docker/start.py
@@ -135,8 +135,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])
 
@@ -145,11 +153,13 @@ 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",
         environ["SYNAPSE_CONFIG_PATH"],
+        "--config-directory",
+        config_dir,
         "--data-directory",
         data_dir,
         "--generate-config",