add possibility to install synapse on raspberry pi

This commit is contained in:
Horvath Gergely 2020-02-17 21:48:48 +01:00
parent bbbcc18c70
commit a096eafb45
6 changed files with 48 additions and 2 deletions

View file

@ -678,3 +678,19 @@ matrix_synapse_systemd_wanted_services_list: |
# /matrix-synapse
#
######################################################################
######################################################################
#
# raspberry pi
#
######################################################################
matrix_raspberry_pi: "false"
######################################################################
#
# /raspberry pi
#
######################################################################

View file

@ -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 }}"

View file

@ -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"

View file

@ -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:

View file

@ -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.

View file

@ -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: