Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5565 from matrix-org/rav/docker/fix_log_config
Browse files Browse the repository at this point in the history
Docker: generate our own log config
  • Loading branch information
richvdh authored Jun 27, 2019
2 parents b2d2617 + befa116 commit b4db70e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/5565.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Docker: Send synapse logs to the docker logging system, by default.
2 changes: 2 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion docker/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand All @@ -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",
Expand Down

0 comments on commit b4db70e

Please sign in to comment.