@@ -8,79 +8,50 @@ docker images that can be run inside Complement for testing purposes.
88
99Note that running Synapse's unit tests from within the docker image is not supported.
1010
11- ## Testing with SQLite and single-process Synapse
11+ ## Using the Complement launch script
1212
13- > Note that ` scripts-dev/complement.sh ` is a script that will automatically build
14- > and run an SQLite-based, single-process of Synapse against Complement.
13+ ` scripts-dev/complement.sh ` is a script that will automatically build
14+ and run Synapse against Complement.
15+ Consult the [ contributing guide] [ guideComplementSh ] for instructions on how to use it.
1516
16- The instructions below will set up Complement testing for a single-process,
17- SQLite-based Synapse deployment.
1817
19- Start by building the base Synapse docker image. If you wish to run tests with the latest
20- release of Synapse, instead of your current checkout, you can skip this step. From the
21- root of the repository:
22-
23- ``` sh
24- docker build -t matrixdotorg/synapse -f docker/Dockerfile .
25- ```
26-
27- This will build an image with the tag ` matrixdotorg/synapse ` .
28-
29- Next, build the Synapse image for Complement.
18+ [ guideComplementSh ] : https://matrix-org.github.io/synapse/latest/development/contributing_guide.html#run-the-integration-tests-complement
3019
31- ``` sh
32- docker build -t complement-synapse -f " docker/complement/Dockerfile" docker/complement
33- ```
20+ ## Building and running the images manually
3421
35- This will build an image with the tag ` complement-synapse ` , which can be handed to
36- Complement for testing via the ` COMPLEMENT_BASE_IMAGE ` environment variable. Refer to
37- [ Complement's documentation] ( https://github.com/matrix-org/complement/#running ) for
38- how to run the tests, as well as the various available command line flags.
39-
40- ## Testing with PostgreSQL and single or multi-process Synapse
22+ Under some circumstances, you may wish to build the images manually.
23+ The instructions below will lead you to doing that.
4124
42- The above docker image only supports running Synapse with SQLite and in a
43- single-process topology. The following instructions are used to build a Synapse image for
44- Complement that supports either single or multi-process topology with a PostgreSQL
45- database backend.
46-
47- As with the single-process image, build the base Synapse docker image. If you wish to run
48- tests with the latest release of Synapse, instead of your current checkout, you can skip
49- this step. From the root of the repository:
25+ Start by building the base Synapse docker image. If you wish to run tests with the latest
26+ release of Synapse, instead of your current checkout, you can skip this step. From the
27+ root of the repository:
5028
5129``` sh
5230docker build -t matrixdotorg/synapse -f docker/Dockerfile .
5331```
5432
55- This will build an image with the tag ` matrixdotorg/synapse ` .
56-
57- Next, we build a new image with worker support based on ` matrixdotorg/synapse:latest ` .
58- Again, from the root of the repository:
33+ Next, build the workerised Synapse docker image, which is a layer over the base
34+ image.
5935
6036``` sh
6137docker build -t matrixdotorg/synapse-workers -f docker/Dockerfile-workers .
6238```
6339
64- This will build an image with the tag` matrixdotorg/synapse-workers ` .
65-
66- It's worth noting at this point that this image is fully functional, and
67- can be used for testing against locally. See instructions for using the container
68- under
69- [ Running the Dockerfile-worker image standalone] ( #running-the-dockerfile-worker-image-standalone )
70- below.
71-
72- Finally, build the Synapse image for Complement, which is based on
73- ` matrixdotorg/synapse-workers ` .
40+ Finally, build the multi-purpose image for Complement, which is a layer over the workers image.
7441
7542``` sh
76- docker build -t matrixdotorg/ complement-synapse-workers -f docker/complement/SynapseWorkers. Dockerfile docker/complement
43+ docker build -t complement-synapse -f docker/complement/Dockerfile docker/complement
7744```
7845
79- This will build an image with the tag ` complement-synapse-workers ` , which can be handed to
46+ This will build an image with the tag ` complement-synapse ` , which can be handed to
8047Complement for testing via the ` COMPLEMENT_BASE_IMAGE ` environment variable. Refer to
8148[ Complement's documentation] ( https://github.com/matrix-org/complement/#running ) for
8249how to run the tests, as well as the various available command line flags.
8350
51+ See [ the Complement image README] ( ./complement/README.md ) for information about the
52+ expected environment variables.
53+
54+
8455## Running the Dockerfile-worker image standalone
8556
8657For manual testing of a multi-process Synapse instance in Docker,
@@ -113,6 +84,9 @@ docker run -d --name synapse \
11384...substituting ` POSTGRES* ` variables for those that match a postgres host you have
11485available (usually a running postgres docker container).
11586
87+
88+ ### Workers
89+
11690The ` SYNAPSE_WORKER_TYPES ` environment variable is a comma-separated list of workers to
11791use when running the container. All possible worker names are defined by the keys of the
11892` WORKERS_CONFIG ` variable in [ this script] ( configure_workers_and_start.py ) , which the
@@ -125,8 +99,11 @@ type, simply specify the type multiple times in `SYNAPSE_WORKER_TYPES`
12599(e.g ` SYNAPSE_WORKER_TYPES=event_creator,event_creator... ` ).
126100
127101Otherwise, ` SYNAPSE_WORKER_TYPES ` can either be left empty or unset to spawn no workers
128- (leaving only the main process). The container is configured to use redis-based worker
129- mode.
102+ (leaving only the main process).
103+ The container will only be configured to use Redis-based worker mode if there are
104+ workers enabled.
105+
106+ ### Logging
130107
131108Logs for workers and the main process are logged to stdout and can be viewed with
132109standard ` docker logs ` tooling. Worker logs contain their worker name
@@ -136,3 +113,21 @@ Setting `SYNAPSE_WORKERS_WRITE_LOGS_TO_DISK=1` will cause worker logs to be writ
136113` <data_dir>/logs/<worker_name>.log ` . Logs are kept for 1 week and rotate every day at 00:
13711400, according to the container's clock. Logging for the main process must still be
138115configured by modifying the homeserver's log config in your Synapse data volume.
116+
117+
118+ ### Application Services
119+
120+ Setting the ` SYNAPSE_AS_REGISTRATION_DIR ` environment variable to the path of
121+ a directory (within the container) will cause the configuration script to scan
122+ that directory for ` .yaml ` /` .yml ` registration files.
123+ Synapse will be configured to load these configuration files.
124+
125+
126+ ### TLS Termination
127+
128+ Nginx is present in the image to route requests to the appropriate workers,
129+ but it does not serve TLS by default.
130+
131+ You can configure ` SYNAPSE_TLS_CERT ` and ` SYNAPSE_TLS_KEY ` to point to a
132+ TLS certificate and key (respectively), both in PEM (textual) format.
133+ In this case, Nginx will additionally serve using HTTPS on port 8448.
0 commit comments