From 350b25690d7c3368429b5b4d45cb7a39277e1dfa Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sat, 16 Feb 2019 11:48:17 +0200 Subject: [PATCH] Add Riot v1.0 (v1.0.1) support --- CHANGELOG.md | 11 + roles/matrix-riot-web/defaults/main.yml | 16 +- .../matrix-riot-web/tasks/setup_riot_web.yml | 14 +- .../matrix-riot-web/tasks/validate_config.yml | 13 + .../matrix-riot-web/templates/config.json.j2 | 5 +- roles/matrix-riot-web/templates/home.html.j2 | 308 ------------------ .../systemd/matrix-riot-web.service.j2 | 8 +- roles/matrix-riot-web/vars/main.yml | 3 + .../matrix-synapse/tasks/validate_config.yml | 1 - 9 files changed, 51 insertions(+), 328 deletions(-) delete mode 100644 roles/matrix-riot-web/templates/home.html.j2 create mode 100644 roles/matrix-riot-web/vars/main.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d2e2046c..58816b213 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# 2019-02-16 + +## Riot v1.0.1 support + +You can now use the brand new and redesigned Riot. + +The new version no longer has a homepage by default, so we've also removed the custom homepage that we've been installing. + +However, we still provide you with hooks to install your own `home.html` file (using the `matrix_riot_web_embedded_pages_home_path` variable). + + # 2019-02-14 ## Synapse v0.99.1 diff --git a/roles/matrix-riot-web/defaults/main.yml b/roles/matrix-riot-web/defaults/main.yml index a111c9d84..3bf9844ca 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_docker_image: "bubuntux/riot-web:v0.17.9" +matrix_riot_web_docker_image: "bubuntux/riot-web:v1.0.1" matrix_riot_web_data_path: "{{ matrix_base_data_path }}/riot-web" @@ -22,14 +22,6 @@ matrix_riot_web_integrations_jitsi_widget_url: "https://scalar.vector.im/api/wid matrix_riot_web_roomdir_servers: ['matrix.org'] matrix_riot_web_welcome_user_id: "@riot-bot:matrix.org" -# Riot home.html customizations -# Default home.html template file -matrix_riot_web_homepage_template: "{{ role_path }}/templates/home.html.j2" -# Show general discussion about Matrix and Riot row -matrix_riot_web_homepage_template_general: true -# Show Matrix technical discussions row -matrix_riot_web_homepage_template_technical: true -# Show building services on Matrix row -matrix_riot_web_homepage_template_building: true -# Show contributing code to Matrix and Riot row -matrix_riot_web_homepage_template_contributing: true +# By default, there's no Riot homepage (when logged in). If you wish to have one, +# point this to a `home.html` template file on your local filesystem. +matrix_riot_web_embedded_pages_home_path: ~ diff --git a/roles/matrix-riot-web/tasks/setup_riot_web.yml b/roles/matrix-riot-web/tasks/setup_riot_web.yml index c9a84f916..94863a8c3 100644 --- a/roles/matrix-riot-web/tasks/setup_riot_web.yml +++ b/roles/matrix-riot-web/tasks/setup_riot_web.yml @@ -18,7 +18,7 @@ name: "{{ matrix_riot_web_docker_image }}" when: matrix_riot_web_enabled -- name: Ensure Matrix riot-web configured +- name: Ensure Matrix riot-web config files installed template: src: "{{ item.src }}" dest: "{{ matrix_riot_web_data_path }}/{{ item.name }}" @@ -28,8 +28,16 @@ with_items: - {src: "{{ role_path }}/templates/config.json.j2", name: "config.json"} - {src: "{{ role_path }}/templates/nginx.conf.j2", name: "nginx.conf"} - - {src: "{{ matrix_riot_web_homepage_template }}", name: "home.html"} - when: matrix_riot_web_enabled + - {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"} + when: "matrix_riot_web_enabled and item.src is not none" + +- name: Ensure Matrix riot-web config files removed + file: + path: "{{ matrix_riot_web_data_path }}/{{ item.name }}" + state: absent + with_items: + - {src: "{{ matrix_riot_web_embedded_pages_home_path }}", name: "home.html"} + when: "matrix_riot_web_enabled and item.src is none" - name: Ensure matrix-riot-web.service installed template: diff --git a/roles/matrix-riot-web/tasks/validate_config.yml b/roles/matrix-riot-web/tasks/validate_config.yml index 0068580d5..0a96afc0d 100644 --- a/roles/matrix-riot-web/tasks/validate_config.yml +++ b/roles/matrix-riot-web/tasks/validate_config.yml @@ -7,3 +7,16 @@ when: "vars[item] == ''" with_items: - "matrix_riot_web_default_hs_url" + +- name: (Deprecation) Catch and report renamed settings + fail: + msg: > + Your configuration contains a variable, which now has a different name. + Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). + when: "item.old in vars" + with_items: + - {'old': 'matrix_riot_web_homepage_template', 'new': 'matrix_riot_web_embedded_pages_home_path'} + - {'old': 'matrix_riot_web_homepage_template_general', 'new': ''} + - {'old': 'matrix_riot_web_homepage_template_technical', 'new': ''} + - {'old': 'matrix_riot_web_homepage_template_building', 'new': ''} + - {'old': 'matrix_riot_web_homepage_template_contributing', 'new': ''} diff --git a/roles/matrix-riot-web/templates/config.json.j2 b/roles/matrix-riot-web/templates/config.json.j2 index 9eec9e224..9477e53c3 100644 --- a/roles/matrix-riot-web/templates/config.json.j2 +++ b/roles/matrix-riot-web/templates/config.json.j2 @@ -13,5 +13,8 @@ "roomDirectory": { "servers": {{ matrix_riot_web_roomdir_servers|to_json }} }, - "welcomeUserId": {{ matrix_riot_web_welcome_user_id|to_json }} + "welcomeUserId": {{ matrix_riot_web_welcome_user_id|to_json }}, + "embeddedPages": { + "homeUrl": {{ matrix_riot_web_embedded_pages_home_url|to_json }} + } } diff --git a/roles/matrix-riot-web/templates/home.html.j2 b/roles/matrix-riot-web/templates/home.html.j2 deleted file mode 100644 index 827906ea6..000000000 --- a/roles/matrix-riot-web/templates/home.html.j2 +++ /dev/null @@ -1,308 +0,0 @@ - - -
-
- -
-

_t("Welcome to {{ hostname_riot }}")

-

_t("Decentralised, encrypted chat & collaboration powered by [matrix]")

-
-
-
-
-
-

_t("Search the room directory")

- - - - - _t("Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!") - -
-
-{% if matrix_riot_web_welcome_user_id %} -
-
-

_t("Chat with Riot Bot")

- - - - - _t("Get started with some tips from Riot Bot!") - -
-
-{% endif %} -
-{% if matrix_riot_web_homepage_template_general %} - -

_t("General discussion about Matrix and Riot")

- -
-
- - - Matrix HQ - - _t("Discussion of all things Matrix!") -
-
- - - Riot - - _t("Riot/Web & Desktop chat") -
-
- - - #riot-ios - - _t("Riot/iOS & matrix-ios-sdk chat") -
-
- - - #riot-android - - _t("Riot/Android & matrix-android-sdk chat") -
-
-{% endif %} -{% if matrix_riot_web_homepage_template_technical %} - -

_t("Matrix technical discussions")

-

_t("Running Matrix services")

- -
-
- - - Matrix Docker Ansible Deploy - - Support for Matrix Docker Ansible role -
-
- - - Synapse Support Community - - _t("Community-run support for Synapse") -
-
- - - #dendrite:matrix.org - - _t("Admin support for Dendrite") -
-
- - - Synapse Homeowners - - _t("Announcements about Synapse releases") -
-
- - - IRC Matrix Bridges - - _t("Support for those using and running matrix-appservice-irc") -
-
-{% endif %} -{% if matrix_riot_web_homepage_template_building %} - -

_t("Building services on Matrix")

- -
-
- - - #matrix-dev:matrix.org - - _t("Support for those using the Matrix spec") -
-
- - - End-to-end crypto in Matrix - - _t("Design and implementation of E2E in Matrix") -
-
- - - #vr:matrix.org - - _t("Implementing VR services with Matrix") -
-
- - - #webrtc:matrix.org - - _t("Implementing VoIP services with Matrix") -
-
- - - Matrix Identity - - _t("Discussion of the Identity Service API") -
-
- - - Matrix Bridging - - _t("Support for those using, running and writing other bridges") -
-
-{% endif %} -{% if matrix_riot_web_homepage_template_contributing %} -

_t("Contributing code to Matrix and Riot")

- -
-
- - - #riot-dev - - _t("Dev chat for the Riot/Web dev team") -
-
- - - #dendrite-dev - - _t("Dev chat for the Dendrite dev team") -
-
- - - Riot Translations - - _t("Co-ordination for Riot translators") -
-
-{% endif %} -
diff --git a/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 b/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 index 5cd697746..2b57f27c0 100644 --- a/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 +++ b/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 @@ -14,14 +14,16 @@ ExecStart=/usr/bin/docker run --rm --name matrix-riot-web \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ --read-only \ + --network={{ matrix_docker_network }} \ + {% if matrix_riot_web_container_expose_port %} + -p 127.0.0.1:8765:8080 \ + {% endif %} --tmpfs=/tmp:rw,noexec,nosuid,size=10m \ -v {{ matrix_riot_web_data_path }}/nginx.conf:/etc/nginx/nginx.conf:ro \ -v /dev/null:/etc/nginx/conf.d/default.conf:ro \ -v {{ matrix_riot_web_data_path }}/config.json:/etc/riot-web/config.json:ro \ + {% if matrix_riot_web_embedded_pages_home_path is not none %} -v {{ matrix_riot_web_data_path }}/home.html:/etc/riot-web/home.html:ro \ - --network={{ matrix_docker_network }} \ - {% if matrix_riot_web_container_expose_port %} - -p 127.0.0.1:8765:8080 \ {% endif %} {{ matrix_riot_web_docker_image }} ExecStop=-/usr/bin/docker kill matrix-riot-web diff --git a/roles/matrix-riot-web/vars/main.yml b/roles/matrix-riot-web/vars/main.yml new file mode 100644 index 000000000..201b5bdd9 --- /dev/null +++ b/roles/matrix-riot-web/vars/main.yml @@ -0,0 +1,3 @@ +--- + +matrix_riot_web_embedded_pages_home_url: "{{ (none if matrix_riot_web_embedded_pages_home_path is none else 'home.html') }}" diff --git a/roles/matrix-synapse/tasks/validate_config.yml b/roles/matrix-synapse/tasks/validate_config.yml index 3cf1d1c4b..607dced4b 100644 --- a/roles/matrix-synapse/tasks/validate_config.yml +++ b/roles/matrix-synapse/tasks/validate_config.yml @@ -17,4 +17,3 @@ with_items: - {'old': 'matrix_synapse_container_expose_api_port', 'new': 'matrix_synapse_container_expose_client_api_port'} - {'old': 'matrix_synapse_no_tls', 'new': ''} -