This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Merge the Complement testing Docker images into a single, multi-purpose image. #12881
Merged
Merged
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
e4137c1
Mutiny: oust the monolith image and replace with the workers image
reivilibre 865fa26
Update references in Dockerfile
reivilibre edc7fcd
Update complement.sh to use the unified image
reivilibre 15215bd
Make it possible to disable Redis with an env var
reivilibre 97699e3
Require START_POSTGRES=1 to start Postgres
reivilibre 9cd96d2
Make the Complement Synapse launcher able to handle all 3 scenarios
reivilibre 3a588a0
Don't enable Redis for the monolith case
reivilibre 7bc03a6
Burn env vars into the image (sad and hopefully temporary)
reivilibre bf37bf3
Newsfile
reivilibre facccd0
Bring back the experimental features
reivilibre 7e9884a
Apply suggestions from Rich
reivilibre 423e212
Remove mention of 'worker' from entrypoint
reivilibre 470fabe
Pass the environment variables straight through, with no burning!
reivilibre b0241e7
Add back SYNAPSE_VERSION build arguments
reivilibre 3537762
Automatically disable Redis only for no-worker instances
reivilibre 8ae3da7
Improve Complement documentation about 'Stuff' :)
reivilibre 33aeb67
Update the contributing guide
reivilibre 9f8d317
Update README-testing.md
reivilibre 9531da6
Fix sentence that dropped off
reivilibre 2beae8f
Update docker/README-testing.md
reivilibre bc5d529
Apply suggestions from code review
reivilibre 166b046
Remove obsolete START_REDIS
reivilibre 4a739ca
Fix comment explaining the overwritten config file
reivilibre 1af38ef
Convert workers-shared.yaml to Jinja2 and import the original file ra…
reivilibre 6daac8a
Add comment about how it fits in
reivilibre 6c01955
Merge branch 'develop' into rei/one_complement_image
reivilibre 2fd415b
Update docker/configure_workers_and_start.py
reivilibre b548132
Move comment to top of file and rephrase slightly
reivilibre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Merge the Complement testing Docker images into a single, multi-purpose image. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,42 @@ | ||
# A dockerfile which builds an image suitable for testing Synapse under | ||
# complement. | ||
|
||
# This dockerfile builds on top of 'docker/Dockerfile-workers' in matrix-org/synapse | ||
# by including a built-in postgres instance, as well as setting up the homeserver so | ||
# that it is ready for testing via Complement. | ||
# | ||
# Instructions for building this image from those it depends on is detailed in this guide: | ||
# https://github.com/matrix-org/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse | ||
ARG SYNAPSE_VERSION=latest | ||
FROM matrixdotorg/synapse-workers:$SYNAPSE_VERSION | ||
|
||
# Install postgresql | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y postgresql-13 | ||
|
||
# Configure a user and create a database for Synapse | ||
RUN pg_ctlcluster 13 main start && su postgres -c "echo \ | ||
\"ALTER USER postgres PASSWORD 'somesecret'; \ | ||
CREATE DATABASE synapse \ | ||
ENCODING 'UTF8' \ | ||
LC_COLLATE='C' \ | ||
LC_CTYPE='C' \ | ||
template=template0;\" | psql" && pg_ctlcluster 13 main stop | ||
|
||
# Replace the shared homeserver config to disable rate-limiting, | ||
# set Complement's static shared secret, enable registration, amongst other | ||
# tweaks to get Synapse ready for testing. | ||
COPY conf/workers-shared.yaml /conf/workers/shared.yaml | ||
|
||
FROM matrixdotorg/synapse:${SYNAPSE_VERSION} | ||
|
||
ENV SERVER_NAME=localhost | ||
|
||
COPY conf/* /conf/ | ||
WORKDIR /data | ||
|
||
# generate a signing key | ||
RUN generate_signing_key -o /conf/server.signing.key | ||
COPY conf/postgres.supervisord.conf /etc/supervisor/conf.d/postgres.conf | ||
|
||
WORKDIR /data | ||
# Copy the entrypoint | ||
COPY conf/start_for_complement.sh / | ||
|
||
# Expose nginx's listener ports | ||
EXPOSE 8008 8448 | ||
|
||
ENTRYPOINT ["/conf/start.sh"] | ||
ENTRYPOINT ["/start_for_complement.sh"] | ||
|
||
# Update the healthcheck to have a shorter check interval | ||
HEALTHCHECK --start-period=5s --interval=1s --timeout=1s \ | ||
CMD curl -fSs http://localhost:8008/health || exit 1 | ||
CMD /bin/sh /healthcheck.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
Stuff for building the docker image used for testing under complement. | ||
# Unified Complement image for Synapse | ||
|
||
This is an image for testing Synapse with [the *Complement* integration test suite][complement]. | ||
It contains some insecure defaults that are only suitable for testing purposes, | ||
so **please don't use this image for a production server**. | ||
|
||
This multi-purpose image is built on top of `Dockerfile-workers` in the parent directory | ||
and can be switched using environment variables between the following configurations: | ||
|
||
- Monolithic Synapse with SQLite (`SYNAPSE_COMPLEMENT_DATABASE=sqlite`) | ||
- Monolithic Synapse with Postgres (`SYNAPSE_COMPLEMENT_DATABASE=postgres`) | ||
- Workerised Synapse with Postgres (`SYNAPSE_COMPLEMENT_DATABASE=postgres` and `SYNAPSE_COMPLEMENT_USE_WORKERS=true`) | ||
|
||
The image is self-contained; it contains an integrated Postgres, Redis and Nginx. | ||
|
||
|
||
## How to get Complement to pass the environment variables through | ||
|
||
To pass these environment variables, use [Complement's `COMPLEMENT_SHARE_ENV_PREFIX`][complementEnv] | ||
variable to configure an environment prefix to pass through, then prefix the above options | ||
with that prefix. | ||
|
||
Example: | ||
``` | ||
COMPLEMENT_SHARE_ENV_PREFIX=PASS_ PASS_SYNAPSE_COMPLEMENT_DATABASE=postgres | ||
``` | ||
|
||
Consult `scripts-dev/complement.sh` in the repository root for a real example. | ||
|
||
|
||
[complement]: https://github.com/matrix-org/complement | ||
[complementEnv]: https://github.com/matrix-org/complement/pull/382 |
This file was deleted.
Oops, something went wrong.
61 changes: 0 additions & 61 deletions
61
docker/complement/conf-workers/start-complement-synapse-workers.sh
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we not still need a signing key? or is that generated somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't something I've touched (although the overall diff will make that less than obvious) — presumably it generated a signing key before. That said, this one eluded me for a bit!
It's in
start.py
(called byconfigure_workers_and_start.py
):synapse/docker/start.py
Lines 115 to 126 in 7f92ac4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is something you've changed... or at least, I don't understand why you're saying it's not.
Anyway, if
start.py
sorts it out, I guess that's fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write that file — it was already here:
e4137c1
(#12881); the diff is just confusing because I deleted the monolith-only image which is what the red part of this diff (that your comment is on) corresponds to