-
-
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
Changes from 19 commits
e4137c1
865fa26
edc7fcd
15215bd
97699e3
9cd96d2
3a588a0
7bc03a6
bf37bf3
facccd0
7e9884a
423e212
470fabe
b0241e7
3537762
8ae3da7
33aeb67
9f8d317
9531da6
2beae8f
bc5d529
166b046
4a739ca
1af38ef
6daac8a
6c01955
2fd415b
b548132
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,22 +1,41 @@ | ||||||||||||||||||||||||||
# A dockerfile which builds an image suitable for testing Synapse under | ||||||||||||||||||||||||||
# complement. | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
# This dockerfile builds on top of 'docker/Dockerfile-worker' in matrix-org/synapse | ||||||||||||||||||||||||||
reivilibre marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
# 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 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
FROM matrixdotorg/synapse:${SYNAPSE_VERSION} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
ENV SERVER_NAME=localhost | ||||||||||||||||||||||||||
# Install postgresql | ||||||||||||||||||||||||||
RUN apt-get update && \ | ||||||||||||||||||||||||||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y postgresql-13 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
COPY conf/* /conf/ | ||||||||||||||||||||||||||
# 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 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
# generate a signing key | ||||||||||||||||||||||||||
RUN generate_signing_key -o /conf/server.signing.key | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 Lines 115 to 126 in 7f92ac4
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't write that file — it was already here: |
||||||||||||||||||||||||||
# Modify the shared homeserver config with postgres support, certificate setup | ||||||||||||||||||||||||||
reivilibre marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
# and the disabling of rate-limiting | ||||||||||||||||||||||||||
COPY conf/workers-shared.yaml /conf/workers/shared.yaml | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
WORKDIR /data | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
COPY conf/postgres.supervisord.conf /etc/supervisor/conf.d/postgres.conf | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
# 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 |
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.
Uh oh!
There was an error while loading. Please reload this page.