From f933ba14aee96be9776b6bbba3ccf071ff88eb12 Mon Sep 17 00:00:00 2001 From: Toorero Date: Fri, 16 Jul 2021 13:27:36 +0200 Subject: [PATCH] Fixed self-build functionality for mautrix-signal and added self-build functionality for signald --- group_vars/matrix_servers | 4 +- .../defaults/main.yml | 6 ++- .../tasks/setup_install.yml | 48 ++++++++++++++----- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 8e151d15..43e4007f 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -374,14 +374,14 @@ matrix_mautrix_signal_login_shared_secret: "{{ matrix_synapse_ext_password_provi matrix_mautrix_signal_database_engine: 'postgres' matrix_mautrix_signal_database_password: "{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'mau.signal.db') | to_uuid }}" +matrix_mautrix_signal_daemon_container_self_build: "{{ matrix_architecture != 'amd64' }}" # sadly not automatic detectable because no manifest + ###################################################################### # # /matrix-bridge-mautrix-signal # ###################################################################### -matrix_mautrix_signal_container_self_build: "{{ matrix_architecture not in ['arm64', 'amd64'] }}" - ###################################################################### # # matrix-bridge-mautrix-telegram diff --git a/roles/matrix-bridge-mautrix-signal/defaults/main.yml b/roles/matrix-bridge-mautrix-signal/defaults/main.yml index 8c121c03..7ff450d9 100644 --- a/roles/matrix-bridge-mautrix-signal/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-signal/defaults/main.yml @@ -3,7 +3,7 @@ matrix_mautrix_signal_enabled: true -matrix_mautrix_signal_self_build: false +matrix_mautrix_signal_container_self_build: false matrix_mautrix_signal_docker_repo: "https://mau.dev/tulir/mautrix-signal.git" matrix_mautrix_signal_docker_src_files_path: "{{ matrix_base_data_path }}/mautrix-signal/docker-src" @@ -13,6 +13,10 @@ matrix_mautrix_signal_daemon_version: latest matrix_mautrix_signal_docker_image: "dock.mau.dev/tulir/mautrix-signal:{{ matrix_mautrix_signal_version }}" matrix_mautrix_signal_docker_image_force_pull: "{{ matrix_mautrix_signal_docker_image.endswith(':latest') }}" +matrix_mautrix_signal_daemon_container_self_build: false +matrix_mautrix_signal_daemon_docker_repo: "https://mau.dev/maunium/signald.git" +matrix_mautrix_signal_daemon_docker_src_files_path: "{{ matrix_base_data_path }}/mautrix-signald/docker-src" + matrix_mautrix_signal_daemon_docker_image: "dock.mau.dev/maunium/signald:{{ matrix_mautrix_signal_daemon_version }}" matrix_mautrix_signal_daemon_docker_image_force_pull: "{{ matrix_mautrix_signal_daemon_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml index f90043d8..c890b706 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml @@ -8,13 +8,25 @@ The matrix-bridge-mautrix-signal role needs to execute before the matrix-synapse role. when: "matrix_synapse_role_executed|default(False)" +- name: Ensure Mautrix Signal image is pulled + docker_image: + name: "{{ matrix_mautrix_signal_docker_image }}" + source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" + force_source: "{{ matrix_mautrix_signal_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" + force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_signal_docker_image_force_pull }}" +# pull: +# platform: "{{ matrix_architecture }}" + when: "matrix_mautrix_signal_enabled|bool and not matrix_mautrix_signal_container_self_build|bool" + register: matrix_mautrix_signal_pull_results + ignore_errors: yes + - name: Ensure Mautrix Signal repository is present on self-build git: repo: "{{ matrix_mautrix_signal_docker_repo }}" dest: "{{ matrix_mautrix_signal_docker_src_files_path }}" force: "yes" register: matrix_mautrix_signal_git_pull_results - when: "matrix_mautrix_signal_enabled|bool and matrix_mautrix_signal_container_self_build|bool" + when: "matrix_mautrix_signal_enabled|bool and (matrix_mautrix_signal_container_self_build|bool or matrix_mautrix_signal_pull_results is failed)" - name: Ensure Mautrix Signal image is built docker_image: @@ -26,16 +38,8 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_signal_docker_src_files_path }}" pull: yes - when: "matrix_mautrix_signal_enabled|bool and matrix_mautrix_signal_container_self_build|bool" + when: "matrix_mautrix_signal_enabled|bool and (matrix_mautrix_signal_container_self_build|bool or matrix_mautrix_signal_pull_results is failed)" -- name: Ensure Mautrix Signal image is pulled - docker_image: - name: "{{ matrix_mautrix_signal_docker_image }}" - source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" - force_source: "{{ matrix_mautrix_signal_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" - force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_signal_docker_image_force_pull }}" - when: "matrix_mautrix_signal_enabled|bool and not matrix_mautrix_signal_container_self_build|bool" - - name: Ensure Mautrix Signal Daemon image is pulled docker_image: @@ -43,7 +47,29 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_signal_daemon_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mautrix_signal_daemon_docker_image_force_pull }}" - when: matrix_mautrix_signal_enabled|bool + when: matrix_mautrix_signal_enabled and not matrix_mautrix_signal_daemon_container_self_build|bool + register: matrix_mautrix_signal_daemon_pull_results + ignore_errors: yes + +- name: Ensure Mautrix Signal Daemon repository is present on self-build + git: + repo: "{{ matrix_mautrix_signal_daemon_docker_repo }}" + dest: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}" + force: "yes" + register: matrix_mautrix_signal_daemon_git_pull_results + when: "matrix_mautrix_signal_enabled|bool and (matrix_mautrix_signal_daemon_container_self_build|bool or matrix_mautrix_signal_daemon_pull_results is failed)" + +- name: Ensure Mautrix Signal Daemon image is built + docker_image: + name: "{{ matrix_mautrix_signal_daemon_docker_image }}" + source: build + force_source: "{{ matrix_mautrix_signal_daemon_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" + force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}" + build: + dockerfile: Dockerfile + path: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}" + pull: yes + when: "matrix_mautrix_signal_enabled|bool and (matrix_mautrix_signal_daemon_container_self_build|bool or matrix_mautrix_signal_daemon_pull_results is failed)" - name: Ensure Mautrix Signal paths exist file: