Skip to content
Snippets Groups Projects
Unverified Commit 67aae05e authored by reivilibre's avatar reivilibre Committed by GitHub
Browse files

Support registering Application Services when running with workers under Complement. (#12826)

parent 444588c5
No related branches found
No related tags found
No related merge requests found
Support registering Application Services when running with workers under Complement.
\ No newline at end of file
...@@ -36,6 +36,11 @@ export SYNAPSE_WORKER_TYPES="\ ...@@ -36,6 +36,11 @@ export SYNAPSE_WORKER_TYPES="\
appservice, \ appservice, \
pusher" pusher"
# Add Complement's appservice registration directory, if there is one
# (It can be absent when there are no application services in this test!)
if [ -d /complement/appservice ]; then
export SYNAPSE_AS_REGISTRATION_DIR=/complement/appservice
fi
# Generate a TLS key, then generate a certificate by having Complement's CA sign it # Generate a TLS key, then generate a certificate by having Complement's CA sign it
# Note that both the key and certificate are in PEM format (not DER). # Note that both the key and certificate are in PEM format (not DER).
......
...@@ -6,4 +6,13 @@ ...@@ -6,4 +6,13 @@
redis: redis:
enabled: true enabled: true
{{ shared_worker_config }} {% if appservice_registrations is not none %}
\ No newline at end of file ## Application Services ##
# A list of application service config files to use.
app_service_config_files:
{%- for path in appservice_registrations %}
- "{{ path }}"
{%- endfor %}
{%- endif %}
{{ shared_worker_config }}
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
# * SYNAPSE_REPORT_STATS: Whether to report stats. # * SYNAPSE_REPORT_STATS: Whether to report stats.
# * SYNAPSE_WORKER_TYPES: A comma separated list of worker names as specified in WORKER_CONFIG # * SYNAPSE_WORKER_TYPES: A comma separated list of worker names as specified in WORKER_CONFIG
# below. Leave empty for no workers, or set to '*' for all possible workers. # below. Leave empty for no workers, or set to '*' for all possible workers.
# * SYNAPSE_AS_REGISTRATION_DIR: If specified, a directory in which .yaml and .yml files
# will be treated as Application Service registration files.
# * SYNAPSE_TLS_CERT: Path to a TLS certificate in PEM format. # * SYNAPSE_TLS_CERT: Path to a TLS certificate in PEM format.
# * SYNAPSE_TLS_KEY: Path to a TLS key. If this and SYNAPSE_TLS_CERT are specified, # * SYNAPSE_TLS_KEY: Path to a TLS key. If this and SYNAPSE_TLS_CERT are specified,
# Nginx will be configured to serve TLS on port 8448. # Nginx will be configured to serve TLS on port 8448.
...@@ -32,6 +34,7 @@ ...@@ -32,6 +34,7 @@
import os import os
import subprocess import subprocess
import sys import sys
from pathlib import Path
from typing import Any, Dict, List, Mapping, MutableMapping, NoReturn, Set from typing import Any, Dict, List, Mapping, MutableMapping, NoReturn, Set
import jinja2 import jinja2
...@@ -491,11 +494,23 @@ def generate_worker_files( ...@@ -491,11 +494,23 @@ def generate_worker_files(
master_log_config = generate_worker_log_config(environ, "master", data_dir) master_log_config = generate_worker_log_config(environ, "master", data_dir)
shared_config["log_config"] = master_log_config shared_config["log_config"] = master_log_config
# Find application service registrations
appservice_registrations = None
appservice_registration_dir = os.environ.get("SYNAPSE_AS_REGISTRATION_DIR")
if appservice_registration_dir:
# Scan for all YAML files that should be application service registrations.
appservice_registrations = [
str(reg_path.resolve())
for reg_path in Path(appservice_registration_dir).iterdir()
if reg_path.suffix.lower() in (".yaml", ".yml")
]
# Shared homeserver config # Shared homeserver config
convert( convert(
"/conf/shared.yaml.j2", "/conf/shared.yaml.j2",
"/conf/workers/shared.yaml", "/conf/workers/shared.yaml",
shared_worker_config=yaml.dump(shared_config), shared_worker_config=yaml.dump(shared_config),
appservice_registrations=appservice_registrations,
) )
# Nginx config # Nginx config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment