Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
e9cbddc8
Unverified
Commit
e9cbddc8
authored
2 years ago
by
realtyem
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Modernize configure_workers_and_start.py bootstrapping script for Dockerfile-workers. (#14294)
parent
0cf48f2d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/14294.docker
+1
-0
1 addition, 0 deletions
changelog.d/14294.docker
docker/configure_workers_and_start.py
+14
-15
14 additions, 15 deletions
docker/configure_workers_and_start.py
with
15 additions
and
15 deletions
changelog.d/14294.docker
0 → 100644
+
1
−
0
View file @
e9cbddc8
Remove references to legacy worker types in the multi-worker Dockerfile.
This diff is collapsed.
Click to expand it.
docker/configure_workers_and_start.py
+
14
−
15
View file @
e9cbddc8
...
...
@@ -20,7 +20,7 @@
# * SYNAPSE_SERVER_NAME: The desired server_name of the homeserver.
# * 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.
# below. Leave empty for no 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.
...
...
@@ -58,10 +58,10 @@ MAIN_PROCESS_HTTP_LISTENER_PORT = 8080
# have to attach by instance_map to the master process and have client endpoints.
WORKERS_CONFIG
:
Dict
[
str
,
Dict
[
str
,
Any
]]
=
{
"
pusher
"
:
{
"
app
"
:
"
synapse.app.
push
er
"
,
"
app
"
:
"
synapse.app.
generic_work
er
"
,
"
listener_resources
"
:
[],
"
endpoint_patterns
"
:
[],
"
shared_extra_conf
"
:
{
"
start_pushers
"
:
False
},
"
shared_extra_conf
"
:
{},
"
worker_extra_conf
"
:
""
,
},
"
user_dir
"
:
{
...
...
@@ -84,7 +84,11 @@ WORKERS_CONFIG: Dict[str, Dict[str, Any]] = {
"
^/_synapse/admin/v1/media/.*$
"
,
"
^/_synapse/admin/v1/quarantine_media/.*$
"
,
],
"
shared_extra_conf
"
:
{
"
enable_media_repo
"
:
False
},
# The first configured media worker will run the media background jobs
"
shared_extra_conf
"
:
{
"
enable_media_repo
"
:
False
,
"
media_instance_running_background_jobs
"
:
"
media_repository1
"
,
},
"
worker_extra_conf
"
:
"
enable_media_repo: true
"
,
},
"
appservice
"
:
{
...
...
@@ -95,10 +99,10 @@ WORKERS_CONFIG: Dict[str, Dict[str, Any]] = {
"
worker_extra_conf
"
:
""
,
},
"
federation_sender
"
:
{
"
app
"
:
"
synapse.app.
federation_send
er
"
,
"
app
"
:
"
synapse.app.
generic_work
er
"
,
"
listener_resources
"
:
[],
"
endpoint_patterns
"
:
[],
"
shared_extra_conf
"
:
{
"
send_federation
"
:
False
},
"
shared_extra_conf
"
:
{},
"
worker_extra_conf
"
:
""
,
},
"
synchrotron
"
:
{
...
...
@@ -205,7 +209,7 @@ WORKERS_CONFIG: Dict[str, Dict[str, Any]] = {
"
worker_extra_conf
"
:
""
,
},
"
frontend_proxy
"
:
{
"
app
"
:
"
synapse.app.
frontend_proxy
"
,
"
app
"
:
"
synapse.app.
generic_worker
"
,
"
listener_resources
"
:
[
"
client
"
,
"
replication
"
],
"
endpoint_patterns
"
:
[
"
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/upload
"
],
"
shared_extra_conf
"
:
{},
...
...
@@ -326,7 +330,7 @@ def add_worker_roles_to_shared_config(
worker_port
:
int
,
)
->
None
:
"""
Given a dictionary representing a config file shared across all workers,
append
sharded
worker information to it for the current worker_type instance.
append
appropriate
worker information to it for the current worker_type instance.
Args:
shared_config: The config dict that all worker instances share (after being converted to YAML)
...
...
@@ -359,7 +363,7 @@ def add_worker_roles_to_shared_config(
elif
worker_type
in
[
"
account_data
"
,
"
presence
"
,
"
receipts
"
,
"
to_device
"
,
"
typing
"
]:
# Update the list of stream writers
# It's conv
i
enent that the name of the worker type is the same as the
event
stream
# It's conven
i
ent that the name of the worker type is the same as the stream
to write
shared_config
.
setdefault
(
"
stream_writers
"
,
{}).
setdefault
(
worker_type
,
[]
).
append
(
worker_name
)
...
...
@@ -371,10 +375,6 @@ def add_worker_roles_to_shared_config(
"
port
"
:
worker_port
,
}
elif
worker_type
==
"
media_repository
"
:
# The first configured media worker will run the media background jobs
shared_config
.
setdefault
(
"
media_instance_running_background_jobs
"
,
worker_name
)
def
generate_base_homeserver_config
()
->
None
:
"""
Starts Synapse and generates a basic homeserver config, which will later be
...
...
@@ -483,8 +483,7 @@ def generate_worker_files(
if
worker_config
:
worker_config
=
worker_config
.
copy
()
else
:
log
(
worker_type
+
"
is an unknown worker type! It will be ignored
"
)
continue
error
(
worker_type
+
"
is an unknown worker type! Please fix!
"
)
new_worker_count
=
worker_type_counter
.
setdefault
(
worker_type
,
0
)
+
1
worker_type_counter
[
worker_type
]
=
new_worker_count
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment