From 2bb8bb96d47ee755d54e32188582830ea027686e Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 30 Aug 2017 12:07:03 +0300 Subject: [PATCH] Add support for configuring max_upload_size --- roles/matrix-server/defaults/main.yml | 4 +++- roles/matrix-server/tasks/setup_synapse.yml | 6 ++++++ .../templates/nginx-conf.d/matrix-synapse.conf.j2 | 4 +--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/matrix-server/defaults/main.yml b/roles/matrix-server/defaults/main.yml index a7aafc17f..1b1c5876e 100644 --- a/roles/matrix-server/defaults/main.yml +++ b/roles/matrix-server/defaults/main.yml @@ -44,4 +44,6 @@ matrix_services_restart_cron_time_definition: "15 4 3 * *" matrix_coturn_turn_udp_min_port: 49152 matrix_coturn_turn_udp_max_port: 49172 -matrix_coturn_turn_external_ip_address: "{{ ansible_host }}" \ No newline at end of file +matrix_coturn_turn_external_ip_address: "{{ ansible_host }}" + +matrix_max_upload_size_mb: 10 \ No newline at end of file diff --git a/roles/matrix-server/tasks/setup_synapse.yml b/roles/matrix-server/tasks/setup_synapse.yml index 56f927e4d..5057feb3a 100644 --- a/roles/matrix-server/tasks/setup_synapse.yml +++ b/roles/matrix-server/tasks/setup_synapse.yml @@ -101,6 +101,12 @@ - {'variable': 'max-port', 'value': "{{ matrix_coturn_turn_udp_max_port }}"} - {'variable': 'external-ip', 'value': "{{ matrix_coturn_turn_external_ip_address }}"} +- name: Augment Matrix config (set max upload size) + lineinfile: "dest={{ matrix_synapse_data_path }}/homeserver.yaml" + args: + regexp: "^max_upload_size:" + line: 'max_upload_size: "{{ matrix_max_upload_size_mb }}M"' + - name: Allow access to Matrix ports in firewalld firewalld: port: "{{ item }}" diff --git a/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 b/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 index be3988e17..a11d11ac1 100644 --- a/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 +++ b/roles/matrix-server/templates/nginx-conf.d/matrix-synapse.conf.j2 @@ -34,10 +34,8 @@ server { proxy_pass http://synapse:8008; proxy_set_header X-Forwarded-For $remote_addr; - # These are intentionally large. - # Note that Synapse enforces its own limits, which are smaller. client_body_buffer_size 25M; - client_max_body_size 100M; + client_max_body_size {{ matrix_max_upload_size_mb }}M; proxy_max_temp_file_size 0; } }