Преглед изворни кода

Add conditional restart support to matrix-synapse-s3-storage-provider-migrate

Register env, database config, scripts, and systemd service/timer results,
compute matrix_synapse_s3_storage_provider_restart_necessary, and wire it
into group_vars/matrix_servers instead of hardcoding restart_necessary: true.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
migration-validation-system
Slavi Pantaleev пре 23 часа
родитељ
комит
b3a0f52824
3 измењених фајлова са 25 додато и 1 уклоњено
  1. +1
    -1
      group_vars/matrix_servers
  2. +11
    -0
      roles/custom/matrix-synapse/defaults/main.yml
  3. +13
    -0
      roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/setup_install.yml

+ 1
- 1
group_vars/matrix_servers Прегледај датотеку

@@ -850,7 +850,7 @@ devture_systemd_service_manager_services_list_auto: |
([{
'name': 'matrix-synapse-s3-storage-provider-migrate.timer',
'priority': 5000,
'restart_necessary': true,
'restart_necessary': (matrix_synapse_s3_storage_provider_restart_necessary | bool),
'groups': ['matrix'],
}] if (matrix_synapse_enabled and matrix_synapse_ext_synapse_s3_storage_provider_enabled) else [])
+


+ 11
- 0
roles/custom/matrix-synapse/defaults/main.yml Прегледај датотеку

@@ -125,6 +125,17 @@ matrix_synapse_ext_s3_storage_provider_data_path: "{{ matrix_synapse_ext_s3_stor
# extra arguments to pass to s3-storage-provider script when starting Synapse container
matrix_synapse_ext_s3_storage_provider_container_arguments: []

# matrix_synapse_s3_storage_provider_restart_necessary controls whether the
# s3-storage-provider migrate timer will be restarted (when true) or merely
# started (when false) by the systemd service manager role (when conditional
# restart is enabled).
#
# This value is automatically computed during installation based on whether
# any configuration files or the systemd service/timer files changed.
# The default of `false` means "no restart needed" — appropriate when the role's
# installation tasks haven't run (e.g., due to --tags skipping them).
matrix_synapse_s3_storage_provider_restart_necessary: false

matrix_synapse_container_client_api_port: 8008

# Controls the `x_forwarded` setting for the "Insecure HTTP listener (Client API)".


+ 13
- 0
roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/setup_install.yml Прегледај датотеку

@@ -27,12 +27,14 @@
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/env.j2"
dest: "{{ matrix_synapse_ext_s3_storage_provider_base_path }}/env"
mode: '0640'
register: matrix_synapse_s3_storage_provider_env_result

- name: Ensure s3-storage-provider database.yaml file installed
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/database.yaml.j2"
dest: "{{ matrix_synapse_ext_s3_storage_provider_data_path }}/database.yaml"
mode: '0640'
register: matrix_synapse_s3_storage_provider_database_config_result

- name: Ensure s3-storage-provider scripts installed
ansible.builtin.template:
@@ -42,6 +44,7 @@
with_items:
- shell
- migrate
register: matrix_synapse_s3_storage_provider_scripts_result

- name: Ensure matrix-synapse-s3-storage-provider-migrate.service and timer are installed
ansible.builtin.template:
@@ -52,3 +55,13 @@
- matrix-synapse-s3-storage-provider-migrate.service
- matrix-synapse-s3-storage-provider-migrate.timer
register: matrix_synapse_s3_storage_provider_systemd_service_result

- name: Determine whether s3-storage-provider migrate timer needs a restart
ansible.builtin.set_fact:
matrix_synapse_s3_storage_provider_restart_necessary: >-
{{
matrix_synapse_s3_storage_provider_env_result.changed | default(false)
or matrix_synapse_s3_storage_provider_database_config_result.changed | default(false)
or matrix_synapse_s3_storage_provider_scripts_result.changed | default(false)
or matrix_synapse_s3_storage_provider_systemd_service_result.changed | default(false)
}}

Loading…
Откажи
Сачувај