Run Synapse workers in their own containers
This switches the `docker exec` method of spawning Synapse workers inside the `matrix-synapse` container with dedicated containers for each worker. We also have dedicated systemd services for each worker, so this are now: - more consistent with everything else (we don't use systemd instantiated services anywhere) - we don't need the "parse systemd instance name into worker name + port" part - we don't need to keep track of PIDs manually - we don't need jq (less depenendencies) - workers dying would be restarted by systemd correctly, like any other service - `docker ps` shows each worker separately and we can observe resource usage
This commit is contained in:
@ -0,0 +1,6 @@
|
||||
|
||||
- set_fact:
|
||||
matrix_synapse_worker_systemd_service_name: "matrix-synapse-worker-{{ matrix_synapse_worker_details.type }}-{{ matrix_synapse_worker_details.port }}.service"
|
||||
|
||||
- set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + [matrix_synapse_worker_systemd_service_name] }}"
|
@ -0,0 +1,20 @@
|
||||
|
||||
- set_fact:
|
||||
matrix_synapse_worker_systemd_service_name: "matrix-synapse-worker-{{ matrix_synapse_worker_details.type }}-{{ matrix_synapse_worker_details.port }}"
|
||||
|
||||
- set_fact:
|
||||
matrix_synapse_worker_container_name: "{{ matrix_synapse_worker_systemd_service_name }}"
|
||||
|
||||
- set_fact:
|
||||
matrix_synapse_worker_config_file_name: "worker.{{ matrix_synapse_worker_details.type }}_{{ matrix_synapse_worker_details.port }}.yaml"
|
||||
|
||||
- name: Ensure configuration exists for {{ matrix_synapse_worker_systemd_service_name }}
|
||||
template:
|
||||
src: "{{ role_path }}/templates/synapse/worker.yaml.j2"
|
||||
dest: "{{ matrix_synapse_config_dir_path }}/{{ matrix_synapse_worker_config_file_name }}"
|
||||
|
||||
- name: Ensure systemd service exists for {{ matrix_synapse_worker_systemd_service_name }}
|
||||
template:
|
||||
src: "{{ role_path }}/templates/synapse/systemd/matrix-synapse-worker.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/{{ matrix_synapse_worker_systemd_service_name }}.service"
|
||||
mode: 0644
|
Reference in New Issue
Block a user