mirror of
https://github.com/element-hq/synapse.git
synced 2026-01-11 19:56:31 +00:00
Make it more clear how shared_extra_conf is combined in our Docker configuration scripts (#19323)
Some checks failed
Tests / lint-crlf (push) Has been cancelled
Tests / lint-newsfile (push) Has been cancelled
Build docker images / Build and push image for linux/amd64 (push) Has been cancelled
Build docker images / Build and push image for linux/arm64 (push) Has been cancelled
Deploy the documentation / Calculate variables for GitHub Pages deployment (push) Has been cancelled
Build release artifacts / Calculate list of debian distros (push) Has been cancelled
Build release artifacts / Build wheels on ubuntu-24.04 (push) Has been cancelled
Build release artifacts / Build wheels on ubuntu-24.04-arm (push) Has been cancelled
Build release artifacts / Build sdist (push) Has been cancelled
Schema / Ensure Synapse config schema is valid (push) Has been cancelled
Schema / Ensure generated documentation is up-to-date (push) Has been cancelled
Tests / changes (push) Has been cancelled
Tests / check-lockfile (push) Has been cancelled
Tests / lint-clippy (push) Has been cancelled
Tests / lint-clippy-nightly (push) Has been cancelled
Build docker images / Push merged images to docker.io/matrixdotorg/synapse (push) Has been cancelled
Tests / linting-done (push) Has been cancelled
Tests / calculate-test-jobs (push) Has been cancelled
Tests / trial (push) Has been cancelled
Tests / trial-olddeps (push) Has been cancelled
Tests / trial-pypy (all, pypy-3.10) (push) Has been cancelled
Tests / sytest (push) Has been cancelled
Tests / export-data (push) Has been cancelled
Tests / tests-done (push) Has been cancelled
Tests / portdb (14, 3.10) (push) Has been cancelled
Tests / portdb (17, 3.14) (push) Has been cancelled
Tests / complement (monolith, Postgres) (push) Has been cancelled
Tests / complement (monolith, SQLite) (push) Has been cancelled
Tests / complement (workers, Postgres) (push) Has been cancelled
Build docker images / Push merged images to ghcr.io/element-hq/synapse (push) Has been cancelled
Deploy the documentation / GitHub Pages (push) Has been cancelled
Build release artifacts / Build .deb packages (push) Has been cancelled
Tests / cargo-test (push) Has been cancelled
Build release artifacts / Attach assets to release (push) Has been cancelled
Tests / cargo-bench (push) Has been cancelled
Tests / check-sampleconfig (push) Has been cancelled
Tests / check-schema-delta (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / Typechecking (push) Has been cancelled
Tests / lint-rust (push) Has been cancelled
Tests / lint-rustfmt (push) Has been cancelled
Tests / lint-readme (push) Has been cancelled
Some checks failed
Tests / lint-crlf (push) Has been cancelled
Tests / lint-newsfile (push) Has been cancelled
Build docker images / Build and push image for linux/amd64 (push) Has been cancelled
Build docker images / Build and push image for linux/arm64 (push) Has been cancelled
Deploy the documentation / Calculate variables for GitHub Pages deployment (push) Has been cancelled
Build release artifacts / Calculate list of debian distros (push) Has been cancelled
Build release artifacts / Build wheels on ubuntu-24.04 (push) Has been cancelled
Build release artifacts / Build wheels on ubuntu-24.04-arm (push) Has been cancelled
Build release artifacts / Build sdist (push) Has been cancelled
Schema / Ensure Synapse config schema is valid (push) Has been cancelled
Schema / Ensure generated documentation is up-to-date (push) Has been cancelled
Tests / changes (push) Has been cancelled
Tests / check-lockfile (push) Has been cancelled
Tests / lint-clippy (push) Has been cancelled
Tests / lint-clippy-nightly (push) Has been cancelled
Build docker images / Push merged images to docker.io/matrixdotorg/synapse (push) Has been cancelled
Tests / linting-done (push) Has been cancelled
Tests / calculate-test-jobs (push) Has been cancelled
Tests / trial (push) Has been cancelled
Tests / trial-olddeps (push) Has been cancelled
Tests / trial-pypy (all, pypy-3.10) (push) Has been cancelled
Tests / sytest (push) Has been cancelled
Tests / export-data (push) Has been cancelled
Tests / tests-done (push) Has been cancelled
Tests / portdb (14, 3.10) (push) Has been cancelled
Tests / portdb (17, 3.14) (push) Has been cancelled
Tests / complement (monolith, Postgres) (push) Has been cancelled
Tests / complement (monolith, SQLite) (push) Has been cancelled
Tests / complement (workers, Postgres) (push) Has been cancelled
Build docker images / Push merged images to ghcr.io/element-hq/synapse (push) Has been cancelled
Deploy the documentation / GitHub Pages (push) Has been cancelled
Build release artifacts / Build .deb packages (push) Has been cancelled
Tests / cargo-test (push) Has been cancelled
Build release artifacts / Attach assets to release (push) Has been cancelled
Tests / cargo-bench (push) Has been cancelled
Tests / check-sampleconfig (push) Has been cancelled
Tests / check-schema-delta (push) Has been cancelled
Tests / lint (push) Has been cancelled
Tests / Typechecking (push) Has been cancelled
Tests / lint-rust (push) Has been cancelled
Tests / lint-rustfmt (push) Has been cancelled
Tests / lint-readme (push) Has been cancelled
For reference, this PR used to include this whole `shared_config` block in the diff.
But https://github.com/element-hq/synapse/pull/19324 was merged first which introduced parts of it already.
Here is what this code used to look like: 566670c363/docker/configure_workers_and_start.py (L865-L868)
---
Original context for why it was changed this way:
https://github.com/matrix-org/synapse/pull/14921#discussion_r1126257933
Previously, this code made me question two things:
1. Do we actually use `worker_config["shared_extra_conf"]` in the
templates?
- At first glance, I couldn't see why we're updating `shared_extra_conf`
here. It's not used in the `worker.yaml.j2` template so all of this
seemed a bit pointless.
- Turns out, updating `shared_extra_conf` itself is pointless and it's
being done as a convenient place to mix the objects to get things right
in `shared_config` (confusing).
1. Does it actually do anything?
- Because `shared_config` starts out as an empty object, my first glance
made me think we we're just updating with an empty object and then just
re-assigning. But because we're in a loop, we actually accumulate the
`shared_extra_conf` from each worker.
I'm not sure whether I'm capturing my confusion well enough here but
basically, this made me spend time trying to figure out what/why we're
doing things this way and we can use a more clear pattern to accomplish
the same thing.
---
This change is spawning from looking at the
`docker/configure_workers_and_start.py` script in order to add a metrics
listener ([upcoming
PR](https://github.com/element-hq/synapse/pull/19324)).
This commit is contained in:
parent
9dae6cc595
commit
803e4b4d88
2 changed files with 3 additions and 2 deletions
1
changelog.d/19323.misc
Normal file
1
changelog.d/19323.misc
Normal file
|
|
@ -0,0 +1 @@
|
|||
Make it more clear how `shared_extra_conf` is combined in our Docker configuration scripts.
|
||||
|
|
@ -879,8 +879,8 @@ def generate_worker_files(
|
|||
# worker.
|
||||
shared_config = {
|
||||
**worker_config["shared_extra_conf"],
|
||||
# We combine `shared_config` second to avoid overwriting existing keys
|
||||
# because TODO: why?
|
||||
# We combine `shared_config` second to avoid overwriting existing keys just
|
||||
# for sanity sake (always use the first worker).
|
||||
**shared_config,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue