element-hq / element-hq/synapse
Add composable way to extend our Complement Docker images with custom homeserver config
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
For Complement testing in other projects like the [SBG](https://github.com/element-hq/sbg) ([public docs](https://element.io/en/server-suite/secure-border-gateways)) and the [Rust apps](https://github.com/element-hq/synapse-rust-apps) used in [Synapse Pro](https://element.io/en/server-suite/synapse-pro), we've been extending the [`complement-synapse`](https://github.com/element-hq/synapse/blob/acafac3bb6581a082a6ba8cdf137fa1b69d22dd7/docker/complement/Dockerfile) Docker image and doing a series of dirty hacks to insert our own homeserver config. This issue is spawning from having to add the hacks to yet another project, https://github.com/element-hq/synapse-rust-apps/pull/364
For example, to get in the middle of everything while still re-using the Synapse utilities, we have to do some hacky find/replace text manipulation of [`docker/complement/conf/start_for_complement.sh`](https://github.com/element-hq/synapse/blob/acafac3bb6581a082a6ba8cdf137fa1b69d22dd7/docker/complement/conf/start_for_complement.sh) to prevent it from actually starting Synapse (remove [`exec /configure_workers_and_start.py`](https://github.com/element-hq/synapse/blob/acafac3bb6581a082a6ba8cdf137fa1b69d22dd7/docker/complement/conf/start_for_complement.sh#L131-L133)) so we can re-use all of the good logic to around setting the correct environment variables like `SYNAPSE_SERVER_NAME`, `SYNAPSE_WORKER_TYPES`, etc and add in our own homeserver config. Then later, we call `configure_workers_and_start.py` ourselves.
We have also just been glomming onto the same `supervisord` and `nginx` patterns that Synapse uses to add in our own applications and network routing.
It would be nice if there was a more clear path instead of relying on these brittle hacks as it can be a bit confusing to follow and understand what's happening. So far in terms of things working, things have mostly been fine since we don't touch those scripts very often though.
Related to https://github.com/element-hq/synapse/issues/9944 about making it easy to configure Synapse modules in our Docker images.
Contributor guide
Assessment
This issue has not been assessed yet.