Define instanceId property on workers

This give us the possibility to run multiple instances of
workers that that don't expose a port.

Right now, we don't support that, but in the future we could
run multiple `federation_sender` or `pusher` workers, without
them fighting over naming (previously, they'd all be named
something like `matrix-synapse-worker-pusher-0`, because
they'd all define `port` as `0`).
This commit is contained in:
Slavi Pantaleev
2021-02-18 18:19:51 +02:00
parent d33483b8ce
commit d6c4d41c2b
5 changed files with 42 additions and 19 deletions

View File

@@ -353,18 +353,24 @@ matrix_synapse_workers_frontend_proxy_workers_metrics_range_start: 19771
# Doing that is simpler and also protects you from shooting yourself in the foot,
# as certain workers can only be spawned just once.
#
# Example of what this needs to look like:
# Each worker instance in the list defines the following fields:
# - `type` - the type of worker (`generic_worker`, etc.)
# - `instanceId` - a string that identifies the worker. The combination of (`type` + `instanceId`) represents the name of the worker and must be unique.
# - `port` - an HTTP port where the worker listens for requests (can be `0` for workers that don't do HTTP request processing)
# - `metrics_port` - an HTTP port where the worker exports Prometheus metrics
#
# Example of what this needs to look like, if you're defining it manually:
# matrix_synapse_workers_enabled_list:
# - { type: generic_worker, port: 18111, metrics_port: 19111 }
# - { type: generic_worker, port: 18112, metrics_port: 19112 }
# - { type: generic_worker, port: 18113, metrics_port: 19113 }
# - { type: generic_worker, port: 18114, metrics_port: 19114 }
# - { type: generic_worker, port: 18115, metrics_port: 19115 }
# - { type: generic_worker, port: 18116, metrics_port: 19116 }
# - { type: pusher, port: 0, metrics_port: 19200 }
# - { type: appservice, port: 0, metrics_port: 19300 }
# - { type: federation_sender, port: 0, metrics_port: 19400 }
# - { type: media_repository, port: 18551, metrics_port: 19551 }
# - { type: generic_worker, instanceId: '18111', port: 18111, metrics_port: 19111 }
# - { type: generic_worker, instanceId: '18112', port: 18112, metrics_port: 19112 }
# - { type: generic_worker, instanceId: '18113', port: 18113, metrics_port: 19113 }
# - { type: generic_worker, instanceId: '18114', port: 18114, metrics_port: 19114 }
# - { type: generic_worker, instanceId: '18115', port: 18115, metrics_port: 19115 }
# - { type: generic_worker, instanceId: '18116', port: 18116, metrics_port: 19116 }
# - { type: pusher, instanceId: '0', port: 0, metrics_port: 19200 }
# - { type: appservice, instanceId: '0', port: 0, metrics_port: 19300 }
# - { type: federation_sender, instanceId: '0', port: 0, metrics_port: 19400 }
# - { type: media_repository, instanceId: '18551', port: 18551, metrics_port: 19551 }
matrix_synapse_workers_enabled_list: []
# Redis information