2022-02-05 20:32:54 +00:00
|
|
|
---
|
|
|
|
|
2020-08-21 10:52:16 +00:00
|
|
|
- debug:
|
|
|
|
msg: "Compressing room `{{ room_details.room_id }}` having {{ room_details.count }} state group rows"
|
|
|
|
|
|
|
|
- name: Generate rust-synapse-compress-state room compression command
|
|
|
|
set_fact:
|
|
|
|
matrix_synapse_rust_synapse_compress_state_compress_room_command: >-
|
|
|
|
{{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-compress-room
|
|
|
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
|
|
|
--cap-drop=ALL
|
|
|
|
--network={{ matrix_docker_network }}
|
2020-11-25 08:49:59 +00:00
|
|
|
--mount type=bind,src={{ matrix_synapse_rust_synapse_compress_state_base_path }},dst=/work
|
2020-08-21 10:52:16 +00:00
|
|
|
{{ matrix_synapse_rust_synapse_compress_state_docker_image }}
|
|
|
|
/synapse-compress-state -t -o /work/state-compressor.sql
|
|
|
|
-p "host={{ matrix_synapse_database_host }} user={{ matrix_synapse_database_user }} password={{ matrix_synapse_database_password }} dbname={{ matrix_synapse_database_database }}"
|
|
|
|
-r '{{ room_details.room_id }}'
|
|
|
|
|
|
|
|
- name: Run rust-synapse-compress-state room compression command (SQL generation)
|
|
|
|
command: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_command }}"
|
|
|
|
async: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_time }}"
|
|
|
|
poll: 10
|
|
|
|
register: matrix_synapse_rust_synapse_compress_state_compress_room_command_result
|
|
|
|
|
|
|
|
- debug: var="matrix_synapse_rust_synapse_compress_state_compress_room_command_result"
|
|
|
|
|
|
|
|
- name: Generate Postgres compression SQL import command
|
|
|
|
set_fact:
|
|
|
|
matrix_synapse_rust_synapse_compress_state_psql_import_command: >-
|
|
|
|
{{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-psql-import
|
|
|
|
--user={{ matrix_user_uid }}:{{ matrix_user_gid }}
|
|
|
|
--cap-drop=ALL
|
|
|
|
--network={{ matrix_docker_network }}
|
|
|
|
--env-file={{ matrix_postgres_base_path }}/env-postgres-psql
|
2020-11-25 08:49:59 +00:00
|
|
|
--mount type=bind,src={{ matrix_synapse_rust_synapse_compress_state_base_path }},dst=/work,ro
|
2020-08-21 10:52:16 +00:00
|
|
|
--entrypoint=/bin/sh
|
|
|
|
{{ matrix_postgres_docker_image_latest }}
|
|
|
|
-c "cat /work/state-compressor.sql |
|
2021-01-28 16:54:02 +00:00
|
|
|
psql -v ON_ERROR_STOP=1 -h matrix-postgres -d {{ matrix_synapse_database_database }}"
|
2020-08-21 10:52:16 +00:00
|
|
|
|
|
|
|
- name: Import compression SQL into Postgres
|
|
|
|
command: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_command }}"
|
|
|
|
async: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_time }}"
|
|
|
|
poll: 10
|
|
|
|
register: matrix_synapse_rust_synapse_compress_state_psql_import_command_result
|
|
|
|
|
|
|
|
- name: Clean up
|
|
|
|
file:
|
|
|
|
path: "{{ matrix_synapse_rust_synapse_compress_state_base_path }}/state-compressor.sql"
|
|
|
|
state: absent
|