ソースを参照

Add matrix_client_hydrogen_hostname and fix Hydrogen serving at non-root-path

pull/2483/head
Slavi Pantaleev 3年前
コミット
eb7292f274
4個のファイルの変更16行の追加17行の削除
  1. +14
    -4
      roles/custom/matrix-client-hydrogen/defaults/main.yml
  2. +0
    -11
      roles/custom/matrix-client-hydrogen/tasks/validate_config.yml
  3. +1
    -1
      roles/custom/matrix-client-hydrogen/templates/config.json.j2
  4. +1
    -1
      roles/custom/matrix-synapse-admin/defaults/main.yml

+ 14
- 4
roles/custom/matrix-client-hydrogen/defaults/main.yml ファイルの表示

@@ -33,10 +33,9 @@ matrix_client_hydrogen_container_http_host_bind_port: ''
# To inject your own other container labels, see `matrix_client_hydrogen_container_labels_additional_labels`. # To inject your own other container labels, see `matrix_client_hydrogen_container_labels_additional_labels`.
matrix_client_hydrogen_container_labels_traefik_enabled: true matrix_client_hydrogen_container_labels_traefik_enabled: true
matrix_client_hydrogen_container_labels_traefik_docker_network: "{{ matrix_client_hydrogen_container_network }}" matrix_client_hydrogen_container_labels_traefik_docker_network: "{{ matrix_client_hydrogen_container_network }}"
matrix_client_hydrogen_container_labels_traefik_hostname: "{{ matrix_server_fqn_element }}"
matrix_client_hydrogen_container_labels_traefik_hostname: "{{ matrix_client_hydrogen_hostname }}"
# The path prefix must either be `/` or not end with a slash (e.g. `/hydrogen`). # The path prefix must either be `/` or not end with a slash (e.g. `/hydrogen`).
# For now, only `/` is supported due to problems with serving Hydrogen at a subpath.
matrix_client_hydrogen_container_labels_traefik_path_prefix: /
matrix_client_hydrogen_container_labels_traefik_path_prefix: "{{ matrix_client_hydrogen_path_prefix }}"
matrix_client_hydrogen_container_labels_traefik_rule: "Host(`{{ matrix_client_hydrogen_container_labels_traefik_hostname }}`){% if matrix_client_hydrogen_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_client_hydrogen_container_labels_traefik_path_prefix }}`){% endif %}" matrix_client_hydrogen_container_labels_traefik_rule: "Host(`{{ matrix_client_hydrogen_container_labels_traefik_hostname }}`){% if matrix_client_hydrogen_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_client_hydrogen_container_labels_traefik_path_prefix }}`){% endif %}"
matrix_client_hydrogen_container_labels_traefik_priority: 0 matrix_client_hydrogen_container_labels_traefik_priority: 0
matrix_client_hydrogen_container_labels_traefik_entrypoints: web-secure matrix_client_hydrogen_container_labels_traefik_entrypoints: web-secure
@@ -124,6 +123,18 @@ matrix_client_hydrogen_floc_optout_enabled: true
# See: `matrix_client_hydrogen_http_header_strict_transport_security` # See: `matrix_client_hydrogen_http_header_strict_transport_security`
matrix_client_hydrogen_hsts_preload_enabled: false matrix_client_hydrogen_hsts_preload_enabled: false


# The hostname at which Hydrogen is served.
# Only works with with Traefik reverse-proxying.
# For matrix-nginx-proxy, `matrix_server_fqn_hydrogen` is used and this variable has no effect.
matrix_client_hydrogen_hostname: "{{ matrix_server_fqn_hydrogen }}"

# The path at which Hydrogen is exposed.
# When matrix-nginx-proxy is used, setting this to values other than `/` will cause configuration mismatches and trouble.
#
# If Traefik is used, the hostname is also configurable - see `matrix_client_hydrogen_container_labels_traefik_hostname`.
# This value must either be `/` or not end with a slash (e.g. `/hydrogen`).
matrix_client_hydrogen_path_prefix: /

# Controls whether the self-check feature should validate SSL certificates. # Controls whether the self-check feature should validate SSL certificates.
matrix_client_hydrogen_self_check_validate_certificates: true matrix_client_hydrogen_self_check_validate_certificates: true


@@ -135,7 +146,6 @@ matrix_client_hydrogen_push:
matrix_client_hydrogen_default_hs_url: "" matrix_client_hydrogen_default_hs_url: ""
matrix_client_hydrogen_bugReportEndpointUrl: "https://element.io/bugreports/submit" # noqa var-naming matrix_client_hydrogen_bugReportEndpointUrl: "https://element.io/bugreports/submit" # noqa var-naming



# Default Hydrogen configuration template which covers the generic use case. # Default Hydrogen configuration template which covers the generic use case.
# You can customize it by controlling the various variables inside it. # You can customize it by controlling the various variables inside it.
# #


+ 0
- 11
roles/custom/matrix-client-hydrogen/tasks/validate_config.yml ファイルの表示

@@ -27,14 +27,3 @@
msg: >- msg: >-
matrix_client_hydrogen_container_labels_traefik_path_prefix (`{{ matrix_client_hydrogen_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/hydrogen`). matrix_client_hydrogen_container_labels_traefik_path_prefix (`{{ matrix_client_hydrogen_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/hydrogen`).
when: "matrix_client_hydrogen_container_labels_traefik_path_prefix != '/' and matrix_client_hydrogen_container_labels_traefik_path_prefix[-1] == '/'" when: "matrix_client_hydrogen_container_labels_traefik_path_prefix != '/' and matrix_client_hydrogen_container_labels_traefik_path_prefix[-1] == '/'"

# For example, we're getting errors like this:
# > main.js:51 Failed to load stylesheet from https://DOMAIN/assets/theme-element-light.5316e268.css:
# despite having set a prefix of `/hydrogen`.
# This is yet to be investigated and workaround around.
- name: Fail if matrix_client_hydrogen_container_labels_traefik_path_prefix is not /
ansible.builtin.fail:
msg: >-
matrix_client_hydrogen_container_labels_traefik_path_prefix can only be set to `/` right now.
Serving Hydrogen from another path doesn't work just yet.
when: "matrix_client_hydrogen_container_labels_traefik_path_prefix != '/'"

+ 1
- 1
roles/custom/matrix-client-hydrogen/templates/config.json.j2 ファイルの表示

@@ -3,7 +3,7 @@
"defaultHomeServer": {{ matrix_client_hydrogen_default_hs_url | string | to_json }}, "defaultHomeServer": {{ matrix_client_hydrogen_default_hs_url | string | to_json }},
"bugReportEndpointUrl": {{ matrix_client_hydrogen_bugReportEndpointUrl | to_json }}, "bugReportEndpointUrl": {{ matrix_client_hydrogen_bugReportEndpointUrl | to_json }},
"themeManifests": [ "themeManifests": [
"assets/theme-element.json"
"{{ matrix_client_hydrogen_path_prefix }}assets/theme-element.json"
], ],
"defaultTheme": { "defaultTheme": {
"light": "element-light", "light": "element-light",


+ 1
- 1
roles/custom/matrix-synapse-admin/defaults/main.yml ファイルの表示

@@ -134,6 +134,6 @@ matrix_synapse_admin_hsts_preload_enabled: false
# The path at which Synapse Admin will be exposed on `matrix.DOMAIN` when matrix-nginx-proxy is used. # The path at which Synapse Admin will be exposed on `matrix.DOMAIN` when matrix-nginx-proxy is used.
# A path of `/` is likely not a good choice when matrix-nginx-proxy is used. # A path of `/` is likely not a good choice when matrix-nginx-proxy is used.
# #
# If Traefik is used, the hostname name is configurable - see `matrix_synapse_admin_container_labels_traefik_hostname`.
# If Traefik is used, the hostname is also configurable - see `matrix_synapse_admin_container_labels_traefik_hostname`.
# This value must either be `/` or not end with a slash (e.g. `/synapse-admin`). # This value must either be `/` or not end with a slash (e.g. `/synapse-admin`).
matrix_synapse_admin_public_endpoint: /synapse-admin matrix_synapse_admin_public_endpoint: /synapse-admin

読み込み中…
キャンセル
保存