Make --tags=run-postgres-vacuum and --tags=upgrade-postgres not assume Synapse
Fixes https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/2211
This commit is contained in:
parent
5084aa0c65
commit
7fb45a507d
|
@ -2112,6 +2112,11 @@ matrix_postgres_additional_databases: |
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
matrix_postgres_systemd_services_to_stop_for_maintenance_list: |
|
||||||
|
{{
|
||||||
|
['matrix-' + matrix_homeserver_implementation + '.service']
|
||||||
|
}}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# /matrix-postgres
|
# /matrix-postgres
|
||||||
|
|
|
@ -15,6 +15,10 @@ matrix_postgres_db_name: "matrix"
|
||||||
matrix_postgres_base_path: "{{ matrix_base_data_path }}/postgres"
|
matrix_postgres_base_path: "{{ matrix_base_data_path }}/postgres"
|
||||||
matrix_postgres_data_path: "{{ matrix_postgres_base_path }}/data"
|
matrix_postgres_data_path: "{{ matrix_postgres_base_path }}/data"
|
||||||
|
|
||||||
|
# matrix_postgres_systemd_services_to_stop_for_maintenance_list specifies the list of systemd services to stop before vacuuming or upgrading.
|
||||||
|
# These services will be restarted after the operation completes.
|
||||||
|
matrix_postgres_systemd_services_to_stop_for_maintenance_list: []
|
||||||
|
|
||||||
matrix_postgres_architecture: amd64
|
matrix_postgres_architecture: amd64
|
||||||
|
|
||||||
# matrix_postgres_docker_image_suffix controls whether we use Alpine-based images (`-alpine`) or the normal Debian-based images.
|
# matrix_postgres_docker_image_suffix controls whether we use Alpine-based images (`-alpine`) or the normal Debian-based images.
|
||||||
|
|
|
@ -67,11 +67,12 @@
|
||||||
- ansible.builtin.set_fact:
|
- ansible.builtin.set_fact:
|
||||||
matrix_postgres_synapse_was_running: "{{ ansible_facts.services['matrix-synapse.service'] | default(none) is not none and ansible_facts.services['matrix-synapse.service'].state == 'running' }}"
|
matrix_postgres_synapse_was_running: "{{ ansible_facts.services['matrix-synapse.service'] | default(none) is not none and ansible_facts.services['matrix-synapse.service'].state == 'running' }}"
|
||||||
|
|
||||||
- name: Ensure matrix-synapse is stopped
|
- name: Ensure services are stopped
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: matrix-synapse
|
name: "{{ item }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
with_items: "{{ matrix_postgres_systemd_services_to_stop_for_maintenance_list }}"
|
||||||
|
|
||||||
- name: Run Postgres vacuum command
|
- name: Run Postgres vacuum command
|
||||||
ansible.builtin.command: "{{ matrix_postgres_vacuum_command }}"
|
ansible.builtin.command: "{{ matrix_postgres_vacuum_command }}"
|
||||||
|
@ -85,9 +86,9 @@
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
var: "matrix_postgres_synapse_vacuum_result"
|
var: "matrix_postgres_synapse_vacuum_result"
|
||||||
|
|
||||||
- name: Ensure matrix-synapse is started, if it previously was
|
- name: Ensure services are started
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: matrix-synapse
|
name: "{{ item }}"
|
||||||
state: started
|
state: started
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
when: "matrix_postgres_synapse_was_running | bool"
|
with_items: "{{ matrix_postgres_systemd_services_to_stop_for_maintenance_list }}"
|
||||||
|
|
|
@ -55,10 +55,12 @@
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "Upgrading database from {{ matrix_postgres_detected_version_corresponding_docker_image }} to {{ matrix_postgres_docker_image_latest }}"
|
msg: "Upgrading database from {{ matrix_postgres_detected_version_corresponding_docker_image }} to {{ matrix_postgres_docker_image_latest }}"
|
||||||
|
|
||||||
- name: Ensure matrix-synapse is stopped
|
- name: Ensure services are stopped
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: matrix-synapse
|
name: "{{ item }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
|
daemon_reload: true
|
||||||
|
with_items: "{{ matrix_postgres_systemd_services_to_stop_for_maintenance_list }}"
|
||||||
|
|
||||||
- name: Ensure matrix-postgres is started
|
- name: Ensure matrix-postgres is started
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
|
@ -175,11 +177,12 @@
|
||||||
path: "{{ postgres_dump_dir }}/{{ postgres_dump_name }}"
|
path: "{{ postgres_dump_dir }}/{{ postgres_dump_name }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Ensure matrix-synapse is started
|
- name: Ensure services are started
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: matrix-synapse
|
name: "{{ item }}"
|
||||||
state: started
|
state: started
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
with_items: "{{ matrix_postgres_systemd_services_to_stop_for_maintenance_list }}"
|
||||||
|
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
msg: "NOTE: Your old Postgres data directory is preserved at `{{ postgres_auto_upgrade_backup_data_path }}`. You might want to get rid of it once you've confirmed that all is well."
|
msg: "NOTE: Your old Postgres data directory is preserved at `{{ postgres_auto_upgrade_backup_data_path }}`. You might want to get rid of it once you've confirmed that all is well."
|
||||||
|
|
Loading…
Reference in a new issue