From 222dd30e8585fd06a62723e4a9aef714a351500e Mon Sep 17 00:00:00 2001 From: Yan Minagawa Date: Thu, 1 Feb 2024 07:36:42 +0000 Subject: [PATCH] pimp the traefik config. --- .../defaults/main.yml | 15 ++++++++------- .../tasks/validate_config.yml | 3 ++- .../templates/labels.j2 | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml b/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml index 282b8e67d..c4445d222 100644 --- a/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml +++ b/roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml @@ -6,11 +6,12 @@ matrix_appservice_polychat_enabled: true matrix_appservice_polychat_scheme: https matrix_appservice_polychat_hostname: '' -matrix_appservice_polychat_path_prefix: /appservice-polychat +matrix_appservice_polychat_appservice_path_prefix: 'appservice-polychat' +matrix_appservice_polychat_api_path_prefix: '/' matrix_appservice_polychat_container_image_self_build: false matrix_appservice_polychat_container_image_self_build_repo: "https://github.com/polychatproject/polychat-appservice.git" -matrix_appservice_polychat_container_image_self_build_repo_version: "{{ 'master' if matrix_appservice_polychat_version == 'latest' else matrix_appservice_polychat_version }}" +matrix_appservice_polychat_container_image_self_build_repo_version: "{{ 'main' if matrix_appservice_polychat_version == 'latest' else matrix_appservice_polychat_version }}" matrix_appservice_polychat_container_image_self_build_repo_dockerfile_path: "Dockerfile" @@ -31,7 +32,7 @@ matrix_appservice_polychat_data_path: "{{ matrix_appservice_polychat_base_path } matrix_appservice_polychat_docker_src_files_path: "{{ matrix_appservice_polychat_base_path }}/docker-src" # If nginx-proxy is disabled, the bridge itself expects its endpoint to be on its own domain (e.g. "localhost:6789") -matrix_appservice_polychat_public_endpoint: "{{ matrix_appservice_polychat_path_prefix }}" +matrix_appservice_polychat_public_endpoint: "{{ matrix_appservice_polychat_api_path_prefix }}" matrix_appservice_polychat_inbound_uri_prefix: "{{ matrix_appservice_polychat_scheme }}://{{ matrix_appservice_polychat_hostname }}{{ matrix_appservice_polychat_public_endpoint }}" matrix_appservice_polychat_user_prefix: '@polychat_' @@ -66,8 +67,8 @@ matrix_appservice_polychat_container_labels_traefik_tls_certResolver: default # # Controls whether labels will be added that expose matrix-appservice-polychats's public endpoints matrix_appservice_polychat_container_labels_public_endpoint_enabled: true matrix_appservice_polychat_container_labels_public_endpoint_hostname: "{{ matrix_appservice_polychat_hostname }}" -matrix_appservice_polychat_container_labels_public_endpoint_prefix: "{{ matrix_appservice_polychat_path_prefix }}" -matrix_appservice_polychat_container_labels_public_endpoint_traefik_rule: "Host(`{{ matrix_appservice_polychat_container_labels_public_endpoint_hostname }}`) && PathPrefix(`{{ matrix_appservice_polychat_path_prefix }}`)" +matrix_appservice_polychat_container_labels_public_endpoint_prefix: "" +matrix_appservice_polychat_container_labels_public_endpoint_traefik_rule: "Host(`{{ matrix_appservice_polychat_container_labels_public_endpoint_hostname }}`) && PathPrefix(`{{ matrix_appservice_polychat_api_path_prefix }}`)" matrix_appservice_polychat_container_labels_public_endpoint_traefik_priority: 0 matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints: "{{ matrix_appservice_polychat_container_labels_traefik_entrypoints }}" matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls: "{{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints != 'web' }}" @@ -76,8 +77,8 @@ matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls_certReso # Controls whether labels will be added that expose matrix-appservice-polychats's private endpoints matrix_appservice_polychat_container_labels_private_endpoint_enabled: true matrix_appservice_polychat_container_labels_private_endpoint_hostname: "{{ matrix_appservice_polychat_hostname }}" -matrix_appservice_polychat_container_labels_private_endpoint_prefix: "{{ matrix_appservice_polychat_path_prefix }}" -matrix_appservice_polychat_container_labels_private_endpoint_traefik_rule: "Host(`{{ matrix_appservice_polychat_container_labels_private_endpoint_hostname }}`) && PathPrefix(`{{ matrix_appservice_polychat_path_prefix }}`)" +matrix_appservice_polychat_container_labels_private_endpoint_prefix: "{{ matrix_appservice_polychat_appservice_path_prefix }}" +matrix_appservice_polychat_container_labels_private_endpoint_traefik_rule: "Host(`{{ matrix_appservice_polychat_container_labels_private_endpoint_hostname }}`) && PathPrefix(`{{ matrix_appservice_polychat_appservice_path_prefix }}`)" matrix_appservice_polychat_container_labels_private_endpoint_traefik_priority: 0 matrix_appservice_polychat_container_labels_private_endpoint_traefik_entrypoints: "{{ matrix_appservice_polychat_container_labels_traefik_entrypoints }}" matrix_appservice_polychat_container_labels_private_endpoint_traefik_tls: "{{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints != 'web' }}" diff --git a/roles/custom/matrix-bridge-appservice-polychat/tasks/validate_config.yml b/roles/custom/matrix-bridge-appservice-polychat/tasks/validate_config.yml index b62f36b78..8c63df2e8 100644 --- a/roles/custom/matrix-bridge-appservice-polychat/tasks/validate_config.yml +++ b/roles/custom/matrix-bridge-appservice-polychat/tasks/validate_config.yml @@ -12,4 +12,5 @@ - matrix_appservice_polychat_id_token - matrix_appservice_polychat_container_network - matrix_appservice_polychat_hostname - - matrix_appservice_polychat_path_prefix + - matrix_appservice_polychat_appservice_path_prefix + - matrix_appservice_polychat_api_path_prefix \ No newline at end of file diff --git a/roles/custom/matrix-bridge-appservice-polychat/templates/labels.j2 b/roles/custom/matrix-bridge-appservice-polychat/templates/labels.j2 index f75e22fa7..0eb542daf 100644 --- a/roles/custom/matrix-bridge-appservice-polychat/templates/labels.j2 +++ b/roles/custom/matrix-bridge-appservice-polychat/templates/labels.j2 @@ -24,7 +24,7 @@ traefik.http.routers.matrix-appservice-polychat-public.middlewares=matrix-appser traefik.http.routers.matrix-appservice-polychat-public.priority={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_priority }} {% endif %} -traefik.http.routers.matrix-appservice-polychat-public.service=matrix-appservice-polychat +traefik.http.routers.matrix-appservice-polychat-public.service=matrix-appservice-polychat-api traefik.http.routers.matrix-appservice-polychat-public.entrypoints={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints }} traefik.http.routers.matrix-appservice-polychat-public.tls={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls | to_json }} @@ -55,7 +55,7 @@ traefik.http.routers.matrix-appservice-polychat-private.middlewares=matrix-appse traefik.http.routers.matrix-appservice-polychat-private.priority={{ matrix_appservice_polychat_container_labels_private_endpoint_traefik_priority }} {% endif %} -traefik.http.routers.matrix-appservice-polychat-private.service=matrix-appservice-polychat +traefik.http.routers.matrix-appservice-polychat-private.service=matrix-appservice-polychat-appservice traefik.http.routers.matrix-appservice-polychat-private.entrypoints={{ matrix_appservice_polychat_container_labels_private_endpoint_traefik_entrypoints }} traefik.http.routers.matrix-appservice-polychat-private.tls={{ matrix_appservice_polychat_container_labels_private_endpoint_traefik_tls | to_json }} @@ -65,7 +65,7 @@ traefik.http.routers.matrix-appservice-polychat-private.tls.certResolver={{ matr ############################################################ # # -# /Private # +# /Private # # # ############################################################ {% endif %}