Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Merge the Complement testing Docker images into a single, multi-purpose image. #12881

Merged
merged 28 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 May 24, 2022
865fa26
Update references in Dockerfile
reivilibre May 24, 2022
edc7fcd
Update complement.sh to use the unified image
reivilibre May 24, 2022
15215bd
Make it possible to disable Redis with an env var
reivilibre May 26, 2022
97699e3
Require START_POSTGRES=1 to start Postgres
reivilibre May 26, 2022
9cd96d2
Make the Complement Synapse launcher able to handle all 3 scenarios
reivilibre May 26, 2022
3a588a0
Don't enable Redis for the monolith case
reivilibre May 26, 2022
7bc03a6
Burn env vars into the image (sad and hopefully temporary)
reivilibre May 26, 2022
bf37bf3
Newsfile
reivilibre May 26, 2022
facccd0
Bring back the experimental features
reivilibre May 26, 2022
7e9884a
Apply suggestions from Rich
reivilibre May 30, 2022
423e212
Remove mention of 'worker' from entrypoint
reivilibre May 30, 2022
470fabe
Pass the environment variables straight through, with no burning!
reivilibre May 30, 2022
b0241e7
Add back SYNAPSE_VERSION build arguments
reivilibre May 30, 2022
3537762
Automatically disable Redis only for no-worker instances
reivilibre May 31, 2022
8ae3da7
Improve Complement documentation about 'Stuff' :)
reivilibre May 31, 2022
33aeb67
Update the contributing guide
reivilibre May 31, 2022
9f8d317
Update README-testing.md
reivilibre May 31, 2022
9531da6
Fix sentence that dropped off
reivilibre May 31, 2022
2beae8f
Update docker/README-testing.md
reivilibre May 31, 2022
bc5d529
Apply suggestions from code review
reivilibre May 31, 2022
166b046
Remove obsolete START_REDIS
reivilibre May 31, 2022
4a739ca
Fix comment explaining the overwritten config file
reivilibre May 31, 2022
1af38ef
Convert workers-shared.yaml to Jinja2 and import the original file ra…
reivilibre Jun 1, 2022
6daac8a
Add comment about how it fits in
reivilibre Jun 6, 2022
6c01955
Merge branch 'develop' into rei/one_complement_image
reivilibre Jun 6, 2022
2fd415b
Update docker/configure_workers_and_start.py
reivilibre Jun 8, 2022
b548132
Move comment to top of file and rephrase slightly
reivilibre Jun 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions docker/complement/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ RUN pg_ctlcluster 13 main start && su postgres -c "echo \
LC_CTYPE='C' \
template=template0;\" | psql" && pg_ctlcluster 13 main stop

# Replace the shared homeserver config to disable rate-limiting,
# Extend 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
# To do this, we copy the old template out of the way and then include it
# with Jinja2.
RUN mv /conf/shared.yaml.j2 /conf/shared-orig.yaml.j2
COPY conf/workers-shared-extra.yaml.j2 /conf/shared.yaml.j2

WORKDIR /data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ experimental_features:
msc2716_enabled: true
# server-side support for partial state in /send_join responses
msc3706_enabled: true
{% if not workers_in_use %}
# client-side support for partial state in /send_join responses
faster_joins: true
{% endif %}
# Enable jump to date endpoint
msc3030_enabled: true

Expand All @@ -92,3 +94,5 @@ server_notices:
system_mxid_display_name: "Server Alert"
system_mxid_avatar_url: ""
room_name: "Server Alert"

{% include "shared-orig.yaml.j2" %}
richvdh marked this conversation as resolved.
Show resolved Hide resolved
21 changes: 12 additions & 9 deletions docker/configure_workers_and_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
from pathlib import Path
from typing import Any, Dict, List, Mapping, MutableMapping, NoReturn, Set

import jinja2
import yaml
from jinja2 import Environment, FileSystemLoader

MAIN_PROCESS_HTTP_LISTENER_PORT = 8080

Expand Down Expand Up @@ -234,13 +234,15 @@ def convert(src: str, dst: str, **template_vars: object) -> None:
dst: Path to write to.
template_vars: The arguments to replace placeholder variables in the template with.
"""

reivilibre marked this conversation as resolved.
Show resolved Hide resolved
# Read the template file
with open(src) as infile:
template = infile.read()
# We disable autoescape to prevent template variables from being escaped,
# as we're not using HTML.
env = Environment(loader=FileSystemLoader(os.path.dirname(src)), autoescape=False)
template = env.get_template(os.path.basename(src))

# Generate a string from the template. We disable autoescape to prevent template
# variables from being escaped.
rendered = jinja2.Template(template, autoescape=False).render(**template_vars)
# Generate a string from the template.
rendered = template.render(**template_vars)

# Write the generated contents to a file
#
Expand Down Expand Up @@ -505,15 +507,16 @@ def generate_worker_files(
if reg_path.suffix.lower() in (".yaml", ".yml")
]

enable_redis = len(worker_types) > 0
workers_in_use = len(worker_types) > 0

# Shared homeserver config
convert(
"/conf/shared.yaml.j2",
"/conf/workers/shared.yaml",
shared_worker_config=yaml.dump(shared_config),
appservice_registrations=appservice_registrations,
enable_redis=enable_redis,
enable_redis=workers_in_use,
workers_in_use=workers_in_use,
)

# Nginx config
Expand All @@ -533,7 +536,7 @@ def generate_worker_files(
"/etc/supervisor/supervisord.conf",
main_config_path=config_path,
worker_config=supervisord_config,
enable_redis=enable_redis,
enable_redis=workers_in_use,
)

# healthcheck config
Expand Down