diff --git a/roles/custom/matrix-client-element/defaults/main.yml b/roles/custom/matrix-client-element/defaults/main.yml index c38ae8649..763ba1c97 100644 --- a/roles/custom/matrix-client-element/defaults/main.yml +++ b/roles/custom/matrix-client-element/defaults/main.yml @@ -29,7 +29,7 @@ matrix_client_element_container_image_self_build_repo: "https://github.com/eleme matrix_client_element_container_image_self_build_low_memory_system_patch_enabled: "{{ ansible_memtotal_mb < 4096 }}" # renovate: datasource=docker depName=ghcr.io/element-hq/element-web -matrix_client_element_version: v1.11.94 +matrix_client_element_version: v1.11.95 matrix_client_element_docker_image: "{{ matrix_client_element_docker_image_registry_prefix }}element-hq/element-web:{{ matrix_client_element_version }}" matrix_client_element_docker_image_registry_prefix: "{{ 'localhost/' if matrix_client_element_container_image_self_build else matrix_client_element_docker_image_registry_prefix_upstream }}" @@ -110,6 +110,14 @@ matrix_client_element_container_extra_arguments: [] # List of systemd services that matrix-client-element.service depends on matrix_client_element_systemd_required_services_list: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" +# Controls the healthcheck command for the container. +# +# Leave empty to use the default (upstream) command. +# +# The default command is a patch until https://github.com/element-hq/element-web/pull/29471 +# lands in a release. +matrix_client_element_container_healthcheck_cmd: "wget -q --spider http://localhost:$ELEMENT_WEB_PORT/config.json" + # Specifies the value of the `X-XSS-Protection` header # Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks. # @@ -360,4 +368,4 @@ matrix_client_element_environment_variable_element_web_port: "{{ matrix_client_e # Example: # matrix_client_element_environment_variables_extension: | # ELEMENT_WEB_PORT=8080 -matrix_client_element_environment_variables_extension: '' \ No newline at end of file +matrix_client_element_environment_variables_extension: '' diff --git a/roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2 b/roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2 index 1b1903b49..9a1475b49 100644 --- a/roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2 +++ b/roles/custom/matrix-client-element/templates/systemd/matrix-client-element.service.j2 @@ -13,6 +13,10 @@ Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}" ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop -t {{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-client-element 2>/dev/null || true' ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-client-element 2>/dev/null || true' +{# + The custom healthcheck command is a patch until https://github.com/element-hq/element-web/pull/29471 + lands in a release. +#} ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ --rm \ --name=matrix-client-element \ @@ -40,6 +44,9 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ --mount type=bind,src={{ matrix_client_element_data_path }}/home.html,dst=/app/home.html,ro \ {% endif %} --mount type=bind,src={{ matrix_client_element_data_path }}/welcome.html,dst=/app/welcome.html,ro \ + {% if matrix_client_element_container_healthcheck_cmd %} + --health-cmd="{{ matrix_client_element_container_healthcheck_cmd }}" \ + {% endif %} {% for arg in matrix_client_element_container_extra_arguments %} {{ arg }} \ {% endfor %}