Matrix Workers Post 1

The last few months I’ve been working with Synapse workers, while there is some documentation about synapse workers. There is posted documentation, but it really leaves lots to the imagination regarding best practices and efficient planning. I also cross posted the configs here to github as well for easy downloading. link

Historical note

There appears to be two separate generations of worker, the original workers appear that they could only allow a single role, while the latest generation of workers using synapse.app.generic_worker. When you use the latest generation it allows you to share multiple core functions per worker and allow more roles to be divided into unique workers. I kinda wish they simply removed all references to this old config as it can get confusing and simply link to a old version of the wiki at the top, but oh well.

Caddy Setup & Config

Currently I use Caddy as my reverse proxy and as my predominate ssl terminator. There is nothing documented regarding how to deploy with Matrix workers & Caddy(which isn’t uncommon, but come on people love caddy). I will not be under the allusion that my config is efficient or smart or well laid out, however it’s roughly good enough to be functional. :p

Caddy reverse proxies to ports on a separate server running the Synapse worker services in a VM on my Proxmox host. Each worker needs a separate port, so you will see a variety of ports within my Caddy config, this becomes quiet cumbersome to firewall and monitor. If your reverse proxy is either on the same host or can access the same file system, you can use unix sockets instead of tcp/ip which reduces latency between workers & reverse proxy.

Here’s my caddy config (click here to expand)
matrix.yourdomain.local {
	tls /etc/letsencrypt/live/matrix.yourdomain.local/fullchain.pem /etc/letsencrypt/live/matrix.yourdomain.local/privkey.pem
	encode zstd gzip
	header /.well-known/matrix/* Content-Type application/json
	header /.well-known/matrix/* Access-Control-Allow-Origin *
	respond /.well-known/matrix/server `{"m.server": "matrix.yourdomain.local:443"}`
	respond /.well-known/matrix/client `{"m.server": {"base_url": "https://matrix.yourdomain.local"},"m.homeserver": {"base_url": "https://matrix.yourdomain.local"},"org.matrix.msc3575.proxy": {"url": "https://matrix-slide.matrix.yourdomain.local"}}`
#Typing 
	@typing_worker path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing
	reverse_proxy @typing_worker http://matrix.yourdomain.local:8449

	#Send to Device
	@to_device_worker path_regexp ^/_matrix/client/(r0|v3|unstable)/sendToDevice/
	reverse_proxy @to_device_worker http://matrix.yourdomain.local:8450

	#Account Data
	@account_data_worker1 path_regexp ^/_matrix/client/(r0|v3|unstable)/.*/tags
	@account_data_worker2 path_regexp ^/_matrix/client/(r0|v3|unstable)/.*/account_data
	reverse_proxy @account_data_worker1 http://matrix.yourdomain.local:8451
	reverse_proxy @account_data_worker2 http://matrix.yourdomain.local:8451

	#Receipts
	@receipts_worker1 path_regexp ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
	reverse_proxy @receipts_worker1 http://matrix.yourdomain.local:8452
	@receipts_worker2 path_regexp ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
	reverse_proxy @receipts_worker2 http://matrix.yourdomain.local:8452

	#Presence 
	@presence_worker path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
	reverse_proxy @presence_worker http://matrix.yourdomain.local:8453

	# Federation requests
	@federation_worker1 path_regexp ^/_matrix/federation/v1/event/
	reverse_proxy @federation_worker1 http://matrix.yourdomain.local:8454
	@federation_worker2 path_regexp ^/_matrix/federation/v1/state/
	reverse_proxy @federation_worker2 http://matrix.yourdomain.local:8454
	@federation_worker3 path_regexp ^/_matrix/federation/v1/state_ids/
	reverse_proxy @federation_worker3 http://matrix.yourdomain.local:8454
	@federation_worker4 path_regexp ^/_matrix/federation/v1/backfill/
	reverse_proxy @federation_worker4 http://matrix.yourdomain.local:8454
	@federation_worker5 path_regexp ^/_matrix/federation/v1/get_missing_events/
	reverse_proxy @federation_worker5 http://matrix.yourdomain.local:8454
	@federation_worker6 path_regexp ^/_matrix/federation/v1/publicRooms
	reverse_proxy @federation_worker6 http://matrix.yourdomain.local:8454
	@federation_worker7 path_regexp ^/_matrix/federation/v1/query/
	reverse_proxy @federation_worker7 http://matrix.yourdomain.local:8454
	@federation_worker8 path_regexp ^/_matrix/federation/v1/make_join/
	reverse_proxy @federation_worker8 http://matrix.yourdomain.local:8454
	@federation_worker9 path_regexp ^/_matrix/federation/v1/make_leave/
	reverse_proxy @federation_worker9 http://matrix.yourdomain.local:8454
	@federation_worker10 path_regexp ^/_matrix/federation/(v1|v2)/send_join/
	reverse_proxy @federation_worker10 http://matrix.yourdomain.local:8454
	@federation_worker11 path_regexp ^/_matrix/federation/(v1|v2)/send_leave/
	reverse_proxy @federation_worker11 http://matrix.yourdomain.local:8454
	@federation_worker12 path_regexp ^/_matrix/federation/(v1|v2)/invite/
	reverse_proxy @federation_worker12 http://matrix.yourdomain.local:8454
	@federation_worker13 path_regexp ^/_matrix/federation/v1/event_auth/
	reverse_proxy @federation_worker13 http://matrix.yourdomain.local:8454
	@federation_worker14 path_regexp ^/_matrix/federation/v1/timestamp_to_event/
	reverse_proxy @federation_worker14 http://matrix.yourdomain.local:8454
	@federation_worker15 path_regexp ^/_matrix/federation/v1/exchange_third_party_invite/
	reverse_proxy @federation_worker15 http://matrix.yourdomain.local:8454
	@federation_worker16 path_regexp ^/_matrix/federation/v1/user/devices/
	reverse_proxy @federation_worker16 http://matrix.yourdomain.local:8454
	@federation_worker17 path_regexp ^/_matrix/key/v2/query
	reverse_proxy @federation_worker17 http://matrix.yourdomain.local:8454
	@federation_worker18 path_regexp ^/_matrix/federation/v1/hierarchy/
	reverse_proxy @federation_worker18 http://matrix.yourdomain.local:8454

	# Inbound federation transaction request
	@federation_worker19 path_regexp ^/_matrix/federation/v1/send/
	reverse_proxy @federation_worker19 http://matrix.yourdomain.local:8454

	#Handles the media repository.
	reverse_proxy /_matrix/media/* http://matrix.yourdomain.local:8085

	#media-specific administration APIs
	@media_worker1 path_regexp ^/_synapse/admin/v1/purge_media_cache$
	reverse_proxy @media_worker1 http://matrix.yourdomain.local:8085
	@media_worker2 path_regexp ^/_synapse/admin/v1/room/.*/media.*$
	reverse_proxy @media_worker2 http://matrix.yourdomain.local:8085
	@media_worker3 path_regexp ^/_synapse/admin/v1/user/.*/media.*$
	reverse_proxy @media_worker3 http://matrix.yourdomain.local:8085
	@media_worker4 path_regexp ^/_synapse/admin/v1/media/.*$
	reverse_proxy @media_worker4 http://matrix.yourdomain.local:8085
	@media_worker5 path_regexp ^/_synapse/admin/v1/quarantine_media/.*$
	reverse_proxy @media_worker5 http://matrix.yourdomain.local:8085
	@media_worker6 path_regexp ^/_synapse/admin/v1/users/.*/media$
	reverse_proxy @media_worker6 http://matrix.yourdomain.local:8085

	#Client Syncing
	@client_sync_worker1 path_regexp ^/_matrix/client/(r0|v3)/sync$
	reverse_proxy @client_sync_worker1 http://matrix.yourdomain.local:8456
	@client_sync_worker2 path_regexp ^/_matrix/client/(api/v1|r0|v3)/events$
	reverse_proxy @client_sync_worker2 http://matrix.yourdomain.local:8456
	@client_sync_worker3 path_regexp ^/_matrix/client/(api/v1|r0|v3)/initialSync$
	reverse_proxy @client_sync_worker3 http://matrix.yourdomain.local:8456
	@client_sync_worker4 path_regexp ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$
	reverse_proxy @client_sync_worker4 http://matrix.yourdomain.local:8456

	# Client API
	@client_api_worker1 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom$
	reverse_proxy @client_api_worker1 http://matrix.yourdomain.local:8457
	@client_api_worker2 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$
	reverse_proxy @client_api_worker2 http://matrix.yourdomain.local:8457
	@client_api_worker3 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$
	reverse_proxy @client_api_worker3 http://matrix.yourdomain.local:8457
	@client_api_worker4 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$
	reverse_proxy @client_api_worker4 http://matrix.yourdomain.local:8457
	@client_api_worker5 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$
	reverse_proxy @client_api_worker5 http://matrix.yourdomain.local:8457
	@client_api_worker6 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$
	reverse_proxy @client_api_worker6 http://matrix.yourdomain.local:8457
	@client_api_worker7 path_regexp ^/_matrix/client/v1/rooms/.*/hierarchy$
	reverse_proxy @client_api_worker7 http://matrix.yourdomain.local:8457
	@client_api_worker8 path_regexp ^/_matrix/client/(v1|unstable)/rooms/.*/relations/
	reverse_proxy @client_api_worker8 http://matrix.yourdomain.local:8457
	@client_api_worker9 path_regexp ^/_matrix/client/v1/rooms/.*/threads$
	reverse_proxy @client_api_worker9 http://matrix.yourdomain.local:8457
	@client_api_worker10 path_regexp ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$
	reverse_proxy @client_api_worker10 http://matrix.yourdomain.local:8457
	@client_api_worker11 path_regexp ^/_matrix/client/(r0|v3|unstable)/account/3pid$
	reverse_proxy @client_api_worker11 http://matrix.yourdomain.local:8457
	@client_api_worker12 path_regexp ^/_matrix/client/(r0|v3|unstable)/account/whoami$
	reverse_proxy @client_api_worker12 http://matrix.yourdomain.local:8457
	@client_api_worker13 path_regexp ^/_matrix/client/(r0|v3|unstable)/devices$
	reverse_proxy @client_api_worker13 http://matrix.yourdomain.local:8457
	@client_api_worker14 path_regexp ^/_matrix/client/versions$
	reverse_proxy @client_api_worker14 http://matrix.yourdomain.local:8457
	@client_api_worker15 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$
	reverse_proxy @client_api_worker15 http://matrix.yourdomain.local:8457
	@client_api_worker16 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/
	reverse_proxy @client_api_worker16 http://matrix.yourdomain.local:8457
	@client_api_worker17 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
	reverse_proxy @client_api_worker17 http://matrix.yourdomain.local:8457
	@client_api_worker18 path_regexp ^/_matrix/client/v1/rooms/.*/timestamp_to_event$
	reverse_proxy @client_api_worker18 http://matrix.yourdomain.local:8457
	@client_api_worker19 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable/.*)/rooms/.*/aliases
	reverse_proxy @client_api_worker19 http://matrix.yourdomain.local:8457
	@client_api_worker20 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/search$
	reverse_proxy @client_api_worker20 http://matrix.yourdomain.local:8457
	@client_api_worker21 path_regexp ^/_matrix/client/(r0|v3|unstable)/user/.*/filter(/|$)
	reverse_proxy @client_api_worker21 http://matrix.yourdomain.local:8457
	@client_api_worker22 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/directory/room/.*$
	reverse_proxy @client_api_worker22 http://matrix.yourdomain.local:8457
	@client_api_worker23 path_regexp ^/_matrix/client/(r0|v3|unstable)/capabilities$
	reverse_proxy @client_api_worker23 http://matrix.yourdomain.local:8457
	@client_api_worker24 path_regexp ^/_matrix/client/(r0|v3|unstable)/notifications$
	reverse_proxy @client_api_worker24 http://matrix.yourdomain.local:8457

	# Encryption requests
	@client_encryption_worker1 path_regexp ^/_matrix/client/(r0|v3|unstable)/keys/query$
	reverse_proxy @client_encryption_worker1 http://matrix.yourdomain.local:8458
	@client_encryption_worker2 path_regexp ^/_matrix/client/(r0|v3|unstable)/keys/changes$
	reverse_proxy @client_encryption_worker2 http://matrix.yourdomain.local:8458
	@client_encryption_worker3 path_regexp ^/_matrix/client/(r0|v3|unstable)/keys/claim$
	reverse_proxy @client_encryption_worker3 http://matrix.yourdomain.local:8458
	@client_encryption_worker4 path_regexp ^/_matrix/client/(r0|v3|unstable)/room_keys/
	reverse_proxy @client_encryption_worker4 http://matrix.yourdomain.local:8458
	@client_encryption_worker5 path_regexp ^/_matrix/client/(r0|v3|unstable)/keys/upload/
	reverse_proxy @client_encryption_worker5 http://matrix.yourdomain.local:8458

	# Registration/login requests
	@client_login_worker1 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/login$
	reverse_proxy @client_login_worker1 http://matrix.yourdomain.local:8459
	@client_login_worker2 path_regexp ^/_matrix/client/(r0|v3|unstable)/register$
	reverse_proxy @client_login_worker2 http://matrix.yourdomain.local:8459
	@client_login_worker3 path_regexp ^/_matrix/client/(r0|v3|unstable)/register/available$
	reverse_proxy @client_login_worker3 http://matrix.yourdomain.local:8459
	@client_login_worker4 path_regexp ^/_matrix/client/v1/register/m.login.registration_token/validity$
	reverse_proxy @client_login_worker4 http://matrix.yourdomain.local:8459
	@client_login_worker5 path_regexp ^/_matrix/client/(r0|v3|unstable)/password_policy$
	reverse_proxy @client_login_worker5 http://matrix.yourdomain.local:8459

	# Event sending requests
	@client_sender_worker1 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact
	reverse_proxy @client_sender_worker1 http://matrix.yourdomain.local:8460
	@client_sender_worker2 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send
	reverse_proxy @client_sender_worker2 http://matrix.yourdomain.local:8460
	@client_sender_worker3 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/
	reverse_proxy @client_sender_worker3 http://matrix.yourdomain.local:8460
	@client_sender_worker4 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
	reverse_proxy @client_sender_worker4 http://matrix.yourdomain.local:8460
	@client_sender_worker5 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/messages$
	reverse_proxy @client_sender_worker5 http://matrix.yourdomain.local:8460
	@client_sender_worker6 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/join/
	reverse_proxy @client_sender_worker6 http://matrix.yourdomain.local:8460
	@client_sender_worker7 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/knock/
	reverse_proxy @client_sender_worker7 http://matrix.yourdomain.local:8460
	@client_sender_worker8 path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/profile/
	reverse_proxy @client_sender_worker8 http://matrix.yourdomain.local:8460
	#Client push rules
	@client_pushrules_worker path_regexp ^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/
	reverse_proxy @client_sender_worker8 http://matrix.yourdomain.local:8461

	#Catch All
	reverse_proxy /_matrix/* http://matrix.yourdomain.local:8448

	reverse_proxy /_synapse/client/* http://matrix.yourdomain.local:8448
}

Homeserver Configs

The main homeserver.yaml is located under /etc/matrix-synapse (On Ubuntu/Debian)

I then put the workers configs under /etc/matrix-synapse/workers in unique files per role. You will need to talk to systemd to get unique service units rolled out per worker. You can see how to do this here 1

Main Synapse Configs homeserver.yaml (click here to expand)
server_name: yourdomain.co
serve_server_wellknown: true
enable_metrics: true
suppress_key_server_warning: true
report_stats: false
pid_file: /var/run/matrix-synapse.pid
listeners:
  - port: 8080
    tls: false
    type: http
    x_forwarded: true
    bind_addresses: ['127.0.0.1']
    resources:
      - names: [replication, health]

  - type: http
    port: 8448
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client, federation]
        compress: true

  - port: 9000
    tls: false
    type: http
    resources:
      - names: [metrics]
    bind_addresses: ['0.0.0.0']

worker_replication_secret: "itsasecret"
instance_map:
    main:
        host: '127.0.0.1'
        port: 8080
    event_persister1:
        host: '127.0.0.1'
        port: 8034
    federation_sender1:
        host: '127.0.0.1'
        port: 8035
    generic_worker1:
        host: '127.0.0.1'
        port: 8036
    background_worker:
        host: '127.0.0.1'
        port: 8037
    media_worker:
        host: '127.0.0.1'
        port: 8038
    pusher_worker1:
        host: '127.0.0.1'
        port: 8039
    typing_worker:
        host: '127.0.0.1'
        port: 8041
    to_device_worker:
        host: '127.0.0.1'
        port: 8042
    account_data_worker:
        host: '127.0.0.1'
        port: 8043
    receipts_worker:
        host: '127.0.0.1'
        port: 8044
    presence_worker:
        host: '127.0.0.1'
        port: 8045
    federation_worker:
        host: '127.0.0.1'
        port: 8046
    client_sync_worker:
        host: '127.0.0.1'
        port: 8047
    client_api_worker:
        host: '127.0.0.1'
        port: 8048
    client_encryption_worker:
        host: '127.0.0.1'
        port: 8049
    client_login_worker:
        host: '127.0.0.1'
        port: 8050
    client_sender_worker:
        host: '127.0.0.1'
        port: 8051
    client_pushrules_worker:
        host: '127.0.0.1'
        port: 8052



stream_writers:
    events: event_persister1
    typing: typing_worker
    to_device: to_device_worker
    account_data: account_data_worker
    receipts: receipts_worker
    presence: presence_worker

run_background_tasks_on: background_worker
notify_appservices_from_worker: federation_sender1
media_instance_running_background_jobs: "media_worker"
start_pushers: false
pusher_instances:
  - pusher_worker1
send_federation: false
outbound_federation_restricted_to:
  - federation_sender1
federation_sender_instances:
  - federation_sender1

enable_media_repo: false

redis:
    enabled: true

database:
  name: psycopg2
  args:
    user: synapse_user
    password: 
    database: synapse
    host: 10.0.7.2
    port: 5435
    cp_min: 5
    cp_max: 10

log_config: "/etc/matrix-synapse/log.yaml"
media_store_path: /var/lib/matrix-synapse/media
signing_key_path: "/etc/matrix-synapse/homeserver.signing.key"
registration_shared_secret: 
trusted_key_servers:
  - server_name: "matrix.org"
rc_federation:
  sleep_limit: 100
  sleep_delay: 100
  reject_limit: 400
  concurrent: 20
turn_uris: [ "turn:yourdomain.co?transport=udp"]
turn_shared_secret: "!"
turn_user_lifetime: 86400000
turn_allow_guests: true
push:
  enabled: true
  include_content: false

Worker Configs

These you want to drop into /etc/matrix-synapse/workers

Towards the end I essentially started splitting things into separate workers based upon how the worker documentation was laid out, this isn’t effective/smart planning but it does work!

Stream Writer Workers


Event persister worker event_persister.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: event_persister1
log_config: "/etc/matrix-synapse/log.yaml"
worker_replication_secret: "itsasecret"
worker_listeners:
  - type: http
    port: 8034
    resources:
      - names: [replication]

Typing worker typing_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: typing_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8041
    resources:
      - names: [replication]

  - type: http
    port: 8449
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

To Device worker to_device_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: to_device_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8042
    resources:
      - names: [replication]

  - type: http
    port: 8450
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

Account data worker account_data_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: account_data_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8043
    resources:
      - names: [replication]

  - type: http
    port: 8451
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

Receipts worker receipts_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: receipts_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8044
    resources:
      - names: [replication]

  - type: http
    port: 8452
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

(Ideally you don’t have presence enabled, as it doesn’t scale well and is very load heavy, but also I wanted to see the impact so i enabled the feature.)

Presence worker presence_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: presence_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8045
    resources:
      - names: [replication]

  - type: http
    port: 8453
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

Non-Stream Workers


Background worker background_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: background_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8037
    resources:
      - names: [replication]

Federation Sender worker federation_sender.yaml (click here to expand)
worker_app: synapse.app.federation_sender
worker_name: federation_sender1
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8035
    resources:
      - names: [replication]

Federation worker federation_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: federation_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8046
    resources:
      - names: [replication]

  - type: http
    port: 8454
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [federation]
        compress: true

Media worker media_worker.yaml (click here to expand)
worker_app: synapse.app.media_repository
worker_name: media_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8085
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [media]

  - type: http
    port: 8038
    resources:
      - names: [replication]

(From reading the docs this seems to only be used with the open source Sygnal software product, and likely isn’t needed if you’re not using this.1)

Pusher worker pusher_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: pusher_worker1
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8039
    resources:
      - names: [replication]

(This probably could all be one worker on your instance but i just went crazy here)

Client Sync worker client_sync_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: client_sync_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8047
    resources:
      - names: [replication]

  - type: http
    port: 8456
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true


Client Sender worker client_sender_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: client_sender_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8051
    resources:
      - names: [replication]

  - type: http
    port: 8460
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

Client Push Rules worker client_pushrules_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: client_pushrules_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8052
    resources:
      - names: [replication]

  - type: http
    port: 8461
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

Client Login worker client_login_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: client_login_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8050
    resources:
      - names: [replication]

  - type: http
    port: 8459
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

Client Encryption worker client_encryption_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: client_encryption_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8049
    resources:
      - names: [replication]

  - type: http
    port: 8458
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

Client API worker client_api_worker.yaml (click here to expand)
worker_app: synapse.app.generic_worker
worker_name: client_api_worker
worker_replication_secret: "itsasecret"
log_config: "/etc/matrix-synapse/log.yaml"
worker_listeners:
  - type: http
    port: 8048
    resources:
      - names: [replication]

  - type: http
    port: 8457
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client]
        compress: true

I’d love to hear your input please comment here on fedi

^You can usually copy paste the link into your mastodon/pleroma search to reply