diff --git a/roles/custom/matrix-client-schildichat/defaults/main.yml b/roles/custom/matrix-client-schildichat/defaults/main.yml index bd7ab05d8..22d71f29e 100644 --- a/roles/custom/matrix-client-schildichat/defaults/main.yml +++ b/roles/custom/matrix-client-schildichat/defaults/main.yml @@ -4,6 +4,12 @@ matrix_client_schildichat_enabled: true matrix_client_schildichat_container_image_self_build: false +matrix_client_schildichat_container_image_self_build_repo: "https://github.com/SchildiChat/schildichat-desktop.git" +matrix_client_schildichat_container_image_self_build_version: "{{ 'lite' if matrix_client_schildichat_version == 'latest' else ('v' + matrix_client_schildichat_version) }}" +# Controls whether to patch webpack.config.js when self-building, so that building can pass on low-memory systems (< 4 GB RAM): +# - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1357 +# - https://github.com/element-hq/element-web/issues/19544 +matrix_client_schildichat_container_image_self_build_low_memory_system_patch_enabled: "{{ ansible_memtotal_mb < 4096 }}" # renovate: datasource=docker depName=ghcr.io/etkecc/schildichat-web matrix_client_schildichat_version: 1.11.36-sc.3 @@ -12,7 +18,7 @@ matrix_client_schildichat_docker_image_name_prefix: "{{ 'localhost/' if matrix_c matrix_client_schildichat_docker_image_force_pull: "{{ matrix_client_schildichat_docker_image.endswith(':latest') }}" matrix_client_schildichat_data_path: "{{ matrix_base_data_path }}/client-schildichat" -matrix_client_schildichat_docker_src_files_path: "{{ matrix_client_schildichat_data_path }}/docker-src" +matrix_client_schildichat_container_src_files_path: "{{ matrix_client_schildichat_data_path }}/docker-src" # The base container network matrix_client_schildichat_container_network: '' diff --git a/roles/custom/matrix-client-schildichat/tasks/setup_install.yml b/roles/custom/matrix-client-schildichat/tasks/setup_install.yml index 6dc9222c4..b27f5bc48 100644 --- a/roles/custom/matrix-client-schildichat/tasks/setup_install.yml +++ b/roles/custom/matrix-client-schildichat/tasks/setup_install.yml @@ -9,10 +9,10 @@ group: "{{ matrix_user_groupname }}" with_items: - {path: "{{ matrix_client_schildichat_data_path }}", when: true} - - {path: "{{ matrix_client_schildichat_docker_src_files_path }}", when: "{{ matrix_client_schildichat_container_image_self_build }}"} + - {path: "{{ matrix_client_schildichat_container_src_files_path }}", when: "{{ matrix_client_schildichat_container_image_self_build }}"} when: "item.when | bool" -- name: Ensure SchildiChat Web Docker image is pulled +- name: Ensure SchildiChat Web container image is pulled community.docker.docker_image: name: "{{ matrix_client_schildichat_docker_image }}" source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" @@ -24,40 +24,40 @@ delay: "{{ devture_playbook_help_container_retries_delay }}" until: result is not failed -- name: Ensure SchildiChat Web repository is present on self-build - ansible.builtin.git: - repo: "{{ matrix_client_schildichat_container_image_self_build_repo }}" - dest: "{{ matrix_client_schildichat_docker_src_files_path }}" - version: "{{ matrix_client_schildichat_docker_image.split(':')[1] }}" - force: "yes" - become: true - become_user: "{{ matrix_user_username }}" - register: matrix_client_schildichat_git_pull_results - when: "matrix_client_schildichat_container_image_self_build | bool" +- when: "matrix_client_schildichat_container_image_self_build | bool" + block: + - name: Ensure SchildiChat Web repository is present on self-build + ansible.builtin.git: + repo: "{{ matrix_client_schildichat_container_image_self_build_repo }}" + dest: "{{ matrix_client_schildichat_container_src_files_path }}" + version: "{{ matrix_client_schildichat_container_image_self_build_version }}" + force: "yes" + become: true + become_user: "{{ matrix_user_username }}" + register: matrix_client_schildichat_git_pull_results -# See: -# - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1357 -# - https://github.com/vector-im/schildichat-web/issues/19544 -- # Update (2023-12-15): 404 -- name: Patch webpack.config.js to support building on low-memory (<4G RAM) devices - ansible.builtin.lineinfile: - path: "{{ matrix_client_schildichat_docker_src_files_path }}/webpack.config.js" - regexp: '(\s+)splitChunks: \{' - line: '\1splitChunks: { maxSize: 100000,' - backrefs: true - owner: root - group: root - mode: '0644' - when: "matrix_client_schildichat_container_image_self_build | bool and matrix_client_schildichat_container_image_self_build_low_memory_system_patch_enabled | bool" + # See: + # - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1357 + # - https://github.com/vector-im/schildichat-web/issues/19544 -- # Update (2023-12-15): 404 + - name: Patch webpack.config.js to support building on low-memory (<4G RAM) devices + ansible.builtin.lineinfile: + path: "{{ matrix_client_schildichat_container_src_files_path }}/element-web/webpack.config.js" + regexp: '(\s+)splitChunks: \{' + line: '\1splitChunks: { maxSize: 100000,' + backrefs: true + owner: root + group: root + mode: '0644' + when: "matrix_client_schildichat_container_image_self_build_low_memory_system_patch_enabled | bool" -- name: Ensure SchildiChat Web Docker image is built - ansible.builtin.command: - cmd: |- - {{ devture_systemd_docker_base_host_command_docker }} buildx build - --tag={{ matrix_client_schildichat_docker_image }} - --file={{ matrix_client_schildichat_docker_src_files_path }}/Dockerfile - {{ matrix_client_schildichat_docker_src_files_path }} - changed_when: true - when: matrix_client_schildichat_container_image_self_build | bool + - name: Ensure SchildiChat Web container image is built + ansible.builtin.command: + cmd: |- + {{ devture_systemd_docker_base_host_command_docker }} buildx build + --tag={{ matrix_client_schildichat_docker_image }} + --file={{ matrix_client_schildichat_container_src_files_path }}/Dockerfile + {{ matrix_client_schildichat_container_src_files_path }} + changed_when: true - name: Ensure SchildiChat Web configuration installed ansible.builtin.copy: