This repository was 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
Support registering Application Services when running with workers under Complement. #12826
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
442d0f5
Register Complement's application services when running with workers
reivilibre 66a3f2f
Newsfile
reivilibre 7c4c366
Update docker/conf-workers/shared.yaml.j2
reivilibre 59bfdb9
absolute -> resolve
reivilibre d461762
Merge branch 'develop' into rei/wcom_importhistory_as_reg
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 hidden or 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 @@ | ||
Support registering Application Services when running with workers under Complement. |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
# * SYNAPSE_REPORT_STATS: Whether to report stats. | ||
# * 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. | ||
# * SYNAPSE_AS_REGISTRATION_DIR: If specified, a directory in which .yaml and .yml files | ||
# will be treated as Application Service registration files. | ||
# | ||
# NOTE: According to Complement's ENTRYPOINT expectations for a homeserver image (as defined | ||
# in the project's README), this script may be run multiple times, and functionality should | ||
|
@@ -29,6 +31,7 @@ | |
import os | ||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
from typing import Any, Dict, List, Mapping, MutableMapping, NoReturn, Set | ||
|
||
import jinja2 | ||
|
@@ -488,11 +491,23 @@ def generate_worker_files( | |
master_log_config = generate_worker_log_config(environ, "master", data_dir) | ||
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.absolute()) | ||
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 can't find any documentation for 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. Huh, weird >>> from pathlib import Path
>>> p = Path("/tmp")
>>> p.absolute()
PosixPath('/tmp')
>>> p.__class__
<class 'pathlib.PosixPath'>
>>> help(p.absolute)
Nothing against using 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. It is likely fine, was just confused. 🤷 |
||
for reg_path in Path(appservice_registration_dir).iterdir() | ||
if reg_path.suffix.lower() in (".yaml", ".yml") | ||
] | ||
|
||
# Shared homeserver config | ||
convert( | ||
"/conf/shared.yaml.j2", | ||
"/conf/workers/shared.yaml", | ||
shared_worker_config=yaml.dump(shared_config), | ||
appservice_registrations=appservice_registrations, | ||
) | ||
|
||
# Nginx config | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.