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

Configuration files should be more templatable in the standard images #11489

Open
@michaelkaye

Description

Description:

In container driven worlds, when simple templating of a config file is desired, there are a few ways to go about it, but they're not 100% easy to use, for example cases like these require extending the synapse container with scripts or even extra docker containers:

A while ago we were able to provide templating via some fixed environment variables but removed that due to maintenance complexity as everything needed to be a environment variable.

We have the debian system that templates from debconf: https://github.com/matrix-org/synapse/blob/develop/debian/manage_debconf.pl

We currently have the --generate-config option which templates out synapse configuration based on environment variables, but only a limited number of values are supported https://github.com/matrix-org/synapse/blob/develop/docker/start.py#L130 and it relies on being able to write the generated result back out and have it persisted.

We can also currently use a conf.d/ type configuration, and be responsible for writing parts of the config out from different sources, but that gets complicated if the configuration is nested, eg sharing the database password from one source and the database hostname from another requires merging two trees of configuration.

We could create some specific syntax for use in the config file, eg hostname: "${ENV['POSTGRES_HOST']}" to allow values to be read from environment variables, which might deal with a lot of the cases - provide a static config file and specify which two or three secrets are to be provided.

Or maybe we could get value from loosening up the existing --generate-config templating so it could run before every start (so doesn't run and exit) but only templates the configuration files; not the other files it currently makes.

We find ourselves repeating these slight configurations in a lot of tiny built images, and I wonder if we could replace them with a single standard templating option.

I'm not sure of the right answer here; but it's currently painful to have to reimplement the templating of synapse config files again and again in each usecase, so creating this issue to see if we can make something simpler here.

Metadata

Assignees

No one assigned

    Labels

    T-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions