From 05966c8cff5dd9edc15d49d41cae546b83d8a9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20Horv=C3=A1th?= Date: Mon, 13 Jan 2020 12:52:28 +0100 Subject: [PATCH 01/25] make sure Raspbian is not handled the same as Debian --- roles/matrix-base/tasks/server_base/setup.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/matrix-base/tasks/server_base/setup.yml b/roles/matrix-base/tasks/server_base/setup.yml index 45feb1527..7cb716a93 100644 --- a/roles/matrix-base/tasks/server_base/setup.yml +++ b/roles/matrix-base/tasks/server_base/setup.yml @@ -4,7 +4,10 @@ when: ansible_distribution == 'CentOS' - include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml" - when: ansible_os_family == 'Debian' + when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') + +- include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" + when: (ansible_os_family == 'Debian') and (ansible_lsb.id == 'Raspbian') - name: Ensure Docker is started and autoruns service: From 1c314fcf29c0b20739a14dcf633229e72ec415bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20Horv=C3=A1th?= Date: Mon, 13 Jan 2020 13:38:21 +0100 Subject: [PATCH 02/25] first version of raspbian docker setup --- .../tasks/server_base/setup_raspbian.yml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 roles/matrix-base/tasks/server_base/setup_raspbian.yml diff --git a/roles/matrix-base/tasks/server_base/setup_raspbian.yml b/roles/matrix-base/tasks/server_base/setup_raspbian.yml new file mode 100644 index 000000000..e92842843 --- /dev/null +++ b/roles/matrix-base/tasks/server_base/setup_raspbian.yml @@ -0,0 +1,42 @@ +--- + +- name: Ensure APT usage dependencies are installed + apt: + name: + - apt-transport-https + - ca-certificates + state: present + update_cache: yes + +- name: Ensure Docker's APT key is trusted + apt_key: + url: https://download.docker.com/linux/raspbian/gpg + id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 + state: present + register: add_repository_key + ignore_errors: true + when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + +- name: Ensure Docker repository is enabled + apt_repository: + repo: "deb [arch=armhf] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable" + state: present + update_cache: yes + when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + +- name: Ensure APT packages are installed + apt: + name: + - bash-completion + - python-docker + - ntp + - fuse + state: latest + update_cache: yes + +- name: Ensure Docker is installed + apt: + name: + - "{{ matrix_docker_package_name }}" + state: latest + when: matrix_docker_installation_enabled|bool From a096eafb45c3aba23573ef3d8689d634c59da876 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Mon, 17 Feb 2020 21:48:48 +0100 Subject: [PATCH 03/25] add possibility to install synapse on raspberry pi --- group_vars/matrix_servers | 16 ++++++++++++++++ roles/matrix-base/defaults/main.yml | 2 ++ roles/matrix-base/tasks/sanity_check.yml | 7 +++++++ roles/matrix-base/tasks/server_base/setup.yml | 4 ++-- roles/matrix-base/tasks/setup_matrix_base.yml | 2 ++ .../tasks/synapse/setup_install.yml | 19 +++++++++++++++++++ 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 1c7ac23fd..148382fa7 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -678,3 +678,19 @@ matrix_synapse_systemd_wanted_services_list: | # /matrix-synapse # ###################################################################### + + + +###################################################################### +# +# raspberry pi +# +###################################################################### + +matrix_raspberry_pi: "false" + +###################################################################### +# +# /raspberry pi +# +###################################################################### diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index b4fef1dd7..b5897d0d1 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -26,6 +26,8 @@ matrix_base_data_path: "/matrix" matrix_base_data_path_mode: "750" matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" +matrix_docker_src_files_path: "{{ matrix_base_data_path }}/docker-src" +matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synapse" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" diff --git a/roles/matrix-base/tasks/sanity_check.yml b/roles/matrix-base/tasks/sanity_check.yml index b2d8c249e..a0a92a227 100644 --- a/roles/matrix-base/tasks/sanity_check.yml +++ b/roles/matrix-base/tasks/sanity_check.yml @@ -44,3 +44,10 @@ - "{{ matrix_server_fqn_matrix }}" - "{{ matrix_server_fqn_riot }}" when: "item != item|lower" + +# ansible lower than 2.8, does not support docker_image build parameters +# for Raspberry pi it is explicitly needed, so we rather fail here +- name: Fail if running on Ansible lower than 2.8 and targeting Raspberry pi + fail: + msg: "To target Raspberry pi, you should usa ansible 2.8 or higher. E.g. pip contains such packages." + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_raspberry_pi" diff --git a/roles/matrix-base/tasks/server_base/setup.yml b/roles/matrix-base/tasks/server_base/setup.yml index 7cb716a93..bd52a0e74 100644 --- a/roles/matrix-base/tasks/server_base/setup.yml +++ b/roles/matrix-base/tasks/server_base/setup.yml @@ -4,10 +4,10 @@ when: ansible_distribution == 'CentOS' - include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml" - when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') + when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') - include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" - when: (ansible_os_family == 'Debian') and (ansible_lsb.id == 'Raspbian') + when: "matrix_raspberry_pi" - name: Ensure Docker is started and autoruns service: diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index b4aa92b9a..952a37a5d 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -22,6 +22,8 @@ group: "{{ matrix_user_username }}" with_items: - "{{ matrix_base_data_path }}" + - "{{ matrix_docker_src_files_path }}" + - "{{ matrix_docker_synapse_src_files_path }}" # `docker_network` doesn't work as expected when the given network # is a substring of a network that already exists. diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index 88fb0049c..33f04a288 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -18,12 +18,31 @@ group: "{{ matrix_user_username }}" when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists" +- name: Ensure Synapse repository is present on Raspberry pi + git: + repo: https://github.com/matrix-org/synapse.git + dest: "{{ matrix_docker_synapse_src_files_path }}" + version: "{{ matrix_synapse_docker_image.split(':')[1] }}" + force: "yes" + when: "matrix_raspberry_pi" + +- name: Ensure Synapse Docker image is build (Raspberry pi) + docker_image: + name: "{{ matrix_synapse_docker_image }}" + source: build + build: + dockerfile: docker/Dockerfile + path: "{{ matrix_docker_synapse_src_files_path }}" + pull: yes + when: "matrix_raspberry_pi" + - name: Ensure Synapse Docker image is pulled docker_image: name: "{{ matrix_synapse_docker_image }}" source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_synapse_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_synapse_docker_image_force_pull }}" + when: "not matrix_raspberry_pi" - name: Check if a Synapse signing key exists stat: From 7c4a86bc6b835eb7e30787f7fc4bef1853510b7d Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Wed, 19 Feb 2020 22:18:17 +0100 Subject: [PATCH 04/25] add coturn support for raspberry pi --- roles/matrix-base/defaults/main.yml | 1 + roles/matrix-base/tasks/setup_matrix_base.yml | 5 +++-- roles/matrix-coturn/tasks/setup_coturn.yml | 20 ++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index b5897d0d1..6dd986e3a 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -28,6 +28,7 @@ matrix_base_data_path_mode: "750" matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" matrix_docker_src_files_path: "{{ matrix_base_data_path }}/docker-src" matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synapse" +matrix_docker_coturn_src_files_path: "{{ matrix_docker_src_files_path }}/coturn" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index 952a37a5d..fcf0300e8 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -22,8 +22,9 @@ group: "{{ matrix_user_username }}" with_items: - "{{ matrix_base_data_path }}" - - "{{ matrix_docker_src_files_path }}" - - "{{ matrix_docker_synapse_src_files_path }}" + - { src: "{{ matrix_docker_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } + - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } + - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_enabled }}"} # `docker_network` doesn't work as expected when the given network # is a substring of a network that already exists. diff --git a/roles/matrix-coturn/tasks/setup_coturn.yml b/roles/matrix-coturn/tasks/setup_coturn.yml index eaa29aa58..9cbf6f033 100644 --- a/roles/matrix-coturn/tasks/setup_coturn.yml +++ b/roles/matrix-coturn/tasks/setup_coturn.yml @@ -10,7 +10,25 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_coturn_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_coturn_docker_image_force_pull }}" - when: matrix_coturn_enabled|bool + when: matrix_coturn_enabled|bool and not matrix_raspberry_pi + +- name: Ensure Coturn repository is present on Raspberry pi + git: + repo: https://github.com/instrumentisto/coturn-docker-image.git + dest: "{{ matrix_docker_coturn_src_files_path }}" + version: "{{ matrix_coturn_docker_image.split(':')[1] }}" + force: "yes" + when: "matrix_raspberry_pi" + +- name: Ensure Coturn Docker image is build (Raspberry pi) + docker_image: + name: "{{ matrix_coturn_docker_image }}" + source: build + build: + dockerfile: Dockerfile + path: "{{ matrix_docker_coturn_src_files_path }}" + pull: yes + when: "matrix_raspberry_pi" - name: Ensure Coturn configuration path exists file: From 697f86d06f834fbdc828bba32f727f002c5d75f8 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Wed, 19 Feb 2020 22:26:43 +0100 Subject: [PATCH 05/25] minor fix --- roles/matrix-coturn/tasks/setup_coturn.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/matrix-coturn/tasks/setup_coturn.yml b/roles/matrix-coturn/tasks/setup_coturn.yml index 9cbf6f033..bdd7d774f 100644 --- a/roles/matrix-coturn/tasks/setup_coturn.yml +++ b/roles/matrix-coturn/tasks/setup_coturn.yml @@ -18,7 +18,7 @@ dest: "{{ matrix_docker_coturn_src_files_path }}" version: "{{ matrix_coturn_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_raspberry_pi" + when: "matrix_coturn_enabled|bool and matrix_raspberry_pi" - name: Ensure Coturn Docker image is build (Raspberry pi) docker_image: @@ -28,7 +28,7 @@ dockerfile: Dockerfile path: "{{ matrix_docker_coturn_src_files_path }}" pull: yes - when: "matrix_raspberry_pi" + when: "matrix_coturn_enabled|bool and matrix_raspberry_pi" - name: Ensure Coturn configuration path exists file: From 8c1e00a6cd446f40d589b4ecc75a697330e0d11b Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Fri, 21 Feb 2020 07:56:28 +0100 Subject: [PATCH 06/25] add mautrix-facebook support for raspberry pi --- roles/matrix-base/defaults/main.yml | 1 + roles/matrix-base/tasks/setup_matrix_base.yml | 1 + .../tasks/setup_install.yml | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index 6dd986e3a..84199623a 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -29,6 +29,7 @@ matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" matrix_docker_src_files_path: "{{ matrix_base_data_path }}/docker-src" matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synapse" matrix_docker_coturn_src_files_path: "{{ matrix_docker_src_files_path }}/coturn" +matrix_docker_mautrix_facebook_src_files_path: "{{ matrix_docker_src_files_path }}/mautrix-facebook" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index fcf0300e8..aa4177eb6 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -25,6 +25,7 @@ - { src: "{{ matrix_docker_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_enabled }}"} + - { src: "{{ matrix_docker_mautrix_facebook_src_files_path }}", when: "{{ matrix_mautrix_facebook_enabled }}"} # `docker_network` doesn't work as expected when the given network # is a substring of a network that already exists. diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index 68c823c6c..a8c7cdf1a 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -14,6 +14,25 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_facebook_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_facebook_docker_image_force_pull }}" + when: matrix_mautrix_facebook_enabled|bool and not matrix_raspberry_pi + +- name: Ensure Mautrix Facebook repository is present on Raspberry pi + git: + repo: https://github.com/tulir/mautrix-facebook.git + dest: "{{ matrix_docker_mautrix_facebook_src_files_path }}" +# version: "{{ matrix_coturn_docker_image.split(':')[1] }}" + force: "yes" + when: "matrix_mautrix_facebook_enabled|bool and matrix_raspberry_pi" + +- name: Ensure Mautrix Facebook Docker image is build (Raspberry pi) + docker_image: + name: "{{ matrix_mautrix_facebook_docker_image }}" + source: build + build: + dockerfile: Dockerfile + path: "{{ matrix_docker_mautrix_facebook_src_files_path }}" + pull: yes + when: "matrix_mautrix_facebook_enabled|bool and matrix_raspberry_pi" - name: Ensure Mautrix Facebook paths exist file: From f28c7b71d26fbad4ebf1307d64559baf7a63ff86 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Fri, 21 Feb 2020 18:08:24 +0100 Subject: [PATCH 07/25] build mxisd for rapsberry pi --- roles/matrix-base/defaults/main.yml | 1 + roles/matrix-base/tasks/setup_matrix_base.yml | 1 + roles/matrix-mxisd/tasks/setup_mxisd.yml | 34 ++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index 84199623a..b7e0681a5 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -29,6 +29,7 @@ matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" matrix_docker_src_files_path: "{{ matrix_base_data_path }}/docker-src" matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synapse" matrix_docker_coturn_src_files_path: "{{ matrix_docker_src_files_path }}/coturn" +matrix_docker_mxisd_src_files_path: "{{ matrix_docker_src_files_path }}/mxisd" matrix_docker_mautrix_facebook_src_files_path: "{{ matrix_docker_src_files_path }}/mautrix-facebook" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index aa4177eb6..5823e39fa 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -25,6 +25,7 @@ - { src: "{{ matrix_docker_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_enabled }}"} + - { src: "{{ matrix_docker_mxisd_src_files_path }}", when: "{{ matrix_mxisd_enabled }}"} - { src: "{{ matrix_docker_mautrix_facebook_src_files_path }}", when: "{{ matrix_mautrix_facebook_enabled }}"} # `docker_network` doesn't work as expected when the given network diff --git a/roles/matrix-mxisd/tasks/setup_mxisd.yml b/roles/matrix-mxisd/tasks/setup_mxisd.yml index 2bafa1791..b01327223 100644 --- a/roles/matrix-mxisd/tasks/setup_mxisd.yml +++ b/roles/matrix-mxisd/tasks/setup_mxisd.yml @@ -22,7 +22,39 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mxisd_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_mxisd_docker_image_force_pull }}" - when: matrix_mxisd_enabled|bool + when: matrix_mxisd_enabled|bool and not matrix_raspberry_pi + +- name: Ensure gradel is installed on Raspberry pi for building + apt: + name: + - gradle + state: present + update_cache: yes + when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" + +- name: Ensure mxisd repository is present on Raspberry pi + git: + repo: https://github.com/kamax-matrix/mxisd.git + dest: "{{ matrix_docker_mxisd_src_files_path }}" + version: "v{{ matrix_mxisd_docker_image.split(':')[1] }}" + force: "yes" + when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" + +# - name: Ensure mxisd Docker image is build (Raspberry pi) +# docker_image: +# name: "{{ matrix_mxisd_docker_image }}" +# source: build +# build: +# dockerfile: Dockerfile +# path: "{{ matrix_docker_mxisd_src_files_path }}" +# pull: yes +# when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" + +- name: Ensure mxisd Docker image is build (Raspberry pi) + shell: "./gradlew dockerBuild" + args: + chdir: "{{ matrix_docker_mxisd_src_files_path }}" + when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" - name: Ensure mxisd config installed copy: From 40d0fea06c62938007d439124f0df7f823de0188 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Fri, 21 Feb 2020 18:27:26 +0100 Subject: [PATCH 08/25] add mautrix-hangouts support for raspberry pi --- roles/matrix-base/defaults/main.yml | 1 + roles/matrix-base/tasks/setup_matrix_base.yml | 1 + .../tasks/setup_install.yml | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index b7e0681a5..f9d88c21e 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -31,6 +31,7 @@ matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synaps matrix_docker_coturn_src_files_path: "{{ matrix_docker_src_files_path }}/coturn" matrix_docker_mxisd_src_files_path: "{{ matrix_docker_src_files_path }}/mxisd" matrix_docker_mautrix_facebook_src_files_path: "{{ matrix_docker_src_files_path }}/mautrix-facebook" +matrix_docker_mautrix_hangouts_src_files_path: "{{ matrix_docker_src_files_path }}/mautrix-hangouts" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index 5823e39fa..b8384dea3 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -27,6 +27,7 @@ - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_enabled }}"} - { src: "{{ matrix_docker_mxisd_src_files_path }}", when: "{{ matrix_mxisd_enabled }}"} - { src: "{{ matrix_docker_mautrix_facebook_src_files_path }}", when: "{{ matrix_mautrix_facebook_enabled }}"} + - { src: "{{ matrix_docker_mautrix_hangouts_src_files_path }}", when: "{{ matrix_mautrix_hangouts_enabled }}"} # `docker_network` doesn't work as expected when the given network # is a substring of a network that already exists. diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index 7f3251656..90206fd67 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -14,6 +14,24 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_hangouts_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_hangouts_docker_image_force_pull }}" + when: matrix_mautrix_hangouts_enabled|bool and not matrix_raspberry_pi + +- name: Ensure Mautrix Hangots repository is present on Raspberry pi + git: + repo: https://github.com/tulir/mautrix-hangouts.git + dest: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" + force: "yes" + when: "matrix_mautrix_hangouts_enabled|bool and matrix_raspberry_pi" + +- name: Ensure Mautrix Hangouts Docker image is build (Raspberry pi) + docker_image: + name: "{{ matrix_mautrix_hangouts_docker_image }}" + source: build + build: + dockerfile: Dockerfile + path: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" + pull: yes + when: "matrix_mautrix_hangouts_enabled|bool and matrix_raspberry_pi" - name: Ensure Mautrix Hangouts paths exist file: From 610c98d6ab5f805f294af00cd79367479c31c86f Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Fri, 21 Feb 2020 18:51:56 +0100 Subject: [PATCH 09/25] add riot-web support for raspberry pi --- roles/matrix-base/defaults/main.yml | 1 + roles/matrix-base/tasks/setup_matrix_base.yml | 1 + .../matrix-riot-web/tasks/setup_riot_web.yml | 20 ++++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index f9d88c21e..a9fd62242 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -28,6 +28,7 @@ matrix_base_data_path_mode: "750" matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" matrix_docker_src_files_path: "{{ matrix_base_data_path }}/docker-src" matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synapse" +matrix_docker_riot_web_src_files_path: "{{ matrix_docker_src_files_path }}/riot-web" matrix_docker_coturn_src_files_path: "{{ matrix_docker_src_files_path }}/coturn" matrix_docker_mxisd_src_files_path: "{{ matrix_docker_src_files_path }}/mxisd" matrix_docker_mautrix_facebook_src_files_path: "{{ matrix_docker_src_files_path }}/mautrix-facebook" diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index b8384dea3..77665f6bb 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -24,6 +24,7 @@ - "{{ matrix_base_data_path }}" - { src: "{{ matrix_docker_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } + - { src: "{{ matrix_docker_riot_web_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_enabled }}"} - { src: "{{ matrix_docker_mxisd_src_files_path }}", when: "{{ matrix_mxisd_enabled }}"} - { src: "{{ matrix_docker_mautrix_facebook_src_files_path }}", when: "{{ matrix_mautrix_facebook_enabled }}"} diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index a3e1048f9..fcaaeeec4 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -19,7 +19,25 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_riot_web_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_riot_web_docker_image_force_pull }}" - when: matrix_riot_web_enabled|bool + when: matrix_riot_web_enabled|bool and not matrix_raspberry_pi + +- name: Ensure Riot Web repository is present on Raspberry pi + git: + repo: https://github.com/vector-im/riot-web.git + dest: "{{ matrix_docker_riot_web_src_files_path }}" + version: "v{{ matrix_riot_web_docker_image.split(':')[1] }}" + force: "yes" + when: "matrix_riot_web_enabled|bool and matrix_raspberry_pi" + +- name: Ensure Riot Web Docker image is build (Raspberry pi) + docker_image: + name: "{{ matrix_riot_web_docker_image }}" + source: build + build: + dockerfile: Dockerfile + path: "{{ matrix_docker_riot_web_src_files_path }}" + pull: yes + when: "matrix_riot_web_enabled|bool and matrix_raspberry_pi" - name: Ensure Matrix riot-web configuration installed copy: From 470b9875e7ac9d25cbb92160d110529232ff66bb Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sun, 23 Feb 2020 19:32:00 +0100 Subject: [PATCH 10/25] Document raspberry pi support --- docs/prerequisites.md | 2 +- docs/raspberry-pi.md | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 docs/raspberry-pi.md diff --git a/docs/prerequisites.md b/docs/prerequisites.md index 7b3df42ff..a8b1e6adb 100644 --- a/docs/prerequisites.md +++ b/docs/prerequisites.md @@ -1,6 +1,6 @@ # Prerequisites -- An x86 server running **CentOS** (7 only for now; [8 is not yet supported](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300)), **Debian** (9/Stretch+) or **Ubuntu** (16.04+). This playbook doesn't support running on ARM so it won't work on a Raspberry Pi. We only strive to support released stable versions of distributions, not betas or pre-releases. This playbook can take over your whole server or co-exist with other services that you have there. +- An x86 server running **CentOS** (7 only for now; [8 is not yet supported](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300)), **Debian** (9/Stretch+) or **Ubuntu** (16.04+). This playbook doesn't support running on ARM ([see](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/299)), however some workarounnd exist for the [Raspberry Pi](raspberry-pi.md). We only strive to support released stable versions of distributions, not betas or pre-releases. This playbook can take over your whole server or co-exist with other services that you have there. - [Python](https://www.python.org/) being installed on the server. Most distributions install Python by default, but some don't (e.g. Ubuntu 18.04) and require manual installation (something like `apt-get install python`). diff --git a/docs/raspberry-pi.md b/docs/raspberry-pi.md new file mode 100644 index 000000000..d5cd0f071 --- /dev/null +++ b/docs/raspberry-pi.md @@ -0,0 +1,17 @@ +# Raspberry Pi + +The playbook support for Raspberry Pi is now in beta(ish). The problem is that, docker containers are not architecture independent, and most of them are not build for arm. Some roles have been updated, so they built the necessary image on the host. It needs more space, as some build tools need to be present (like Java, for mxisd). + +To use these modification there is a variable that needs to be switched to enable this functionality. Add this to your vars.yaml file: +``` +matrix_raspberry_pi = true +``` + +List of roles that builtds the image: +- synapse +- coturn +- mxisd +- matrix-bridge-mautrix-facebook +- matrix-bridge-mautrix-hangouts + +nginx hopefully works as it has an arm image already. From f56825580ded2b0450888e66b2f396cdb115530f Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Mon, 24 Feb 2020 08:59:10 +0100 Subject: [PATCH 11/25] hangouts-bridge no-proxy warning does not trigger when 'matrix_nginx_proxy_enabled = false' is explicitly set --- roles/matrix-bridge-mautrix-hangouts/tasks/init.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml index ee18eeb0e..e4f48afc8 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml @@ -59,4 +59,4 @@ Please make sure that you're proxying the `{{ matrix_mautrix_hangouts_public_endpoint }}` URL endpoint to the matrix-mautrix-hangouts container. You can expose the container's port using the `matrix_mautrix_hangouts_container_http_host_bind_port` variable. - when: "matrix_mautrix_hangouts_enabled|bool and matrix_nginx_proxy_enabled is not defined" + when: "matrix_mautrix_hangouts_enabled|bool and (matrix_nginx_proxy_enabled is not defined or matrix_nginx_proxy_enabled|bool == false)" From 310aa685f94e0c65b960be4f11964f8981c8a77d Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sun, 8 Mar 2020 00:24:00 +0100 Subject: [PATCH 12/25] refactor based on Slavi's requests --- group_vars/matrix_servers | 16 -------- roles/matrix-base/defaults/main.yml | 10 ++--- roles/matrix-base/tasks/server_base/setup.yml | 2 +- roles/matrix-base/tasks/setup_matrix_base.yml | 7 ---- .../defaults/main.yml | 2 + .../tasks/setup_install.yml | 39 ++++++++++--------- .../defaults/main.yml | 2 + .../tasks/setup_install.yml | 39 ++++++++++--------- roles/matrix-coturn/defaults/main.yml | 2 + roles/matrix-coturn/tasks/setup_coturn.yml | 21 +++++++--- roles/matrix-mxisd/defaults/main.yml | 2 + roles/matrix-mxisd/tasks/setup_mxisd.yml | 25 ++++-------- roles/matrix-riot-web/defaults/main.yml | 2 + .../matrix-riot-web/tasks/setup_riot_web.yml | 15 ++++--- roles/matrix-synapse/defaults/main.yml | 2 + roles/matrix-synapse/tasks/setup_synapse.yml | 1 + .../tasks/synapse/setup_install.yml | 10 ++--- 17 files changed, 96 insertions(+), 101 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 51365d74f..5efde0c95 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -678,19 +678,3 @@ matrix_synapse_systemd_wanted_services_list: | # /matrix-synapse # ###################################################################### - - - -###################################################################### -# -# raspberry pi -# -###################################################################### - -matrix_raspberry_pi: "false" - -###################################################################### -# -# /raspberry pi -# -###################################################################### diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index a9fd62242..a58e3bc42 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -26,13 +26,6 @@ matrix_base_data_path: "/matrix" matrix_base_data_path_mode: "750" matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" -matrix_docker_src_files_path: "{{ matrix_base_data_path }}/docker-src" -matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synapse" -matrix_docker_riot_web_src_files_path: "{{ matrix_docker_src_files_path }}/riot-web" -matrix_docker_coturn_src_files_path: "{{ matrix_docker_src_files_path }}/coturn" -matrix_docker_mxisd_src_files_path: "{{ matrix_docker_src_files_path }}/mxisd" -matrix_docker_mautrix_facebook_src_files_path: "{{ matrix_docker_src_files_path }}/mautrix-facebook" -matrix_docker_mautrix_hangouts_src_files_path: "{{ matrix_docker_src_files_path }}/mautrix-hangouts" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" @@ -73,3 +66,6 @@ run_setup: true run_self_check: true run_start: true run_stop: true + +# Raspberry pi depoly TODO: it should be identified based on the operating system +matrix_raspberry_pi_deploy: false \ No newline at end of file diff --git a/roles/matrix-base/tasks/server_base/setup.yml b/roles/matrix-base/tasks/server_base/setup.yml index bd52a0e74..1ce62158f 100644 --- a/roles/matrix-base/tasks/server_base/setup.yml +++ b/roles/matrix-base/tasks/server_base/setup.yml @@ -7,7 +7,7 @@ when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') - include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" - when: "matrix_raspberry_pi" + when: "matrix_raspberry_pi_deploy" - name: Ensure Docker is started and autoruns service: diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index 77665f6bb..b4aa92b9a 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -22,13 +22,6 @@ group: "{{ matrix_user_username }}" with_items: - "{{ matrix_base_data_path }}" - - { src: "{{ matrix_docker_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - - { src: "{{ matrix_docker_riot_web_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } - - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_enabled }}"} - - { src: "{{ matrix_docker_mxisd_src_files_path }}", when: "{{ matrix_mxisd_enabled }}"} - - { src: "{{ matrix_docker_mautrix_facebook_src_files_path }}", when: "{{ matrix_mautrix_facebook_enabled }}"} - - { src: "{{ matrix_docker_mautrix_hangouts_src_files_path }}", when: "{{ matrix_mautrix_hangouts_enabled }}"} # `docker_network` doesn't work as expected when the given network # is a substring of a network that already exists. diff --git a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml index bf57e9260..6503a2754 100644 --- a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml @@ -2,6 +2,7 @@ # See: https://github.com/tulir/mautrix-facebook matrix_mautrix_facebook_enabled: true +matrix_mautrix_facebook_self_build: false # See: https://mau.dev/tulir/mautrix-facebook/container_registry matrix_mautrix_facebook_docker_image: "dock.mau.dev/tulir/mautrix-facebook:latest" @@ -10,6 +11,7 @@ matrix_mautrix_facebook_docker_image_force_pull: "{{ matrix_mautrix_facebook_doc matrix_mautrix_facebook_base_path: "{{ matrix_base_data_path }}/mautrix-facebook" matrix_mautrix_facebook_config_path: "{{ matrix_mautrix_facebook_base_path }}/config" matrix_mautrix_facebook_data_path: "{{ matrix_mautrix_facebook_base_path }}/data" +matrix_docker_mautrix_facebook_src_files_path: "{{ matrix_mautrix_facebook_base_path }}/docker-src" matrix_mautrix_facebook_homeserver_address: 'http://matrix-synapse:8008' matrix_mautrix_facebook_homeserver_domain: '{{ matrix_domain }}' diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index a8c7cdf1a..7b83ae4ea 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -14,25 +14,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_facebook_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_facebook_docker_image_force_pull }}" - when: matrix_mautrix_facebook_enabled|bool and not matrix_raspberry_pi - -- name: Ensure Mautrix Facebook repository is present on Raspberry pi - git: - repo: https://github.com/tulir/mautrix-facebook.git - dest: "{{ matrix_docker_mautrix_facebook_src_files_path }}" -# version: "{{ matrix_coturn_docker_image.split(':')[1] }}" - force: "yes" - when: "matrix_mautrix_facebook_enabled|bool and matrix_raspberry_pi" - -- name: Ensure Mautrix Facebook Docker image is build (Raspberry pi) - docker_image: - name: "{{ matrix_mautrix_facebook_docker_image }}" - source: build - build: - dockerfile: Dockerfile - path: "{{ matrix_docker_mautrix_facebook_src_files_path }}" - pull: yes - when: "matrix_mautrix_facebook_enabled|bool and matrix_raspberry_pi" + when: matrix_mautrix_facebook_enabled|bool and not matrix_mautrix_facebook_self_build - name: Ensure Mautrix Facebook paths exist file: @@ -45,6 +27,25 @@ - "{{ matrix_mautrix_facebook_base_path }}" - "{{ matrix_mautrix_facebook_config_path }}" - "{{ matrix_mautrix_facebook_data_path }}" + - { src: "{{ matrix_docker_mautrix_facebook_src_files_path }}", when: "{{ matrix_mautrix_facebook_self_build }}" } + +- name: Ensure Mautrix Facebook repository is present on self-build + git: + repo: https://github.com/tulir/mautrix-facebook.git + dest: "{{ matrix_docker_mautrix_facebook_src_files_path }}" +# version: "{{ matrix_coturn_docker_image.split(':')[1] }}" + force: "yes" + when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_self_build" + +- name: Ensure Mautrix Facebook Docker image is build + docker_image: + name: "{{ matrix_mautrix_facebook_docker_image }}" + source: build + build: + dockerfile: Dockerfile + path: "{{ matrix_docker_mautrix_facebook_src_files_path }}" + pull: yes + when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_self_build" - name: Check if an old database file already exists stat: diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index fdb2c6390..e136dd1ed 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -2,6 +2,7 @@ # See: https://github.com/tulir/mautrix-hangouts matrix_mautrix_hangouts_enabled: true +matrix_mautrix_hangouts_self_build: true # See: https://mau.dev/tulir/mautrix-hangouts/container_registry matrix_mautrix_hangouts_docker_image: "dock.mau.dev/tulir/mautrix-hangouts:latest" @@ -10,6 +11,7 @@ matrix_mautrix_hangouts_docker_image_force_pull: "{{ matrix_mautrix_hangouts_doc matrix_mautrix_hangouts_base_path: "{{ matrix_base_data_path }}/mautrix-hangouts" matrix_mautrix_hangouts_config_path: "{{ matrix_mautrix_hangouts_base_path }}/config" matrix_mautrix_hangouts_data_path: "{{ matrix_mautrix_hangouts_base_path }}/data" +matrix_docker_mautrix_hangouts_src_files_path: "{{ matrix_mautrix_hangouts_base_path }}/docker-src" matrix_mautrix_hangouts_public_endpoint: '/mautrix-hangouts' diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index 90206fd67..4a5c91038 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -14,24 +14,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_hangouts_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_hangouts_docker_image_force_pull }}" - when: matrix_mautrix_hangouts_enabled|bool and not matrix_raspberry_pi - -- name: Ensure Mautrix Hangots repository is present on Raspberry pi - git: - repo: https://github.com/tulir/mautrix-hangouts.git - dest: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" - force: "yes" - when: "matrix_mautrix_hangouts_enabled|bool and matrix_raspberry_pi" - -- name: Ensure Mautrix Hangouts Docker image is build (Raspberry pi) - docker_image: - name: "{{ matrix_mautrix_hangouts_docker_image }}" - source: build - build: - dockerfile: Dockerfile - path: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" - pull: yes - when: "matrix_mautrix_hangouts_enabled|bool and matrix_raspberry_pi" + when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_self_build - name: Ensure Mautrix Hangouts paths exist file: @@ -44,6 +27,26 @@ - "{{ matrix_mautrix_hangouts_base_path }}" - "{{ matrix_mautrix_hangouts_config_path }}" - "{{ matrix_mautrix_hangouts_data_path }}" + - { src: "{{ matrix_docker_mautrix_hangouts_src_files_path }}", when: "{{ matrix_mautrix_hangouts_self_build }}" } + + when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_self_build + +- name: Ensure Mautrix Hangots repository is present on self build + git: + repo: https://github.com/tulir/mautrix-hangouts.git + dest: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" + force: "yes" + when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_self_build" + +- name: Ensure Mautrix Hangouts Docker image is build + docker_image: + name: "{{ matrix_mautrix_hangouts_docker_image }}" + source: build + build: + dockerfile: Dockerfile + path: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" + pull: yes + when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_self_build" - name: Check if an old database file already exists stat: diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index 4bcbb2231..c6a021845 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -1,4 +1,5 @@ matrix_coturn_enabled: true +matrix_coturn_self_build: false matrix_coturn_docker_image: "instrumentisto/coturn:4.5.1.1" matrix_coturn_docker_image_force_pull: "{{ matrix_coturn_docker_image.endswith(':latest') }}" @@ -13,6 +14,7 @@ matrix_coturn_docker_image_force_pull: "{{ matrix_coturn_docker_image.endswith(' matrix_coturn_docker_network: "matrix-coturn" matrix_coturn_base_path: "{{ matrix_base_data_path }}/coturn" +matrix_docker_coturn_src_files_path: "{{ matrix_coturn_base_path }}/docker-src" matrix_coturn_config_path: "{{ matrix_coturn_base_path }}/turnserver.conf" # List of systemd services that matrix-coturn.service depends on diff --git a/roles/matrix-coturn/tasks/setup_coturn.yml b/roles/matrix-coturn/tasks/setup_coturn.yml index bdd7d774f..9a50859af 100644 --- a/roles/matrix-coturn/tasks/setup_coturn.yml +++ b/roles/matrix-coturn/tasks/setup_coturn.yml @@ -4,23 +4,34 @@ # Tasks related to setting up Coturn # +- name: Ensure Matrix Coturn path exists + file: + path: "{{ item }}" + state: directory + mode: 0750 + owner: "{{ matrix_user_username }}" + group: "{{ matrix_user_username }}" + with_items: + - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_self_build }}"} + when: matrix_riot_web_enabled|bool + - name: Ensure Coturn image is pulled docker_image: name: "{{ matrix_coturn_docker_image }}" source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_coturn_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_coturn_docker_image_force_pull }}" - when: matrix_coturn_enabled|bool and not matrix_raspberry_pi + when: matrix_coturn_enabled|bool and not matrix_coturn_self_build -- name: Ensure Coturn repository is present on Raspberry pi +- name: Ensure Coturn repository is present on self-build git: repo: https://github.com/instrumentisto/coturn-docker-image.git dest: "{{ matrix_docker_coturn_src_files_path }}" version: "{{ matrix_coturn_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_coturn_enabled|bool and matrix_raspberry_pi" + when: "matrix_coturn_enabled|bool and matrix_coturn_self_build" -- name: Ensure Coturn Docker image is build (Raspberry pi) +- name: Ensure Coturn Docker image is build docker_image: name: "{{ matrix_coturn_docker_image }}" source: build @@ -28,7 +39,7 @@ dockerfile: Dockerfile path: "{{ matrix_docker_coturn_src_files_path }}" pull: yes - when: "matrix_coturn_enabled|bool and matrix_raspberry_pi" + when: "matrix_coturn_enabled|bool and matrix_coturn_self_build" - name: Ensure Coturn configuration path exists file: diff --git a/roles/matrix-mxisd/defaults/main.yml b/roles/matrix-mxisd/defaults/main.yml index 286839dab..b9bebb0b4 100644 --- a/roles/matrix-mxisd/defaults/main.yml +++ b/roles/matrix-mxisd/defaults/main.yml @@ -2,11 +2,13 @@ # See: https://github.com/kamax-matrix/mxisd matrix_mxisd_enabled: true +matrix_mxisd_self_build: false matrix_mxisd_docker_image: "kamax/mxisd:1.4.6" matrix_mxisd_docker_image_force_pull: "{{ matrix_mxisd_docker_image.endswith(':latest') }}" matrix_mxisd_base_path: "{{ matrix_base_data_path }}/mxisd" +matrix_docker_mxisd_src_files_path: "{{ matrix_mxisd_base_path }}/docker-src" matrix_mxisd_config_path: "{{ matrix_mxisd_base_path }}/config" matrix_mxisd_data_path: "{{ matrix_mxisd_base_path }}/data" diff --git a/roles/matrix-mxisd/tasks/setup_mxisd.yml b/roles/matrix-mxisd/tasks/setup_mxisd.yml index b01327223..b01abef3a 100644 --- a/roles/matrix-mxisd/tasks/setup_mxisd.yml +++ b/roles/matrix-mxisd/tasks/setup_mxisd.yml @@ -14,6 +14,7 @@ with_items: - "{{ matrix_mxisd_config_path }}" - "{{ matrix_mxisd_data_path }}" + - { src: "{{ matrix_docker_mxisd_src_files_path }}", when: "{{ matrix_mxisd_self_build }}"} when: matrix_mxisd_enabled|bool - name: Ensure mxisd image is pulled @@ -22,39 +23,29 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mxisd_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_mxisd_docker_image_force_pull }}" - when: matrix_mxisd_enabled|bool and not matrix_raspberry_pi + when: matrix_mxisd_enabled|bool and not matrix_mxisd_self_build -- name: Ensure gradel is installed on Raspberry pi for building +- name: Ensure gradel is installed for self-building apt: name: - gradle state: present update_cache: yes - when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" + when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" -- name: Ensure mxisd repository is present on Raspberry pi +- name: Ensure mxisd repository is present on self-build git: repo: https://github.com/kamax-matrix/mxisd.git dest: "{{ matrix_docker_mxisd_src_files_path }}" version: "v{{ matrix_mxisd_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" + when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" -# - name: Ensure mxisd Docker image is build (Raspberry pi) -# docker_image: -# name: "{{ matrix_mxisd_docker_image }}" -# source: build -# build: -# dockerfile: Dockerfile -# path: "{{ matrix_docker_mxisd_src_files_path }}" -# pull: yes -# when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" - -- name: Ensure mxisd Docker image is build (Raspberry pi) +- name: Ensure mxisd Docker image is build shell: "./gradlew dockerBuild" args: chdir: "{{ matrix_docker_mxisd_src_files_path }}" - when: "matrix_mxisd_enabled|bool and matrix_raspberry_pi" + when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" - name: Ensure mxisd config installed copy: diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index e707a61a3..0a37c965b 100644 --- a/roles/matrix-riot-web/defaults/main.yml +++ b/roles/matrix-riot-web/defaults/main.yml @@ -1,9 +1,11 @@ matrix_riot_web_enabled: true +matrix_riot_web_self_build: false matrix_riot_web_docker_image: "vectorim/riot-web:v1.5.12" matrix_riot_web_docker_image_force_pull: "{{ matrix_riot_web_docker_image.endswith(':latest') }}" matrix_riot_web_data_path: "{{ matrix_base_data_path }}/riot-web" +matrix_docker_riot_web_src_files_path: "{{ matrix_riot_web_data_path }}/docker-src" # Controls whether the matrix-riot-web container exposes its HTTP port (tcp/8080 in the container). # diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index fcaaeeec4..ef0ec91d6 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -6,11 +6,14 @@ - name: Ensure Matrix riot-web path exists file: - path: "{{ matrix_riot_web_data_path }}" + path: "{{ item }}" state: directory mode: 0750 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}" + with_items: + - "{{ matrix_riot_web_data_path }}" + - { src: "{{ matrix_docker_riot_web_src_files_path }}", when: "{{ matrix_riot_web_self_build }}" } when: matrix_riot_web_enabled|bool - name: Ensure riot-web Docker image is pulled @@ -19,17 +22,17 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_riot_web_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_riot_web_docker_image_force_pull }}" - when: matrix_riot_web_enabled|bool and not matrix_raspberry_pi + when: matrix_riot_web_enabled|bool and not matrix_riot_web_self_build -- name: Ensure Riot Web repository is present on Raspberry pi +- name: Ensure Riot Web repository is present on self-build git: repo: https://github.com/vector-im/riot-web.git dest: "{{ matrix_docker_riot_web_src_files_path }}" version: "v{{ matrix_riot_web_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_riot_web_enabled|bool and matrix_raspberry_pi" + when: "matrix_riot_web_enabled|bool and matrix_riot_web_self_build" -- name: Ensure Riot Web Docker image is build (Raspberry pi) +- name: Ensure Riot Web Docker image is build docker_image: name: "{{ matrix_riot_web_docker_image }}" source: build @@ -37,7 +40,7 @@ dockerfile: Dockerfile path: "{{ matrix_docker_riot_web_src_files_path }}" pull: yes - when: "matrix_riot_web_enabled|bool and matrix_raspberry_pi" + when: "matrix_riot_web_enabled|bool and matrix_self_build" - name: Ensure Matrix riot-web configuration installed copy: diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index 05ad9126a..309d4396f 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -2,11 +2,13 @@ # See: https://github.com/matrix-org/synapse matrix_synapse_enabled: true +matrix_synapse_self_build: false matrix_synapse_docker_image: "matrixdotorg/synapse:v1.11.1" matrix_synapse_docker_image_force_pull: "{{ matrix_synapse_docker_image.endswith(':latest') }}" matrix_synapse_base_path: "{{ matrix_base_data_path }}/synapse" +matrix_docker_synapse_src_files_path: "{{ matrix_synapse_base_path }}/docker-src" matrix_synapse_config_dir_path: "{{ matrix_synapse_base_path }}/config" matrix_synapse_run_path: "{{ matrix_synapse_base_path }}/run" matrix_synapse_storage_path: "{{ matrix_synapse_base_path }}/storage" diff --git a/roles/matrix-synapse/tasks/setup_synapse.yml b/roles/matrix-synapse/tasks/setup_synapse.yml index b565a4d2d..c5d6beef2 100644 --- a/roles/matrix-synapse/tasks/setup_synapse.yml +++ b/roles/matrix-synapse/tasks/setup_synapse.yml @@ -11,6 +11,7 @@ - "{{ matrix_synapse_config_dir_path }}" - "{{ matrix_synapse_run_path }}" - "{{ matrix_synapse_ext_path }}" + - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_synapse_self_build }}" } # We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml), # because if it's using Goofys and it's already mounted (from before), # trying to chown/chmod it here will cause trouble. diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index 33f04a288..2188b1bdd 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -18,15 +18,15 @@ group: "{{ matrix_user_username }}" when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists" -- name: Ensure Synapse repository is present on Raspberry pi +- name: Ensure Synapse repository is present on self-build git: repo: https://github.com/matrix-org/synapse.git dest: "{{ matrix_docker_synapse_src_files_path }}" version: "{{ matrix_synapse_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_raspberry_pi" + when: "matrix_synapse_self_build" -- name: Ensure Synapse Docker image is build (Raspberry pi) +- name: Ensure Synapse Docker image is build docker_image: name: "{{ matrix_synapse_docker_image }}" source: build @@ -34,7 +34,7 @@ dockerfile: docker/Dockerfile path: "{{ matrix_docker_synapse_src_files_path }}" pull: yes - when: "matrix_raspberry_pi" + when: "matrix_synapse_self_build" - name: Ensure Synapse Docker image is pulled docker_image: @@ -42,7 +42,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_synapse_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_synapse_docker_image_force_pull }}" - when: "not matrix_raspberry_pi" + when: "not matrix_synapse_self_build" - name: Check if a Synapse signing key exists stat: From a5d94eec0b62f02cf31c1537ed1e9bfb0024903c Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sun, 8 Mar 2020 00:28:14 +0100 Subject: [PATCH 13/25] refactor variable names --- roles/matrix-bridge-mautrix-facebook/defaults/main.yml | 2 +- .../matrix-bridge-mautrix-facebook/tasks/setup_install.yml | 6 +++--- roles/matrix-bridge-mautrix-hangouts/defaults/main.yml | 2 +- .../matrix-bridge-mautrix-hangouts/tasks/setup_install.yml | 6 +++--- roles/matrix-coturn/defaults/main.yml | 2 +- roles/matrix-coturn/tasks/setup_coturn.yml | 6 +++--- roles/matrix-mxisd/defaults/main.yml | 2 +- roles/matrix-mxisd/tasks/setup_mxisd.yml | 6 +++--- roles/matrix-riot-web/defaults/main.yml | 2 +- roles/matrix-riot-web/tasks/setup_riot_web.yml | 6 +++--- roles/matrix-synapse/defaults/main.yml | 2 +- roles/matrix-synapse/tasks/setup_synapse.yml | 2 +- roles/matrix-synapse/tasks/synapse/setup_install.yml | 4 ++-- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml index 6503a2754..93a3134b9 100644 --- a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml @@ -11,7 +11,7 @@ matrix_mautrix_facebook_docker_image_force_pull: "{{ matrix_mautrix_facebook_doc matrix_mautrix_facebook_base_path: "{{ matrix_base_data_path }}/mautrix-facebook" matrix_mautrix_facebook_config_path: "{{ matrix_mautrix_facebook_base_path }}/config" matrix_mautrix_facebook_data_path: "{{ matrix_mautrix_facebook_base_path }}/data" -matrix_docker_mautrix_facebook_src_files_path: "{{ matrix_mautrix_facebook_base_path }}/docker-src" +matrix_mautrix_facebook_docker_src_files_path: "{{ matrix_mautrix_facebook_base_path }}/docker-src" matrix_mautrix_facebook_homeserver_address: 'http://matrix-synapse:8008' matrix_mautrix_facebook_homeserver_domain: '{{ matrix_domain }}' diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index 7b83ae4ea..1088f0b43 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -27,12 +27,12 @@ - "{{ matrix_mautrix_facebook_base_path }}" - "{{ matrix_mautrix_facebook_config_path }}" - "{{ matrix_mautrix_facebook_data_path }}" - - { src: "{{ matrix_docker_mautrix_facebook_src_files_path }}", when: "{{ matrix_mautrix_facebook_self_build }}" } + - { src: "{{ matrix_mautrix_facebook_docker_src_files_path }}", when: "{{ matrix_mautrix_facebook_self_build }}" } - name: Ensure Mautrix Facebook repository is present on self-build git: repo: https://github.com/tulir/mautrix-facebook.git - dest: "{{ matrix_docker_mautrix_facebook_src_files_path }}" + dest: "{{ matrix_mautrix_facebook_docker_src_files_path }}" # version: "{{ matrix_coturn_docker_image.split(':')[1] }}" force: "yes" when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_self_build" @@ -43,7 +43,7 @@ source: build build: dockerfile: Dockerfile - path: "{{ matrix_docker_mautrix_facebook_src_files_path }}" + path: "{{ matrix_mautrix_facebook_docker_src_files_path }}" pull: yes when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_self_build" diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index e136dd1ed..0f3b14c5a 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -11,7 +11,7 @@ matrix_mautrix_hangouts_docker_image_force_pull: "{{ matrix_mautrix_hangouts_doc matrix_mautrix_hangouts_base_path: "{{ matrix_base_data_path }}/mautrix-hangouts" matrix_mautrix_hangouts_config_path: "{{ matrix_mautrix_hangouts_base_path }}/config" matrix_mautrix_hangouts_data_path: "{{ matrix_mautrix_hangouts_base_path }}/data" -matrix_docker_mautrix_hangouts_src_files_path: "{{ matrix_mautrix_hangouts_base_path }}/docker-src" +matrix_mautrix_hangouts_docker_src_files_path: "{{ matrix_mautrix_hangouts_base_path }}/docker-src" matrix_mautrix_hangouts_public_endpoint: '/mautrix-hangouts' diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index 4a5c91038..e18778b2d 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -27,14 +27,14 @@ - "{{ matrix_mautrix_hangouts_base_path }}" - "{{ matrix_mautrix_hangouts_config_path }}" - "{{ matrix_mautrix_hangouts_data_path }}" - - { src: "{{ matrix_docker_mautrix_hangouts_src_files_path }}", when: "{{ matrix_mautrix_hangouts_self_build }}" } + - { src: "{{ matrix_mautrix_hangouts_docker_src_files_path }}", when: "{{ matrix_mautrix_hangouts_self_build }}" } when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_self_build - name: Ensure Mautrix Hangots repository is present on self build git: repo: https://github.com/tulir/mautrix-hangouts.git - dest: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" + dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" force: "yes" when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_self_build" @@ -44,7 +44,7 @@ source: build build: dockerfile: Dockerfile - path: "{{ matrix_docker_mautrix_hangouts_src_files_path }}" + path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" pull: yes when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_self_build" diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index c6a021845..a8b71bcbd 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -14,7 +14,7 @@ matrix_coturn_docker_image_force_pull: "{{ matrix_coturn_docker_image.endswith(' matrix_coturn_docker_network: "matrix-coturn" matrix_coturn_base_path: "{{ matrix_base_data_path }}/coturn" -matrix_docker_coturn_src_files_path: "{{ matrix_coturn_base_path }}/docker-src" +matrix_coturn_docker_src_files_path: "{{ matrix_coturn_base_path }}/docker-src" matrix_coturn_config_path: "{{ matrix_coturn_base_path }}/turnserver.conf" # List of systemd services that matrix-coturn.service depends on diff --git a/roles/matrix-coturn/tasks/setup_coturn.yml b/roles/matrix-coturn/tasks/setup_coturn.yml index 9a50859af..ec7a452e5 100644 --- a/roles/matrix-coturn/tasks/setup_coturn.yml +++ b/roles/matrix-coturn/tasks/setup_coturn.yml @@ -12,7 +12,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}" with_items: - - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_self_build }}"} + - { src: "{{ matrix_coturn_docker_src_files_path }}", when: "{{ matrix_coturn_self_build }}"} when: matrix_riot_web_enabled|bool - name: Ensure Coturn image is pulled @@ -26,7 +26,7 @@ - name: Ensure Coturn repository is present on self-build git: repo: https://github.com/instrumentisto/coturn-docker-image.git - dest: "{{ matrix_docker_coturn_src_files_path }}" + dest: "{{ matrix_coturn_docker_src_files_path }}" version: "{{ matrix_coturn_docker_image.split(':')[1] }}" force: "yes" when: "matrix_coturn_enabled|bool and matrix_coturn_self_build" @@ -37,7 +37,7 @@ source: build build: dockerfile: Dockerfile - path: "{{ matrix_docker_coturn_src_files_path }}" + path: "{{ matrix_coturn_docker_src_files_path }}" pull: yes when: "matrix_coturn_enabled|bool and matrix_coturn_self_build" diff --git a/roles/matrix-mxisd/defaults/main.yml b/roles/matrix-mxisd/defaults/main.yml index b9bebb0b4..b3a921bbf 100644 --- a/roles/matrix-mxisd/defaults/main.yml +++ b/roles/matrix-mxisd/defaults/main.yml @@ -8,7 +8,7 @@ matrix_mxisd_docker_image: "kamax/mxisd:1.4.6" matrix_mxisd_docker_image_force_pull: "{{ matrix_mxisd_docker_image.endswith(':latest') }}" matrix_mxisd_base_path: "{{ matrix_base_data_path }}/mxisd" -matrix_docker_mxisd_src_files_path: "{{ matrix_mxisd_base_path }}/docker-src" +matrix_mxisd_docker_src_files_path: "{{ matrix_mxisd_base_path }}/docker-src" matrix_mxisd_config_path: "{{ matrix_mxisd_base_path }}/config" matrix_mxisd_data_path: "{{ matrix_mxisd_base_path }}/data" diff --git a/roles/matrix-mxisd/tasks/setup_mxisd.yml b/roles/matrix-mxisd/tasks/setup_mxisd.yml index b01abef3a..92b7163b9 100644 --- a/roles/matrix-mxisd/tasks/setup_mxisd.yml +++ b/roles/matrix-mxisd/tasks/setup_mxisd.yml @@ -14,7 +14,7 @@ with_items: - "{{ matrix_mxisd_config_path }}" - "{{ matrix_mxisd_data_path }}" - - { src: "{{ matrix_docker_mxisd_src_files_path }}", when: "{{ matrix_mxisd_self_build }}"} + - { src: "{{ matrix_mxisd_docker_src_files_path }}", when: "{{ matrix_mxisd_self_build }}"} when: matrix_mxisd_enabled|bool - name: Ensure mxisd image is pulled @@ -36,7 +36,7 @@ - name: Ensure mxisd repository is present on self-build git: repo: https://github.com/kamax-matrix/mxisd.git - dest: "{{ matrix_docker_mxisd_src_files_path }}" + dest: "{{ matrix_mxisd_docker_src_files_path }}" version: "v{{ matrix_mxisd_docker_image.split(':')[1] }}" force: "yes" when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" @@ -44,7 +44,7 @@ - name: Ensure mxisd Docker image is build shell: "./gradlew dockerBuild" args: - chdir: "{{ matrix_docker_mxisd_src_files_path }}" + chdir: "{{ matrix_mxisd_docker_src_files_path }}" when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" - name: Ensure mxisd config installed diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index 0a37c965b..bdbce0f30 100644 --- a/roles/matrix-riot-web/defaults/main.yml +++ b/roles/matrix-riot-web/defaults/main.yml @@ -5,7 +5,7 @@ matrix_riot_web_docker_image: "vectorim/riot-web:v1.5.12" matrix_riot_web_docker_image_force_pull: "{{ matrix_riot_web_docker_image.endswith(':latest') }}" matrix_riot_web_data_path: "{{ matrix_base_data_path }}/riot-web" -matrix_docker_riot_web_src_files_path: "{{ matrix_riot_web_data_path }}/docker-src" +matrix_riot_web_docker_src_files_path: "{{ matrix_riot_web_data_path }}/docker-src" # Controls whether the matrix-riot-web container exposes its HTTP port (tcp/8080 in the container). # diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index ef0ec91d6..9161c8177 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -13,7 +13,7 @@ group: "{{ matrix_user_username }}" with_items: - "{{ matrix_riot_web_data_path }}" - - { src: "{{ matrix_docker_riot_web_src_files_path }}", when: "{{ matrix_riot_web_self_build }}" } + - { src: "{{ matrix_riot_web_docker_src_files_path }}", when: "{{ matrix_riot_web_self_build }}" } when: matrix_riot_web_enabled|bool - name: Ensure riot-web Docker image is pulled @@ -27,7 +27,7 @@ - name: Ensure Riot Web repository is present on self-build git: repo: https://github.com/vector-im/riot-web.git - dest: "{{ matrix_docker_riot_web_src_files_path }}" + dest: "{{ matrix_riot_web_docker_src_files_path }}" version: "v{{ matrix_riot_web_docker_image.split(':')[1] }}" force: "yes" when: "matrix_riot_web_enabled|bool and matrix_riot_web_self_build" @@ -38,7 +38,7 @@ source: build build: dockerfile: Dockerfile - path: "{{ matrix_docker_riot_web_src_files_path }}" + path: "{{ matrix_riot_web_docker_src_files_path }}" pull: yes when: "matrix_riot_web_enabled|bool and matrix_self_build" diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index 309d4396f..1f0d49d81 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -8,7 +8,7 @@ matrix_synapse_docker_image: "matrixdotorg/synapse:v1.11.1" matrix_synapse_docker_image_force_pull: "{{ matrix_synapse_docker_image.endswith(':latest') }}" matrix_synapse_base_path: "{{ matrix_base_data_path }}/synapse" -matrix_docker_synapse_src_files_path: "{{ matrix_synapse_base_path }}/docker-src" +matrix_synapse_docker_src_files_path: "{{ matrix_synapse_base_path }}/docker-src" matrix_synapse_config_dir_path: "{{ matrix_synapse_base_path }}/config" matrix_synapse_run_path: "{{ matrix_synapse_base_path }}/run" matrix_synapse_storage_path: "{{ matrix_synapse_base_path }}/storage" diff --git a/roles/matrix-synapse/tasks/setup_synapse.yml b/roles/matrix-synapse/tasks/setup_synapse.yml index c5d6beef2..0ce851c7e 100644 --- a/roles/matrix-synapse/tasks/setup_synapse.yml +++ b/roles/matrix-synapse/tasks/setup_synapse.yml @@ -11,7 +11,7 @@ - "{{ matrix_synapse_config_dir_path }}" - "{{ matrix_synapse_run_path }}" - "{{ matrix_synapse_ext_path }}" - - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_synapse_self_build }}" } + - { src: "{{ matrix_synapse_docker_src_files_path }}", when: "{{ matrix_synapse_self_build }}" } # We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml), # because if it's using Goofys and it's already mounted (from before), # trying to chown/chmod it here will cause trouble. diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index 2188b1bdd..481429a40 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -21,7 +21,7 @@ - name: Ensure Synapse repository is present on self-build git: repo: https://github.com/matrix-org/synapse.git - dest: "{{ matrix_docker_synapse_src_files_path }}" + dest: "{{ matrix_synapse_docker_src_files_path }}" version: "{{ matrix_synapse_docker_image.split(':')[1] }}" force: "yes" when: "matrix_synapse_self_build" @@ -32,7 +32,7 @@ source: build build: dockerfile: docker/Dockerfile - path: "{{ matrix_docker_synapse_src_files_path }}" + path: "{{ matrix_synapse_docker_src_files_path }}" pull: yes when: "matrix_synapse_self_build" From 6232a81caf2d9c72394306ea6f2c6d638770b6f2 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sun, 8 Mar 2020 19:04:41 +0100 Subject: [PATCH 14/25] check if target distro is Raspbian and install docker accordingly --- roles/matrix-base/defaults/main.yml | 3 --- roles/matrix-base/tasks/server_base/setup.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index a58e3bc42..b4fef1dd7 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -66,6 +66,3 @@ run_setup: true run_self_check: true run_start: true run_stop: true - -# Raspberry pi depoly TODO: it should be identified based on the operating system -matrix_raspberry_pi_deploy: false \ No newline at end of file diff --git a/roles/matrix-base/tasks/server_base/setup.yml b/roles/matrix-base/tasks/server_base/setup.yml index 1ce62158f..70b2e4fcc 100644 --- a/roles/matrix-base/tasks/server_base/setup.yml +++ b/roles/matrix-base/tasks/server_base/setup.yml @@ -7,7 +7,7 @@ when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') - include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" - when: "matrix_raspberry_pi_deploy" + when: (ansible_os_family == 'Debian') and (ansible_lsb.id == 'Raspbian') - name: Ensure Docker is started and autoruns service: From 3c8535c3bce0a99badd0c6efa858686445448a2a Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sun, 8 Mar 2020 19:17:10 +0100 Subject: [PATCH 15/25] check ansible version for self-building in every role --- roles/matrix-base/tasks/sanity_check.yml | 7 ------- roles/matrix-bridge-mautrix-facebook/tasks/init.yml | 7 +++++++ roles/matrix-bridge-mautrix-hangouts/tasks/init.yml | 7 +++++++ roles/matrix-coturn/tasks/init.yml | 7 +++++++ roles/matrix-mxisd/tasks/init.yml | 7 +++++++ roles/matrix-riot-web/tasks/init.yml | 7 +++++++ roles/matrix-synapse/tasks/init.yml | 7 +++++++ 7 files changed, 42 insertions(+), 7 deletions(-) diff --git a/roles/matrix-base/tasks/sanity_check.yml b/roles/matrix-base/tasks/sanity_check.yml index a0a92a227..b2d8c249e 100644 --- a/roles/matrix-base/tasks/sanity_check.yml +++ b/roles/matrix-base/tasks/sanity_check.yml @@ -44,10 +44,3 @@ - "{{ matrix_server_fqn_matrix }}" - "{{ matrix_server_fqn_riot }}" when: "item != item|lower" - -# ansible lower than 2.8, does not support docker_image build parameters -# for Raspberry pi it is explicitly needed, so we rather fail here -- name: Fail if running on Ansible lower than 2.8 and targeting Raspberry pi - fail: - msg: "To target Raspberry pi, you should usa ansible 2.8 or higher. E.g. pip contains such packages." - when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_raspberry_pi" diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml index 92f978672..85bb3838d 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml @@ -14,3 +14,10 @@ + {{ ["/matrix-mautrix-facebook-registration.yaml"] }} when: matrix_mautrix_facebook_enabled|bool + +# ansible lower than 2.8, does not support docker_image build parameters +# for self buildig it is explicitly needed, so we rather fail here +- name: Fail if running on Ansible lower than 2.8 and trying self building + fail: + msg: "To self build Mautrix Facebook image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_facebook_self_build" \ No newline at end of file diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml index e4f48afc8..b276a1f65 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml @@ -60,3 +60,10 @@ URL endpoint to the matrix-mautrix-hangouts container. You can expose the container's port using the `matrix_mautrix_hangouts_container_http_host_bind_port` variable. when: "matrix_mautrix_hangouts_enabled|bool and (matrix_nginx_proxy_enabled is not defined or matrix_nginx_proxy_enabled|bool == false)" + +# ansible lower than 2.8, does not support docker_image build parameters +# for self buildig it is explicitly needed, so we rather fail here +- name: Fail if running on Ansible lower than 2.8 and trying self building + fail: + msg: "To self build Mautrix Hangouts image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_hangouts_self_build" diff --git a/roles/matrix-coturn/tasks/init.yml b/roles/matrix-coturn/tasks/init.yml index 603b536ab..9b97ce6a0 100644 --- a/roles/matrix-coturn/tasks/init.yml +++ b/roles/matrix-coturn/tasks/init.yml @@ -1,3 +1,10 @@ - set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-coturn'] }}" when: matrix_coturn_enabled|bool + +# ansible lower than 2.8, does not support docker_image build parameters +# for self buildig it is explicitly needed, so we rather fail here +- name: Fail if running on Ansible lower than 2.8 and trying self building + fail: + msg: "To self build Coturn image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_coturn_self_build" diff --git a/roles/matrix-mxisd/tasks/init.yml b/roles/matrix-mxisd/tasks/init.yml index 94543b355..dcae446e2 100644 --- a/roles/matrix-mxisd/tasks/init.yml +++ b/roles/matrix-mxisd/tasks/init.yml @@ -1,3 +1,10 @@ - set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mxisd'] }}" when: matrix_mxisd_enabled|bool + +# ansible lower than 2.8, does not support docker_image build parameters +# for self buildig it is explicitly needed, so we rather fail here +- name: Fail if running on Ansible lower than 2.8 and trying self building + fail: + msg: "To self build Mxisd image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mxisd_self_build" diff --git a/roles/matrix-riot-web/tasks/init.yml b/roles/matrix-riot-web/tasks/init.yml index 52c096eea..4fc4e6580 100644 --- a/roles/matrix-riot-web/tasks/init.yml +++ b/roles/matrix-riot-web/tasks/init.yml @@ -1,3 +1,10 @@ - set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-riot-web'] }}" when: matrix_riot_web_enabled|bool + +# ansible lower than 2.8, does not support docker_image build parameters +# for self buildig it is explicitly needed, so we rather fail here +- name: Fail if running on Ansible lower than 2.8 and trying self building + fail: + msg: "To self build Riot Web image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_riot_web_self_build" diff --git a/roles/matrix-synapse/tasks/init.yml b/roles/matrix-synapse/tasks/init.yml index d5f648623..b91c42cb1 100644 --- a/roles/matrix-synapse/tasks/init.yml +++ b/roles/matrix-synapse/tasks/init.yml @@ -5,3 +5,10 @@ - set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-goofys'] }}" when: matrix_s3_media_store_enabled|bool + +# ansible lower than 2.8, does not support docker_image build parameters +# for self buildig it is explicitly needed, so we rather fail here +- name: Fail if running on Ansible lower than 2.8 and trying self building + fail: + msg: "To self build Synapse image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_synapse_self_build" From a164fe485e03a36065cdf7809f67631ba6c20f8e Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sat, 14 Mar 2020 19:14:39 +0100 Subject: [PATCH 16/25] fix wrong variable name --- roles/matrix-riot-web/tasks/setup_riot_web.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index 9161c8177..2216a0ffa 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -40,7 +40,7 @@ dockerfile: Dockerfile path: "{{ matrix_riot_web_docker_src_files_path }}" pull: yes - when: "matrix_riot_web_enabled|bool and matrix_self_build" + when: "matrix_riot_web_enabled|bool and matrix_riot_web_self_build" - name: Ensure Matrix riot-web configuration installed copy: From 2d537484d5c40d6ec93dbe2a12d1edc806f79b89 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sat, 14 Mar 2020 19:16:29 +0100 Subject: [PATCH 17/25] introduce variable --- roles/matrix-base/defaults/main.yml | 4 ++++ roles/matrix-bridge-mautrix-hangouts/defaults/main.yml | 2 +- roles/matrix-coturn/defaults/main.yml | 2 +- roles/matrix-mxisd/defaults/main.yml | 2 +- roles/matrix-riot-web/defaults/main.yml | 2 +- roles/matrix-synapse/defaults/main.yml | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index b4fef1dd7..c2a81c294 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -66,3 +66,7 @@ run_setup: true run_self_check: true run_start: true run_stop: true + +# Building every docker image from source on the target host +# Controlling docker image build is possible on a per unit base +matrix_container_images_self_build: false \ No newline at end of file diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index 0f3b14c5a..89eea3525 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -2,7 +2,7 @@ # See: https://github.com/tulir/mautrix-hangouts matrix_mautrix_hangouts_enabled: true -matrix_mautrix_hangouts_self_build: true +matrix_mautrix_hangouts_self_build: "{{ matrix_container_images_self_build }}" # See: https://mau.dev/tulir/mautrix-hangouts/container_registry matrix_mautrix_hangouts_docker_image: "dock.mau.dev/tulir/mautrix-hangouts:latest" diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index a8b71bcbd..214401b85 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -1,5 +1,5 @@ matrix_coturn_enabled: true -matrix_coturn_self_build: false +matrix_coturn_self_build: "{{ matrix_container_images_self_build }}" matrix_coturn_docker_image: "instrumentisto/coturn:4.5.1.1" matrix_coturn_docker_image_force_pull: "{{ matrix_coturn_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-mxisd/defaults/main.yml b/roles/matrix-mxisd/defaults/main.yml index b3a921bbf..e882bc13a 100644 --- a/roles/matrix-mxisd/defaults/main.yml +++ b/roles/matrix-mxisd/defaults/main.yml @@ -2,7 +2,7 @@ # See: https://github.com/kamax-matrix/mxisd matrix_mxisd_enabled: true -matrix_mxisd_self_build: false +matrix_mxisd_self_build: "{{ matrix_container_images_self_build }}" matrix_mxisd_docker_image: "kamax/mxisd:1.4.6" matrix_mxisd_docker_image_force_pull: "{{ matrix_mxisd_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index bdbce0f30..efccdf21a 100644 --- a/roles/matrix-riot-web/defaults/main.yml +++ b/roles/matrix-riot-web/defaults/main.yml @@ -1,5 +1,5 @@ matrix_riot_web_enabled: true -matrix_riot_web_self_build: false +matrix_riot_web_self_build: "{{ matrix_container_images_self_build }}" matrix_riot_web_docker_image: "vectorim/riot-web:v1.5.12" matrix_riot_web_docker_image_force_pull: "{{ matrix_riot_web_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index 1f0d49d81..1a992a978 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -2,7 +2,7 @@ # See: https://github.com/matrix-org/synapse matrix_synapse_enabled: true -matrix_synapse_self_build: false +matrix_synapse_self_build: "{{ matrix_container_images_self_build }}" matrix_synapse_docker_image: "matrixdotorg/synapse:v1.11.1" matrix_synapse_docker_image_force_pull: "{{ matrix_synapse_docker_image.endswith(':latest') }}" From 976f1a4582069abcf99d2f535a5379551d6048c2 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sat, 14 Mar 2020 19:54:13 +0100 Subject: [PATCH 18/25] fix riot-web version strip --- roles/matrix-riot-web/tasks/setup_riot_web.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index 2216a0ffa..2dac85cfa 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -28,7 +28,7 @@ git: repo: https://github.com/vector-im/riot-web.git dest: "{{ matrix_riot_web_docker_src_files_path }}" - version: "v{{ matrix_riot_web_docker_image.split(':')[1] }}" + version: "{{ matrix_riot_web_docker_image.split(':')[1] }}" force: "yes" when: "matrix_riot_web_enabled|bool and matrix_riot_web_self_build" From 30fd1ab2d658ccfd6f02df917727fdda47b755f1 Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sat, 14 Mar 2020 20:40:31 +0100 Subject: [PATCH 19/25] add forgotten support for variable for matrix-bridge-mautrix-facebook role --- roles/matrix-bridge-mautrix-facebook/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml index 93a3134b9..9acf22281 100644 --- a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml @@ -2,7 +2,7 @@ # See: https://github.com/tulir/mautrix-facebook matrix_mautrix_facebook_enabled: true -matrix_mautrix_facebook_self_build: false +matrix_mautrix_facebook_self_build: "{{ matrix_container_images_self_build }}" # See: https://mau.dev/tulir/mautrix-facebook/container_registry matrix_mautrix_facebook_docker_image: "dock.mau.dev/tulir/mautrix-facebook:latest" From 447dd94ff97d89549179b6d14ce09d20e69eb20f Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Sat, 14 Mar 2020 20:41:01 +0100 Subject: [PATCH 20/25] update documentation --- docs/prerequisites.md | 2 +- docs/raspberry-pi.md | 17 ----------------- docs/self-build.md | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 docs/raspberry-pi.md create mode 100644 docs/self-build.md diff --git a/docs/prerequisites.md b/docs/prerequisites.md index a8b1e6adb..4e72e2ead 100644 --- a/docs/prerequisites.md +++ b/docs/prerequisites.md @@ -1,6 +1,6 @@ # Prerequisites -- An x86 server running **CentOS** (7 only for now; [8 is not yet supported](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300)), **Debian** (9/Stretch+) or **Ubuntu** (16.04+). This playbook doesn't support running on ARM ([see](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/299)), however some workarounnd exist for the [Raspberry Pi](raspberry-pi.md). We only strive to support released stable versions of distributions, not betas or pre-releases. This playbook can take over your whole server or co-exist with other services that you have there. +- An x86 server running **CentOS** (7 only for now; [8 is not yet supported](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/300)), **Debian** (9/Stretch+) or **Ubuntu** (16.04+). This playbook doesn't support running on ARM ([see](https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/299)), however a minimal subset of the tools can be built on the host, which may result in a working configuration, even on a Raspberry pi (see [Self-Building](self-building.md)). We only strive to support released stable versions of distributions, not betas or pre-releases. This playbook can take over your whole server or co-exist with other services that you have there. - [Python](https://www.python.org/) being installed on the server. Most distributions install Python by default, but some don't (e.g. Ubuntu 18.04) and require manual installation (something like `apt-get install python`). diff --git a/docs/raspberry-pi.md b/docs/raspberry-pi.md deleted file mode 100644 index d5cd0f071..000000000 --- a/docs/raspberry-pi.md +++ /dev/null @@ -1,17 +0,0 @@ -# Raspberry Pi - -The playbook support for Raspberry Pi is now in beta(ish). The problem is that, docker containers are not architecture independent, and most of them are not build for arm. Some roles have been updated, so they built the necessary image on the host. It needs more space, as some build tools need to be present (like Java, for mxisd). - -To use these modification there is a variable that needs to be switched to enable this functionality. Add this to your vars.yaml file: -``` -matrix_raspberry_pi = true -``` - -List of roles that builtds the image: -- synapse -- coturn -- mxisd -- matrix-bridge-mautrix-facebook -- matrix-bridge-mautrix-hangouts - -nginx hopefully works as it has an arm image already. diff --git a/docs/self-build.md b/docs/self-build.md new file mode 100644 index 000000000..b95f60a9b --- /dev/null +++ b/docs/self-build.md @@ -0,0 +1,17 @@ +# Self building + +The playbook supports the self building of a couple of components. This may be useful for architectures beside x86_64 that have no docker images right now (e g. the armv7 for the Raspberry Pi). Some roles have been updated, so they build the necessary image on the host. It needs more space, as some build tools need to be present (like Java, for mxisd). + +To use these modification there is a variable that needs to be switched to enable this functionality. Add this to your vars.yaml file: +``` +matrix_container_images_self_build = true +``` +Setting that variable will self-build every role where applicable. Self-building can be set on a per-role basis as well. + +List of roles where self-building the docker image is currently possible: +- synapse +- riot-web +- coturn +- mxisd +- matrix-bridge-mautrix-facebook +- matrix-bridge-mautrix-hangouts From 8fe97abe7db32d06b72a7edc0b62de991e3e3331 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 15 Mar 2020 10:10:41 +0200 Subject: [PATCH 21/25] Wire matrix_container_images_self_build to self_build variables via group_vars/matrix_servers This keeps the roles cleaner and more independent of matrix-base, which may be important for people building their own playbook out of the individual roles and not using the matrix-base role. --- group_vars/matrix_servers | 12 ++++++++++++ .../matrix-bridge-mautrix-facebook/defaults/main.yml | 3 ++- .../matrix-bridge-mautrix-hangouts/defaults/main.yml | 3 ++- roles/matrix-coturn/defaults/main.yml | 3 ++- roles/matrix-mxisd/defaults/main.yml | 3 ++- roles/matrix-riot-web/defaults/main.yml | 3 ++- roles/matrix-synapse/defaults/main.yml | 3 ++- 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 5efde0c95..601b05ff2 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -172,6 +172,8 @@ matrix_appservice_irc_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | # We don't enable bridges by default. matrix_mautrix_facebook_enabled: false +matrix_mautrix_facebook_self_build: "{{ matrix_container_images_self_build }}" + matrix_mautrix_facebook_systemd_required_services_list: | {{ ['docker.service'] @@ -201,6 +203,8 @@ matrix_mautrix_facebook_login_shared_secret: "{{ matrix_synapse_ext_password_pro # We don't enable bridges by default. matrix_mautrix_hangouts_enabled: false +matrix_mautrix_hangouts_self_build: "{{ matrix_container_images_self_build }}" + matrix_mautrix_hangouts_systemd_required_services_list: | {{ ['docker.service'] @@ -329,6 +333,8 @@ matrix_corporal_matrix_registration_shared_secret: "{{ matrix_synapse_registrati matrix_coturn_enabled: true +matrix_coturn_self_build: "{{ matrix_container_images_self_build }}" + matrix_coturn_turn_external_ip_address: "{{ ansible_host }}" matrix_coturn_tls_enabled: true @@ -415,6 +421,8 @@ matrix_mailer_enabled: true # If you wish to use the public identity servers (matrix.org, vector.im) instead of your own you may wish to disable this. matrix_mxisd_enabled: true +matrix_mxisd_self_build: "{{ matrix_container_images_self_build }}" + # Normally, matrix-nginx-proxy is enabled and nginx can reach mxisd over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose # mxisd's web-server port. @@ -559,6 +567,8 @@ matrix_postgres_db_name: "homeserver" # If you wish to connect to your Matrix server by other means, you may wish to disable this. matrix_riot_web_enabled: true +matrix_riot_web_self_build: "{{ matrix_container_images_self_build }}" + # Normally, matrix-nginx-proxy is enabled and nginx can reach riot-web over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose # the riot-web HTTP port to the local host. @@ -600,6 +610,8 @@ matrix_riot_web_welcome_user_id: ~ # ###################################################################### +matrix_synapse_self_build: "{{ matrix_container_images_self_build }}" + # When mxisd is enabled, we can use it instead of the default public Identity servers. matrix_synapse_trusted_third_party_id_servers: "{{ [matrix_server_fqn_matrix] if matrix_mxisd_enabled else matrix_synapse_id_servers_public }}" diff --git a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml index 9acf22281..cd1770d42 100644 --- a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml @@ -2,7 +2,8 @@ # See: https://github.com/tulir/mautrix-facebook matrix_mautrix_facebook_enabled: true -matrix_mautrix_facebook_self_build: "{{ matrix_container_images_self_build }}" + +matrix_mautrix_facebook_self_build: false # See: https://mau.dev/tulir/mautrix-facebook/container_registry matrix_mautrix_facebook_docker_image: "dock.mau.dev/tulir/mautrix-facebook:latest" diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index 89eea3525..de31d83e3 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -2,7 +2,8 @@ # See: https://github.com/tulir/mautrix-hangouts matrix_mautrix_hangouts_enabled: true -matrix_mautrix_hangouts_self_build: "{{ matrix_container_images_self_build }}" + +matrix_mautrix_hangouts_self_build: false # See: https://mau.dev/tulir/mautrix-hangouts/container_registry matrix_mautrix_hangouts_docker_image: "dock.mau.dev/tulir/mautrix-hangouts:latest" diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index 214401b85..cbcc135ea 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -1,5 +1,6 @@ matrix_coturn_enabled: true -matrix_coturn_self_build: "{{ matrix_container_images_self_build }}" + +matrix_coturn_self_build: false matrix_coturn_docker_image: "instrumentisto/coturn:4.5.1.1" matrix_coturn_docker_image_force_pull: "{{ matrix_coturn_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-mxisd/defaults/main.yml b/roles/matrix-mxisd/defaults/main.yml index e882bc13a..b291c5ce5 100644 --- a/roles/matrix-mxisd/defaults/main.yml +++ b/roles/matrix-mxisd/defaults/main.yml @@ -2,7 +2,8 @@ # See: https://github.com/kamax-matrix/mxisd matrix_mxisd_enabled: true -matrix_mxisd_self_build: "{{ matrix_container_images_self_build }}" + +matrix_mxisd_self_build: false matrix_mxisd_docker_image: "kamax/mxisd:1.4.6" matrix_mxisd_docker_image_force_pull: "{{ matrix_mxisd_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index efccdf21a..cafe4ceb9 100644 --- a/roles/matrix-riot-web/defaults/main.yml +++ b/roles/matrix-riot-web/defaults/main.yml @@ -1,5 +1,6 @@ matrix_riot_web_enabled: true -matrix_riot_web_self_build: "{{ matrix_container_images_self_build }}" + +matrix_riot_web_self_build: false matrix_riot_web_docker_image: "vectorim/riot-web:v1.5.12" matrix_riot_web_docker_image_force_pull: "{{ matrix_riot_web_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index 1a992a978..f3e6d4fe8 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -2,7 +2,8 @@ # See: https://github.com/matrix-org/synapse matrix_synapse_enabled: true -matrix_synapse_self_build: "{{ matrix_container_images_self_build }}" + +matrix_synapse_self_build: false matrix_synapse_docker_image: "matrixdotorg/synapse:v1.11.1" matrix_synapse_docker_image_force_pull: "{{ matrix_synapse_docker_image.endswith(':latest') }}" From 2b85fde103f0a80223fdf6708225979e5818431d Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 15 Mar 2020 10:15:27 +0200 Subject: [PATCH 22/25] Rename some variables for consistency --- group_vars/matrix_servers | 12 ++++++------ .../matrix-bridge-mautrix-facebook/defaults/main.yml | 2 +- roles/matrix-bridge-mautrix-facebook/tasks/init.yml | 2 +- .../tasks/setup_install.yml | 8 ++++---- .../matrix-bridge-mautrix-hangouts/defaults/main.yml | 2 +- roles/matrix-bridge-mautrix-hangouts/tasks/init.yml | 2 +- .../tasks/setup_install.yml | 10 +++++----- roles/matrix-coturn/defaults/main.yml | 2 +- roles/matrix-coturn/tasks/init.yml | 2 +- roles/matrix-coturn/tasks/setup_coturn.yml | 8 ++++---- roles/matrix-mxisd/defaults/main.yml | 2 +- roles/matrix-mxisd/tasks/init.yml | 2 +- roles/matrix-mxisd/tasks/setup_mxisd.yml | 10 +++++----- roles/matrix-riot-web/defaults/main.yml | 2 +- roles/matrix-riot-web/tasks/init.yml | 2 +- roles/matrix-riot-web/tasks/setup_riot_web.yml | 8 ++++---- roles/matrix-synapse/defaults/main.yml | 2 +- roles/matrix-synapse/tasks/init.yml | 2 +- roles/matrix-synapse/tasks/setup_synapse.yml | 2 +- roles/matrix-synapse/tasks/synapse/setup_install.yml | 6 +++--- 20 files changed, 44 insertions(+), 44 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 601b05ff2..f722e2659 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -172,7 +172,7 @@ matrix_appservice_irc_homeserver_token: "{{ matrix_synapse_macaroon_secret_key | # We don't enable bridges by default. matrix_mautrix_facebook_enabled: false -matrix_mautrix_facebook_self_build: "{{ matrix_container_images_self_build }}" +matrix_mautrix_facebook_container_image_self_build: "{{ matrix_container_images_self_build }}" matrix_mautrix_facebook_systemd_required_services_list: | {{ @@ -203,7 +203,7 @@ matrix_mautrix_facebook_login_shared_secret: "{{ matrix_synapse_ext_password_pro # We don't enable bridges by default. matrix_mautrix_hangouts_enabled: false -matrix_mautrix_hangouts_self_build: "{{ matrix_container_images_self_build }}" +matrix_mautrix_hangouts_container_image_self_build: "{{ matrix_container_images_self_build }}" matrix_mautrix_hangouts_systemd_required_services_list: | {{ @@ -333,7 +333,7 @@ matrix_corporal_matrix_registration_shared_secret: "{{ matrix_synapse_registrati matrix_coturn_enabled: true -matrix_coturn_self_build: "{{ matrix_container_images_self_build }}" +matrix_coturn_container_image_self_build: "{{ matrix_container_images_self_build }}" matrix_coturn_turn_external_ip_address: "{{ ansible_host }}" @@ -421,7 +421,7 @@ matrix_mailer_enabled: true # If you wish to use the public identity servers (matrix.org, vector.im) instead of your own you may wish to disable this. matrix_mxisd_enabled: true -matrix_mxisd_self_build: "{{ matrix_container_images_self_build }}" +matrix_mxisd_container_image_self_build: "{{ matrix_container_images_self_build }}" # Normally, matrix-nginx-proxy is enabled and nginx can reach mxisd over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose @@ -567,7 +567,7 @@ matrix_postgres_db_name: "homeserver" # If you wish to connect to your Matrix server by other means, you may wish to disable this. matrix_riot_web_enabled: true -matrix_riot_web_self_build: "{{ matrix_container_images_self_build }}" +matrix_riot_web_container_image_self_build: "{{ matrix_container_images_self_build }}" # Normally, matrix-nginx-proxy is enabled and nginx can reach riot-web over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose @@ -610,7 +610,7 @@ matrix_riot_web_welcome_user_id: ~ # ###################################################################### -matrix_synapse_self_build: "{{ matrix_container_images_self_build }}" +matrix_synapse_container_image_self_build: "{{ matrix_container_images_self_build }}" # When mxisd is enabled, we can use it instead of the default public Identity servers. matrix_synapse_trusted_third_party_id_servers: "{{ [matrix_server_fqn_matrix] if matrix_mxisd_enabled else matrix_synapse_id_servers_public }}" diff --git a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml index cd1770d42..30693bd58 100644 --- a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml @@ -3,7 +3,7 @@ matrix_mautrix_facebook_enabled: true -matrix_mautrix_facebook_self_build: false +matrix_mautrix_facebook_container_image_self_build: false # See: https://mau.dev/tulir/mautrix-facebook/container_registry matrix_mautrix_facebook_docker_image: "dock.mau.dev/tulir/mautrix-facebook:latest" diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml index 85bb3838d..c9688cf04 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml @@ -20,4 +20,4 @@ - name: Fail if running on Ansible lower than 2.8 and trying self building fail: msg: "To self build Mautrix Facebook image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." - when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_facebook_self_build" \ No newline at end of file + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_facebook_container_image_self_build" diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index 1088f0b43..c21ba216c 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -14,7 +14,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_facebook_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_facebook_docker_image_force_pull }}" - when: matrix_mautrix_facebook_enabled|bool and not matrix_mautrix_facebook_self_build + when: matrix_mautrix_facebook_enabled|bool and not matrix_mautrix_facebook_container_image_self_build - name: Ensure Mautrix Facebook paths exist file: @@ -27,7 +27,7 @@ - "{{ matrix_mautrix_facebook_base_path }}" - "{{ matrix_mautrix_facebook_config_path }}" - "{{ matrix_mautrix_facebook_data_path }}" - - { src: "{{ matrix_mautrix_facebook_docker_src_files_path }}", when: "{{ matrix_mautrix_facebook_self_build }}" } + - { src: "{{ matrix_mautrix_facebook_docker_src_files_path }}", when: "{{ matrix_mautrix_facebook_container_image_self_build }}" } - name: Ensure Mautrix Facebook repository is present on self-build git: @@ -35,7 +35,7 @@ dest: "{{ matrix_mautrix_facebook_docker_src_files_path }}" # version: "{{ matrix_coturn_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_self_build" + when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_container_image_self_build" - name: Ensure Mautrix Facebook Docker image is build docker_image: @@ -45,7 +45,7 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_facebook_docker_src_files_path }}" pull: yes - when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_self_build" + when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_container_image_self_build" - name: Check if an old database file already exists stat: diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index de31d83e3..5284bc822 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -3,7 +3,7 @@ matrix_mautrix_hangouts_enabled: true -matrix_mautrix_hangouts_self_build: false +matrix_mautrix_hangouts_container_image_self_build: false # See: https://mau.dev/tulir/mautrix-hangouts/container_registry matrix_mautrix_hangouts_docker_image: "dock.mau.dev/tulir/mautrix-hangouts:latest" diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml index b276a1f65..9dd09d819 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml @@ -66,4 +66,4 @@ - name: Fail if running on Ansible lower than 2.8 and trying self building fail: msg: "To self build Mautrix Hangouts image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." - when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_hangouts_self_build" + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_hangouts_container_image_self_build" diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index e18778b2d..beed38a7b 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -14,7 +14,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_hangouts_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_hangouts_docker_image_force_pull }}" - when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_self_build + when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_container_image_self_build - name: Ensure Mautrix Hangouts paths exist file: @@ -27,16 +27,16 @@ - "{{ matrix_mautrix_hangouts_base_path }}" - "{{ matrix_mautrix_hangouts_config_path }}" - "{{ matrix_mautrix_hangouts_data_path }}" - - { src: "{{ matrix_mautrix_hangouts_docker_src_files_path }}", when: "{{ matrix_mautrix_hangouts_self_build }}" } + - { src: "{{ matrix_mautrix_hangouts_docker_src_files_path }}", when: "{{ matrix_mautrix_hangouts_container_image_self_build }}" } - when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_self_build + when: matrix_mautrix_hangouts_enabled|bool and not matrix_mautrix_hangouts_container_image_self_build - name: Ensure Mautrix Hangots repository is present on self build git: repo: https://github.com/tulir/mautrix-hangouts.git dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" force: "yes" - when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_self_build" + when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_container_image_self_build" - name: Ensure Mautrix Hangouts Docker image is build docker_image: @@ -46,7 +46,7 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" pull: yes - when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_self_build" + when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_container_image_self_build" - name: Check if an old database file already exists stat: diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index cbcc135ea..06063e3b2 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -1,6 +1,6 @@ matrix_coturn_enabled: true -matrix_coturn_self_build: false +matrix_coturn_container_image_self_build: false matrix_coturn_docker_image: "instrumentisto/coturn:4.5.1.1" matrix_coturn_docker_image_force_pull: "{{ matrix_coturn_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-coturn/tasks/init.yml b/roles/matrix-coturn/tasks/init.yml index 9b97ce6a0..b59feebd0 100644 --- a/roles/matrix-coturn/tasks/init.yml +++ b/roles/matrix-coturn/tasks/init.yml @@ -7,4 +7,4 @@ - name: Fail if running on Ansible lower than 2.8 and trying self building fail: msg: "To self build Coturn image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." - when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_coturn_self_build" + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_coturn_container_image_self_build" diff --git a/roles/matrix-coturn/tasks/setup_coturn.yml b/roles/matrix-coturn/tasks/setup_coturn.yml index ec7a452e5..bd6ef0c9e 100644 --- a/roles/matrix-coturn/tasks/setup_coturn.yml +++ b/roles/matrix-coturn/tasks/setup_coturn.yml @@ -12,7 +12,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}" with_items: - - { src: "{{ matrix_coturn_docker_src_files_path }}", when: "{{ matrix_coturn_self_build }}"} + - { src: "{{ matrix_coturn_docker_src_files_path }}", when: "{{ matrix_coturn_container_image_self_build }}"} when: matrix_riot_web_enabled|bool - name: Ensure Coturn image is pulled @@ -21,7 +21,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_coturn_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_coturn_docker_image_force_pull }}" - when: matrix_coturn_enabled|bool and not matrix_coturn_self_build + when: matrix_coturn_enabled|bool and not matrix_coturn_container_image_self_build - name: Ensure Coturn repository is present on self-build git: @@ -29,7 +29,7 @@ dest: "{{ matrix_coturn_docker_src_files_path }}" version: "{{ matrix_coturn_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_coturn_enabled|bool and matrix_coturn_self_build" + when: "matrix_coturn_enabled|bool and matrix_coturn_container_image_self_build" - name: Ensure Coturn Docker image is build docker_image: @@ -39,7 +39,7 @@ dockerfile: Dockerfile path: "{{ matrix_coturn_docker_src_files_path }}" pull: yes - when: "matrix_coturn_enabled|bool and matrix_coturn_self_build" + when: "matrix_coturn_enabled|bool and matrix_coturn_container_image_self_build" - name: Ensure Coturn configuration path exists file: diff --git a/roles/matrix-mxisd/defaults/main.yml b/roles/matrix-mxisd/defaults/main.yml index b291c5ce5..605f40281 100644 --- a/roles/matrix-mxisd/defaults/main.yml +++ b/roles/matrix-mxisd/defaults/main.yml @@ -3,7 +3,7 @@ matrix_mxisd_enabled: true -matrix_mxisd_self_build: false +matrix_mxisd_container_image_self_build: false matrix_mxisd_docker_image: "kamax/mxisd:1.4.6" matrix_mxisd_docker_image_force_pull: "{{ matrix_mxisd_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-mxisd/tasks/init.yml b/roles/matrix-mxisd/tasks/init.yml index dcae446e2..dcf1d0532 100644 --- a/roles/matrix-mxisd/tasks/init.yml +++ b/roles/matrix-mxisd/tasks/init.yml @@ -7,4 +7,4 @@ - name: Fail if running on Ansible lower than 2.8 and trying self building fail: msg: "To self build Mxisd image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." - when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mxisd_self_build" + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mxisd_container_image_self_build" diff --git a/roles/matrix-mxisd/tasks/setup_mxisd.yml b/roles/matrix-mxisd/tasks/setup_mxisd.yml index 92b7163b9..6bcdfb4f0 100644 --- a/roles/matrix-mxisd/tasks/setup_mxisd.yml +++ b/roles/matrix-mxisd/tasks/setup_mxisd.yml @@ -14,7 +14,7 @@ with_items: - "{{ matrix_mxisd_config_path }}" - "{{ matrix_mxisd_data_path }}" - - { src: "{{ matrix_mxisd_docker_src_files_path }}", when: "{{ matrix_mxisd_self_build }}"} + - { src: "{{ matrix_mxisd_docker_src_files_path }}", when: "{{ matrix_mxisd_container_image_self_build }}"} when: matrix_mxisd_enabled|bool - name: Ensure mxisd image is pulled @@ -23,7 +23,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mxisd_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_mxisd_docker_image_force_pull }}" - when: matrix_mxisd_enabled|bool and not matrix_mxisd_self_build + when: matrix_mxisd_enabled|bool and not matrix_mxisd_container_image_self_build - name: Ensure gradel is installed for self-building apt: @@ -31,7 +31,7 @@ - gradle state: present update_cache: yes - when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" + when: "matrix_mxisd_enabled|bool and matrix_mxisd_container_image_self_build" - name: Ensure mxisd repository is present on self-build git: @@ -39,13 +39,13 @@ dest: "{{ matrix_mxisd_docker_src_files_path }}" version: "v{{ matrix_mxisd_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" + when: "matrix_mxisd_enabled|bool and matrix_mxisd_container_image_self_build" - name: Ensure mxisd Docker image is build shell: "./gradlew dockerBuild" args: chdir: "{{ matrix_mxisd_docker_src_files_path }}" - when: "matrix_mxisd_enabled|bool and matrix_mxisd_self_build" + when: "matrix_mxisd_enabled|bool and matrix_mxisd_container_image_self_build" - name: Ensure mxisd config installed copy: diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index cafe4ceb9..08b141a16 100644 --- a/roles/matrix-riot-web/defaults/main.yml +++ b/roles/matrix-riot-web/defaults/main.yml @@ -1,6 +1,6 @@ matrix_riot_web_enabled: true -matrix_riot_web_self_build: false +matrix_riot_web_container_image_self_build: false matrix_riot_web_docker_image: "vectorim/riot-web:v1.5.12" matrix_riot_web_docker_image_force_pull: "{{ matrix_riot_web_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-riot-web/tasks/init.yml b/roles/matrix-riot-web/tasks/init.yml index 4fc4e6580..7c8a1550c 100644 --- a/roles/matrix-riot-web/tasks/init.yml +++ b/roles/matrix-riot-web/tasks/init.yml @@ -7,4 +7,4 @@ - name: Fail if running on Ansible lower than 2.8 and trying self building fail: msg: "To self build Riot Web image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." - when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_riot_web_self_build" + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_riot_web_container_image_self_build" diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index 2dac85cfa..2509dbc97 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -13,7 +13,7 @@ group: "{{ matrix_user_username }}" with_items: - "{{ matrix_riot_web_data_path }}" - - { src: "{{ matrix_riot_web_docker_src_files_path }}", when: "{{ matrix_riot_web_self_build }}" } + - { src: "{{ matrix_riot_web_docker_src_files_path }}", when: "{{ matrix_riot_web_container_image_self_build }}" } when: matrix_riot_web_enabled|bool - name: Ensure riot-web Docker image is pulled @@ -22,7 +22,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_riot_web_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_riot_web_docker_image_force_pull }}" - when: matrix_riot_web_enabled|bool and not matrix_riot_web_self_build + when: matrix_riot_web_enabled|bool and not matrix_riot_web_container_image_self_build - name: Ensure Riot Web repository is present on self-build git: @@ -30,7 +30,7 @@ dest: "{{ matrix_riot_web_docker_src_files_path }}" version: "{{ matrix_riot_web_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_riot_web_enabled|bool and matrix_riot_web_self_build" + when: "matrix_riot_web_enabled|bool and matrix_riot_web_container_image_self_build" - name: Ensure Riot Web Docker image is build docker_image: @@ -40,7 +40,7 @@ dockerfile: Dockerfile path: "{{ matrix_riot_web_docker_src_files_path }}" pull: yes - when: "matrix_riot_web_enabled|bool and matrix_riot_web_self_build" + when: "matrix_riot_web_enabled|bool and matrix_riot_web_container_image_self_build" - name: Ensure Matrix riot-web configuration installed copy: diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index f3e6d4fe8..fe9f5545f 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -3,7 +3,7 @@ matrix_synapse_enabled: true -matrix_synapse_self_build: false +matrix_synapse_container_image_self_build: false matrix_synapse_docker_image: "matrixdotorg/synapse:v1.11.1" matrix_synapse_docker_image_force_pull: "{{ matrix_synapse_docker_image.endswith(':latest') }}" diff --git a/roles/matrix-synapse/tasks/init.yml b/roles/matrix-synapse/tasks/init.yml index b91c42cb1..004a2a920 100644 --- a/roles/matrix-synapse/tasks/init.yml +++ b/roles/matrix-synapse/tasks/init.yml @@ -11,4 +11,4 @@ - name: Fail if running on Ansible lower than 2.8 and trying self building fail: msg: "To self build Synapse image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." - when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_synapse_self_build" + when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_synapse_container_image_self_build" diff --git a/roles/matrix-synapse/tasks/setup_synapse.yml b/roles/matrix-synapse/tasks/setup_synapse.yml index 0ce851c7e..8d5f72d24 100644 --- a/roles/matrix-synapse/tasks/setup_synapse.yml +++ b/roles/matrix-synapse/tasks/setup_synapse.yml @@ -11,7 +11,7 @@ - "{{ matrix_synapse_config_dir_path }}" - "{{ matrix_synapse_run_path }}" - "{{ matrix_synapse_ext_path }}" - - { src: "{{ matrix_synapse_docker_src_files_path }}", when: "{{ matrix_synapse_self_build }}" } + - { src: "{{ matrix_synapse_docker_src_files_path }}", when: "{{ matrix_synapse_container_image_self_build }}" } # We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml), # because if it's using Goofys and it's already mounted (from before), # trying to chown/chmod it here will cause trouble. diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index 481429a40..41534d2b8 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -24,7 +24,7 @@ dest: "{{ matrix_synapse_docker_src_files_path }}" version: "{{ matrix_synapse_docker_image.split(':')[1] }}" force: "yes" - when: "matrix_synapse_self_build" + when: "matrix_synapse_container_image_self_build" - name: Ensure Synapse Docker image is build docker_image: @@ -34,7 +34,7 @@ dockerfile: docker/Dockerfile path: "{{ matrix_synapse_docker_src_files_path }}" pull: yes - when: "matrix_synapse_self_build" + when: "matrix_synapse_container_image_self_build" - name: Ensure Synapse Docker image is pulled docker_image: @@ -42,7 +42,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_synapse_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_synapse_docker_image_force_pull }}" - when: "not matrix_synapse_self_build" + when: "not matrix_synapse_container_image_self_build" - name: Check if a Synapse signing key exists stat: From 063e988db2962945b82e28360232db0a0e3797d6 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 15 Mar 2020 11:26:24 +0200 Subject: [PATCH 23/25] Make gradle installation fail in a friendlier way on CentOS --- roles/matrix-mxisd/tasks/setup_mxisd.yml | 41 +++++++++++++----------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/roles/matrix-mxisd/tasks/setup_mxisd.yml b/roles/matrix-mxisd/tasks/setup_mxisd.yml index 6bcdfb4f0..27c00c70b 100644 --- a/roles/matrix-mxisd/tasks/setup_mxisd.yml +++ b/roles/matrix-mxisd/tasks/setup_mxisd.yml @@ -25,26 +25,31 @@ force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mxisd_docker_image_force_pull }}" when: matrix_mxisd_enabled|bool and not matrix_mxisd_container_image_self_build -- name: Ensure gradel is installed for self-building - apt: - name: - - gradle - state: present - update_cache: yes - when: "matrix_mxisd_enabled|bool and matrix_mxisd_container_image_self_build" +- block: + - name: Ensure gradle is installed for self-building + apt: + name: + - gradle + state: present + update_cache: yes + when: (ansible_os_family == 'Debian') -- name: Ensure mxisd repository is present on self-build - git: - repo: https://github.com/kamax-matrix/mxisd.git - dest: "{{ matrix_mxisd_docker_src_files_path }}" - version: "v{{ matrix_mxisd_docker_image.split(':')[1] }}" - force: "yes" - when: "matrix_mxisd_enabled|bool and matrix_mxisd_container_image_self_build" + - name: Ensure gradle is installed for self-building + fail: + msg: "Installing gradle on CentOS is currently not supported, so self-building mxisd cannot happen at this time" + when: ansible_distribution == 'CentOS' -- name: Ensure mxisd Docker image is build - shell: "./gradlew dockerBuild" - args: - chdir: "{{ matrix_mxisd_docker_src_files_path }}" + - name: Ensure mxisd repository is present on self-build + git: + repo: https://github.com/kamax-matrix/mxisd.git + dest: "{{ matrix_mxisd_docker_src_files_path }}" + version: "v{{ matrix_mxisd_docker_image.split(':')[1] }}" + force: "yes" + + - name: Ensure mxisd Docker image is built + shell: "./gradlew dockerBuild" + args: + chdir: "{{ matrix_mxisd_docker_src_files_path }}" when: "matrix_mxisd_enabled|bool and matrix_mxisd_container_image_self_build" - name: Ensure mxisd config installed From 3cee815baf8110e14baa0c7ea29733cf87cd260e Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 15 Mar 2020 11:34:35 +0200 Subject: [PATCH 24/25] Fix some typos --- docs/self-build.md | 6 +++--- .../matrix-bridge-mautrix-facebook/tasks/setup_install.yml | 2 +- .../matrix-bridge-mautrix-hangouts/tasks/setup_install.yml | 2 +- roles/matrix-coturn/tasks/setup_coturn.yml | 2 +- roles/matrix-riot-web/tasks/setup_riot_web.yml | 2 +- roles/matrix-synapse/tasks/synapse/setup_install.yml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/self-build.md b/docs/self-build.md index b95f60a9b..44b660761 100644 --- a/docs/self-build.md +++ b/docs/self-build.md @@ -2,11 +2,11 @@ The playbook supports the self building of a couple of components. This may be useful for architectures beside x86_64 that have no docker images right now (e g. the armv7 for the Raspberry Pi). Some roles have been updated, so they build the necessary image on the host. It needs more space, as some build tools need to be present (like Java, for mxisd). -To use these modification there is a variable that needs to be switched to enable this functionality. Add this to your vars.yaml file: -``` +To use these modification there is a variable that needs to be switched to enable this functionality. Add this to your `vars.yaml` file: +```yaml matrix_container_images_self_build = true ``` -Setting that variable will self-build every role where applicable. Self-building can be set on a per-role basis as well. +Setting that variable will self-build every role which supports self-building. Self-building can be set on a per-role basis as well. List of roles where self-building the docker image is currently possible: - synapse diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index c21ba216c..5a70c2e43 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -37,7 +37,7 @@ force: "yes" when: "matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_container_image_self_build" -- name: Ensure Mautrix Facebook Docker image is build +- name: Ensure Mautrix Facebook Docker image is built docker_image: name: "{{ matrix_mautrix_facebook_docker_image }}" source: build diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index beed38a7b..db1fe736d 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -38,7 +38,7 @@ force: "yes" when: "matrix_mautrix_hangouts_enabled|bool and matrix_mautrix_hangouts_container_image_self_build" -- name: Ensure Mautrix Hangouts Docker image is build +- name: Ensure Mautrix Hangouts Docker image is built docker_image: name: "{{ matrix_mautrix_hangouts_docker_image }}" source: build diff --git a/roles/matrix-coturn/tasks/setup_coturn.yml b/roles/matrix-coturn/tasks/setup_coturn.yml index bd6ef0c9e..d86e4b22f 100644 --- a/roles/matrix-coturn/tasks/setup_coturn.yml +++ b/roles/matrix-coturn/tasks/setup_coturn.yml @@ -31,7 +31,7 @@ force: "yes" when: "matrix_coturn_enabled|bool and matrix_coturn_container_image_self_build" -- name: Ensure Coturn Docker image is build +- name: Ensure Coturn Docker image is built docker_image: name: "{{ matrix_coturn_docker_image }}" source: build diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index 2509dbc97..feccbe816 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -32,7 +32,7 @@ force: "yes" when: "matrix_riot_web_enabled|bool and matrix_riot_web_container_image_self_build" -- name: Ensure Riot Web Docker image is build +- name: Ensure Riot Web Docker image is built docker_image: name: "{{ matrix_riot_web_docker_image }}" source: build diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index 41534d2b8..cf24cefb5 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -26,7 +26,7 @@ force: "yes" when: "matrix_synapse_container_image_self_build" -- name: Ensure Synapse Docker image is build +- name: Ensure Synapse Docker image is built docker_image: name: "{{ matrix_synapse_docker_image }}" source: build From 8dd187ac55c3ed19b39412e2858a826ebeb91a0d Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 15 Mar 2020 12:54:41 +0200 Subject: [PATCH 25/25] Update changelog and documentation --- CHANGELOG.md | 10 ++++++++++ docs/{self-build.md => self-building.md} | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) rename docs/{self-build.md => self-building.md} (52%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32153869d..5ab03e7e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 2020-03-15 + +## Raspberry Pi support + +The playbook supports installing to a Raspberry Pi server, for at least some of the services. + +Since most ready-made container images do not support that architecture, we achieve this by building images locally on the device itself. +See our [Self-building documentation page](docs/self-building.md) for how to get started. + + # 2020-02-26 ## Riot-web themes are here diff --git a/docs/self-build.md b/docs/self-building.md similarity index 52% rename from docs/self-build.md rename to docs/self-building.md index 44b660761..a4d6fad9c 100644 --- a/docs/self-build.md +++ b/docs/self-building.md @@ -1,6 +1,6 @@ -# Self building +# Self-building -The playbook supports the self building of a couple of components. This may be useful for architectures beside x86_64 that have no docker images right now (e g. the armv7 for the Raspberry Pi). Some roles have been updated, so they build the necessary image on the host. It needs more space, as some build tools need to be present (like Java, for mxisd). +The playbook supports the self-building of some of its components. This may be useful for architectures besides x86_64, which have no Docker images right now (e g. the armv7 for the Raspberry Pi). Some playbook roles have been updated, so they build the necessary image on the host. It needs more space, as some build tools need to be present (like Java, for mxisd). To use these modification there is a variable that needs to be switched to enable this functionality. Add this to your `vars.yaml` file: ```yaml @@ -15,3 +15,5 @@ List of roles where self-building the docker image is currently possible: - mxisd - matrix-bridge-mautrix-facebook - matrix-bridge-mautrix-hangouts + +Adding self-building support to other roles is welcome. Feel free to contribute!