mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-25 20:49:24 -05:00
Kill off deprecated "config-on-the-fly" docker mode (#6918)
Lots of people seem to get confused by this mode, and it's been deprecated since Synapse 1.1.0. It's time for it to go.
This commit is contained in:
parent
bc831d1d9a
commit
3be2abd0a9
1
changelog.d/6918.docker
Normal file
1
changelog.d/6918.docker
Normal file
@ -0,0 +1 @@
|
|||||||
|
The deprecated "generate-config-on-the-fly" mode is no longer supported.
|
@ -110,12 +110,12 @@ argument to `docker run`.
|
|||||||
|
|
||||||
## Legacy dynamic configuration file support
|
## Legacy dynamic configuration file support
|
||||||
|
|
||||||
For backwards-compatibility only, the docker image supports creating a dynamic
|
The docker image used to support creating a dynamic configuration file based
|
||||||
configuration file based on environment variables. This is now deprecated, but
|
on environment variables. This is no longer supported, and an error will be
|
||||||
is enabled when the `SYNAPSE_SERVER_NAME` variable is set (and `generate` is
|
raised if you try to run synapse without a config file.
|
||||||
not given).
|
|
||||||
|
|
||||||
To migrate from a dynamic configuration file to a static one, run the docker
|
It is, however, possible to generate a static configuration file based on
|
||||||
|
the environment variables that were previously used. To do this, run the docker
|
||||||
container once with the environment variables set, and `migrate_config`
|
container once with the environment variables set, and `migrate_config`
|
||||||
command line option. For example:
|
command line option. For example:
|
||||||
|
|
||||||
@ -127,9 +127,14 @@ docker run -it --rm \
|
|||||||
matrixdotorg/synapse:latest migrate_config
|
matrixdotorg/synapse:latest migrate_config
|
||||||
```
|
```
|
||||||
|
|
||||||
This will generate the same configuration file as the legacy mode used, but
|
This will generate the same configuration file as the legacy mode used, and
|
||||||
will store it in `/data/homeserver.yaml` instead of a temporary location. You
|
will store it in `/data/homeserver.yaml`. You can then use it as shown above at
|
||||||
can then use it as shown above at [Running synapse](#running-synapse).
|
[Running synapse](#running-synapse).
|
||||||
|
|
||||||
|
Note that the defaults used in this configuration file may be different to
|
||||||
|
those when generating a new config file with `generate`: for example, TLS is
|
||||||
|
enabled by default in this mode. You are encouraged to inspect the generated
|
||||||
|
configuration file and edit it to ensure it meets your needs.
|
||||||
|
|
||||||
## Building the image
|
## Building the image
|
||||||
|
|
||||||
|
@ -188,11 +188,6 @@ def main(args, environ):
|
|||||||
else:
|
else:
|
||||||
ownership = "{}:{}".format(desired_uid, desired_gid)
|
ownership = "{}:{}".format(desired_uid, desired_gid)
|
||||||
|
|
||||||
log(
|
|
||||||
"Container running as UserID %s:%s, ENV (or defaults) requests %s:%s"
|
|
||||||
% (os.getuid(), os.getgid(), desired_uid, desired_gid)
|
|
||||||
)
|
|
||||||
|
|
||||||
if ownership is None:
|
if ownership is None:
|
||||||
log("Will not perform chmod/su-exec as UserID already matches request")
|
log("Will not perform chmod/su-exec as UserID already matches request")
|
||||||
|
|
||||||
@ -213,30 +208,22 @@ def main(args, environ):
|
|||||||
if mode is not None:
|
if mode is not None:
|
||||||
error("Unknown execution mode '%s'" % (mode,))
|
error("Unknown execution mode '%s'" % (mode,))
|
||||||
|
|
||||||
if "SYNAPSE_SERVER_NAME" in environ:
|
config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
|
||||||
# backwards-compatibility generate-a-config-on-the-fly mode
|
config_path = environ.get("SYNAPSE_CONFIG_PATH", config_dir + "/homeserver.yaml")
|
||||||
if "SYNAPSE_CONFIG_PATH" in environ:
|
|
||||||
error(
|
|
||||||
"SYNAPSE_SERVER_NAME can only be combined with SYNAPSE_CONFIG_PATH "
|
|
||||||
"in `generate` or `migrate_config` mode. To start synapse using a "
|
|
||||||
"config file, unset the SYNAPSE_SERVER_NAME environment variable."
|
|
||||||
)
|
|
||||||
|
|
||||||
config_path = "/compiled/homeserver.yaml"
|
if not os.path.exists(config_path):
|
||||||
log(
|
if "SYNAPSE_SERVER_NAME" in environ:
|
||||||
"Generating config file '%s' on-the-fly from environment variables.\n"
|
error(
|
||||||
"Note that this mode is deprecated. You can migrate to a static config\n"
|
"""\
|
||||||
"file by running with 'migrate_config'. See the README for more details."
|
Config file '%s' does not exist.
|
||||||
|
|
||||||
|
The synapse docker image no longer supports generating a config file on-the-fly
|
||||||
|
based on environment variables. You can migrate to a static config file by
|
||||||
|
running with 'migrate_config'. See the README for more details.
|
||||||
|
"""
|
||||||
% (config_path,)
|
% (config_path,)
|
||||||
)
|
)
|
||||||
|
|
||||||
generate_config_from_template("/compiled", config_path, environ, ownership)
|
|
||||||
else:
|
|
||||||
config_dir = environ.get("SYNAPSE_CONFIG_DIR", "/data")
|
|
||||||
config_path = environ.get(
|
|
||||||
"SYNAPSE_CONFIG_PATH", config_dir + "/homeserver.yaml"
|
|
||||||
)
|
|
||||||
if not os.path.exists(config_path):
|
|
||||||
error(
|
error(
|
||||||
"Config file '%s' does not exist. You should either create a new "
|
"Config file '%s' does not exist. You should either create a new "
|
||||||
"config file by running with the `generate` argument (and then edit "
|
"config file by running with the `generate` argument (and then edit "
|
||||||
|
Loading…
Reference in New Issue
Block a user