Restore matrix-corporal functionality when matrix-nginx-proxy is not involved

This commit is contained in:
Slavi Pantaleev
2024-01-13 15:28:21 +02:00
parent c23022ff86
commit 5d76b91dc2
7 changed files with 83 additions and 28 deletions

View File

@ -21,6 +21,7 @@
- tags:
- self-check
- self-check-corporal
block:
- when: matrix_corporal_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/self_check.yml"

View File

@ -1,24 +1,21 @@
---
- ansible.builtin.set_fact:
corporal_client_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}/_matrix/client/corporal"
- name: Check Matrix Corporal HTTP gateway
ansible.builtin.uri:
url: "{{ corporal_client_api_url_endpoint_public }}"
url: "{{ matrix_corporal_self_check_matrix_client_api_url_endpoint_public }}"
follow_redirects: none
return_content: true
check_mode: false
register: result_corporal_client_api
register: result_corporal_matrix_client_api
ignore_errors: true
delegate_to: 127.0.0.1
become: false
- name: Fail if Matrix Corporal HTTP gateway not working
ansible.builtin.fail:
msg: "Failed checking Matrix Corporal is fronting the Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ corporal_client_api_url_endpoint_public }}`). Is matrix-corporal running? Is port 443 open in your firewall? Full error: {{ result_corporal_client_api }}"
when: "result_corporal_client_api.failed or 'Matrix Client-Server API protected by Matrix Corporal' not in result_corporal_client_api.content"
msg: "Failed checking Matrix Corporal is fronting the Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_corporal_self_check_matrix_client_api_url_endpoint_public }}`). Is matrix-corporal running? Is port 443 open in your firewall? Full error: {{ result_corporal_matrix_client_api }}"
when: "result_corporal_matrix_client_api.failed or 'Matrix Client-Server API protected by Matrix Corporal' not in result_corporal_matrix_client_api.content"
- name: Report working Matrix Corporal HTTP gateway
ansible.builtin.debug:
msg: "Matrix Corporal is fronting the Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ corporal_client_api_url_endpoint_public }}`)"
msg: "Matrix Corporal is fronting the Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_corporal_self_check_matrix_client_api_url_endpoint_public }}`)"

View File

@ -66,6 +66,11 @@
with_items:
- labels
- name: Ensure Matrix Corporal container network is created
community.general.docker_network:
name: "{{ matrix_corporal_container_network }}"
driver: bridge
- name: Ensure matrix-corporal.service installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-corporal.service.j2"

View File

@ -6,6 +6,7 @@
You need to define a required configuration setting (`{{ item }}`) for using matrix-corporal.
when: "vars[item] == ''"
with_items:
- "matrix_corporal_container_network"
- "matrix_corporal_matrix_homeserver_api_endpoint"
- "matrix_corporal_matrix_auth_shared_secret"
- "matrix_corporal_matrix_registration_shared_secret"