Parcourir la source

fiddling around with traefik and labels

pull/3257/head
Yan Minagawa il y a 2 ans
Parent
révision
0111ed509c
2 fichiers modifiés avec 52 ajouts et 4 suppressions
  1. +18
    -3
      roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml
  2. +34
    -1
      roles/custom/matrix-bridge-appservice-polychat/templates/labels.j2

+ 18
- 3
roles/custom/matrix-bridge-appservice-polychat/defaults/main.yml Voir le fichier

@@ -39,8 +39,9 @@ matrix_appservice_polychat_sender_localpart: 'polychat'

# Controls the polychat_PORT and MATRIX_PORT of the installation
matrix_appservice_polychat_appservice_port: 9998
matrix_appservice_polychat_appservice_bind_address: "127.0.0.1"
matrix_appservice_polychat_api_port: 9999
matrix_appservice_polychat_api_bind_address: "0.0.0.0"

# Controls whether the appservice-polychat container exposes its HTTP port (tcp/6789 in the container).
#
@@ -72,6 +73,20 @@ matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints:
matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls: "{{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints != 'web' }}"
matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls_certResolver: "{{ matrix_appservice_polychat_container_labels_traefik_tls_certResolver }}" # noqa var-naming

# 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_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' }}"
matrix_appservice_polychat_container_labels_private_endpoint_traefik_tls_certResolver: "{{ matrix_appservice_polychat_container_labels_traefik_tls_certResolver }}" # noqa var-naming





# matrix_appservice_polychat_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
# See `../templates/labels.j2` for details.
#
@@ -131,10 +146,10 @@ matrix_appservice_polychat_registration_yaml: |
namespaces:
users:
- exclusive: false
regex: '" {{ matrix_appservice_polychat_user_prefix }}*'
regex: "{{ matrix_appservice_polychat_user_prefix }}*"
aliases:
- exclusive: true
regex: '#polychat_*'
regex: "#polychat_*"
url: "{{ matrix_appservice_polychat_appservice_url }}:{{ matrix_appservice_polychat_appservice_port }}"
sender_localpart: "{{ matrix_appservice_polychat_sender_localpart }}"
rate_limited: false


+ 34
- 1
roles/custom/matrix-bridge-appservice-polychat/templates/labels.j2 Voir le fichier

@@ -5,7 +5,8 @@ traefik.enable=true
traefik.docker.network={{ matrix_appservice_polychat_container_labels_traefik_docker_network }}
{% endif %}

traefik.http.services.matrix-appservice-polychat.loadbalancer.server.port={{ matrix_appservice_polychat_appservice_port }}
traefik.http.services.matrix-appservice-polychat-appservice.loadbalancer.server.port={{ matrix_appservice_polychat_appservice_port }}
traefik.http.services.matrix-appservice-polychat-api.loadbalancer.server.port={{ matrix_appservice_polychat_api_port }}

{% if matrix_appservice_polychat_container_labels_public_endpoint_enabled %}
############################################################
@@ -38,6 +39,38 @@ traefik.http.routers.matrix-appservice-polychat-public.tls.certResolver={{ matri
############################################################
{% endif %}

{% if matrix_appservice_polychat_container_labels_private_endpoint_enabled %}
############################################################
# #
# Private #
# #
############################################################

traefik.http.middlewares.matrix-appservice-polychat-private-strip-prefix.stripprefix.prefixes={{ matrix_appservice_polychat_container_labels_private_endpoint_prefix }}

traefik.http.routers.matrix-appservice-polychat-private.rule={{ matrix_appservice_polychat_container_labels_private_endpoint_traefik_rule }}
traefik.http.routers.matrix-appservice-polychat-private.middlewares=matrix-appservice-polychat-private-strip-prefix

{% if matrix_appservice_polychat_container_labels_private_endpoint_traefik_priority | int > 0 %}
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.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 }}
{% if matrix_appservice_polychat_container_labels_private_endpoint_traefik_tls %}
traefik.http.routers.matrix-appservice-polychat-private.tls.certResolver={{ matrix_appservice_polychat_container_labels_private_endpoint_traefik_tls_certResolver }}
{% endif %}

############################################################
# #
# /Private #
# #
############################################################
{% endif %}



{% endif %}



Chargement…
Annuler
Enregistrer