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

Add a sample bash script to docs for creating multiple worker files #13032

Merged
merged 10 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13032.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a helpful example bash script to the workers guide for creating multiple worker configuration files of the same type. Contributed by @villepeh.
28 changes: 28 additions & 0 deletions docs/workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,34 @@ have different characteristics and so admins
may wish to run multiple groups of workers handling different endpoints so that
load balancing can be done in different ways.

You could create multiple worker configuration files manually or alternatively use
a simple `bash` script. For example:

```#!/bin/bash
villepeh marked this conversation as resolved.
Show resolved Hide resolved
for i in {1..5}
do
cat << EOF >> generic_worker$i.yaml
worker_app: synapse.app.generic_worker
worker_name: generic_worker$i

# The replication listener on the main synapse process.
worker_replication_host: 127.0.0.1
worker_replication_http_port: 9093

worker_listeners:
- type: http
port: 808$i
resources:
- names: [client, federation]

worker_log_config: /etc/matrix-synapse/generic-worker-log.yaml
EOF
done
```

This would create five generic workers with a unique `worker_name` field
in each file and listening on ports 8081-8085.

villepeh marked this conversation as resolved.
Show resolved Hide resolved
For `/sync` and `/initialSync` requests it will be more efficient if all
requests from a particular user are routed to a single instance. Extracting a
user ID from the access token or `Authorization` header is currently left as an
Expand Down