Add support for serving the base domain via matrix-static-files
This commit is contained in:
@ -48,7 +48,7 @@ matrix_static_files_container_labels_traefik_docker_network: "{{ matrix_static_f
|
||||
matrix_static_files_container_labels_traefik_entrypoints: web-secure
|
||||
matrix_static_files_container_labels_traefik_tls_certResolver: default
|
||||
|
||||
# Controls whether labels will be added that expose the well-known public endpoint
|
||||
# Controls whether labels will be added that expose the well-known public endpoint on the matrix domain.
|
||||
matrix_static_files_container_labels_well_known_matrix_endpoint_enabled: true
|
||||
matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_hostname: ''
|
||||
matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_path_prefix: /.well-known/matrix
|
||||
@ -58,6 +58,26 @@ matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_entrypoi
|
||||
matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_tls: "{{ matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_entrypoints != 'web' }}"
|
||||
matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_tls_certResolver: "{{ matrix_static_files_container_labels_traefik_tls_certResolver }}" # noqa var-naming
|
||||
|
||||
# Controls whether labels will be added that serve the base domain.
|
||||
#
|
||||
# This is similar to `matrix_static_files_container_labels_well_known_matrix_endpoint_*`, but does more.
|
||||
#
|
||||
# It's useful when you'd like to avoid setting up `/.well-known/matrix` redirects and can afford to point the base domain to the Matrix server.
|
||||
#
|
||||
# By default, these labels are configured to handle all paths for the provided base domain
|
||||
# (see `matrix_static_files_container_labels_base_domain_traefik_path_prefix`), not just the `/.well-known/matrix` prefix.
|
||||
#
|
||||
# By default, an index.html page is also served (see `matrix_static_files_file_index_html_enabled`).
|
||||
matrix_static_files_container_labels_base_domain_enabled: false
|
||||
matrix_static_files_container_labels_base_domain_traefik_hostname: ''
|
||||
matrix_static_files_container_labels_base_domain_traefik_path_prefix: /
|
||||
matrix_static_files_container_labels_base_domain_traefik_rule: "Host(`{{ matrix_static_files_container_labels_base_domain_traefik_hostname }}`){% if matrix_static_files_container_labels_base_domain_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_path_prefix }}`){% endif %}"
|
||||
matrix_static_files_container_labels_base_domain_traefik_priority: 0
|
||||
matrix_static_files_container_labels_base_domain_traefik_entrypoints: "{{ matrix_static_files_container_labels_traefik_entrypoints }}"
|
||||
matrix_static_files_container_labels_base_domain_traefik_tls: "{{ matrix_static_files_container_labels_base_domain_traefik_entrypoints != 'web' }}"
|
||||
matrix_static_files_container_labels_base_domain_traefik_tls_certResolver: "{{ matrix_static_files_container_labels_traefik_tls_certResolver }}" # noqa var-naming
|
||||
|
||||
|
||||
# matrix_static_files_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
|
||||
# See `../templates/labels.j2` for details.
|
||||
#
|
||||
@ -298,6 +318,40 @@ matrix_static_files_file_matrix_support_configuration: "{{ matrix_static_files_f
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# Related to index.html #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
# Controls whether `matrix_static_files_file_index_html_template` would be dumped to an `index.html` file
|
||||
# in the public directory (matrix_static_files_public_path).
|
||||
#
|
||||
# This is useful if you have enabled serving of the base domain (matrix_static_files_container_labels_base_domain_enabled)
|
||||
# and wish to serve more than just the `/.well-known/matrix` files from it.
|
||||
#
|
||||
# You can also use the auxiliary role (https://github.com/mother-of-all-self-hosting/ansible-role-aux) to create files in
|
||||
# the public directory (matrix_static_files_public_path) by yourself.
|
||||
#
|
||||
# Because you may wish to manage these static files yourself, disabling this variable will intentionally not delete an already existing `index.html` file.
|
||||
matrix_static_files_file_index_html_enabled: "{{ matrix_static_files_container_labels_base_domain_enabled }}"
|
||||
|
||||
matrix_static_files_file_index_html_template: |-
|
||||
<!doctype html>
|
||||
<meta charset="utf-8" />
|
||||
<html>
|
||||
<body>
|
||||
Hello from {{ matrix_static_files_container_labels_base_domain_traefik_hostname }}!
|
||||
</body>
|
||||
</html>
|
||||
|
||||
########################################################################
|
||||
# #
|
||||
# /Related to /index.html #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
# Controls whether the self-check feature should validate SSL certificates.
|
||||
matrix_static_files_self_check_validate_certificates: true
|
||||
|
||||
|
@ -33,25 +33,31 @@
|
||||
|
||||
- name: Ensure matrix-static-files files are installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ item.content | to_nice_json }}"
|
||||
content: "{{ item.content }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
when: item.when | bool
|
||||
with_items:
|
||||
- content: "{{ matrix_static_files_file_matrix_client_configuration }}"
|
||||
- content: "{{ matrix_static_files_file_matrix_client_configuration | to_nice_json }}"
|
||||
dest: "{{ matrix_static_files_public_well_known_matrix_path }}/client"
|
||||
when: true
|
||||
|
||||
- content: "{{ matrix_static_files_file_matrix_server_configuration }}"
|
||||
- content: "{{ matrix_static_files_file_matrix_server_configuration | to_nice_json }}"
|
||||
dest: "{{ matrix_static_files_public_well_known_matrix_path }}/server"
|
||||
when: "{{ matrix_static_files_file_matrix_server_enabled }}"
|
||||
|
||||
- content: "{{ matrix_static_files_file_matrix_support_configuration }}"
|
||||
- content: "{{ matrix_static_files_file_matrix_support_configuration | to_nice_json }}"
|
||||
dest: "{{ matrix_static_files_public_well_known_matrix_path }}/support"
|
||||
when: "{{ matrix_static_files_file_matrix_support_enabled }}"
|
||||
|
||||
# This one will not be deleted if `matrix_static_files_file_index_html_enabled` flips to `false`.
|
||||
# See the comment for `matrix_static_files_file_index_html_enabled` to learn why.
|
||||
- content: "{{ matrix_static_files_file_index_html_template }}"
|
||||
dest: "{{ matrix_static_files_public_path }}/index.html"
|
||||
when: "{{ matrix_static_files_file_index_html_enabled }}"
|
||||
|
||||
- name: Ensure /.well-known/matrix/server file deleted if not enabled
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_static_files_public_well_known_matrix_path }}/server"
|
||||
|
@ -9,3 +9,6 @@
|
||||
- {'name': 'matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_hostname', when: "{{ matrix_static_files_container_labels_well_known_matrix_endpoint_enabled }}"}
|
||||
- {'name': 'matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_path_prefix', when: "{{ matrix_static_files_container_labels_well_known_matrix_endpoint_enabled }}"}
|
||||
|
||||
- {'name': 'matrix_static_files_container_labels_base_domain_traefik_hostname', when: "{{ matrix_static_files_container_labels_base_domain_enabled }}"}
|
||||
- {'name': 'matrix_static_files_container_labels_base_domain_traefik_path_prefix', when: "{{ matrix_static_files_container_labels_base_domain_enabled }}"}
|
||||
|
||||
|
@ -9,7 +9,7 @@ traefik.http.services.{{ matrix_static_files_ident }}.loadbalancer.server.port={
|
||||
|
||||
|
||||
{#
|
||||
Related to /.well-known/matrix
|
||||
Related to /.well-known/matrix on the matrix domain
|
||||
#}
|
||||
{% if matrix_static_files_container_labels_well_known_matrix_endpoint_enabled %}
|
||||
|
||||
@ -33,10 +33,33 @@ traefik.http.routers.{{ matrix_static_files_ident }}-well-known-endpoint.tls.cer
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Related to /.well-known/matrix
|
||||
/Related to /.well-known/matrix on the matrix domain
|
||||
#}
|
||||
|
||||
|
||||
{#
|
||||
Base domain serving
|
||||
#}
|
||||
{% if matrix_static_files_container_labels_base_domain_enabled %}
|
||||
traefik.http.routers.{{ matrix_static_files_ident }}-base-domain.rule={{ matrix_static_files_container_labels_base_domain_traefik_rule }}
|
||||
|
||||
{% if matrix_static_files_container_labels_base_domain_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.{{ matrix_static_files_ident }}-base-domain.priority={{ matrix_static_files_container_labels_base_domain_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.{{ matrix_static_files_ident }}-base-domain.service={{ matrix_static_files_ident }}
|
||||
traefik.http.routers.{{ matrix_static_files_ident }}-base-domain.entrypoints={{ matrix_static_files_container_labels_base_domain_traefik_entrypoints }}
|
||||
traefik.http.routers.{{ matrix_static_files_ident }}-base-domain.tls={{ matrix_static_files_container_labels_base_domain_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_static_files_container_labels_base_domain_traefik_tls %}
|
||||
traefik.http.routers.{{ matrix_static_files_ident }}-base-domain.tls.certResolver={{ matrix_static_files_container_labels_base_domain_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Base domain serving
|
||||
#}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ matrix_static_files_container_labels_additional_labels }}
|
||||
|
Reference in New Issue
Block a user