Add native Traefik support to matrix-synapse
This commit is contained in:
176
roles/custom/matrix-synapse/templates/synapse/labels.j2
Normal file
176
roles/custom/matrix-synapse/templates/synapse/labels.j2
Normal file
@ -0,0 +1,176 @@
|
||||
{% if matrix_synapse_container_labels_traefik_enabled %}
|
||||
traefik.enable=true
|
||||
|
||||
{% if matrix_synapse_container_labels_traefik_docker_network %}
|
||||
traefik.docker.network={{ matrix_synapse_container_labels_traefik_docker_network }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.services.matrix-synapse-client-api.loadbalancer.server.port=8008
|
||||
traefik.http.services.matrix-synapse-federation-api.loadbalancer.server.port=8048
|
||||
|
||||
|
||||
{#
|
||||
Root path (/)
|
||||
#}
|
||||
{% if matrix_synapse_container_labels_client_root_enabled %}
|
||||
|
||||
{% set client_root_middlewares = [] %}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_root_redirection_enabled %}
|
||||
{% set client_root_middlewares = client_root_middlewares + ['matrix-synapse-client-root-redirect'] %}
|
||||
traefik.http.middlewares.matrix-synapse-client-root-redirect.redirectregex.regex=(.*)
|
||||
traefik.http.middlewares.matrix-synapse-client-root-redirect.redirectregex.replacement={{ matrix_synapse_container_labels_client_root_redirection_url }}
|
||||
{% else %}
|
||||
{% set client_root_middlewares = client_root_middlewares + ['matrix-synapse-client-root-replacepath'] %}
|
||||
traefik.http.middlewares.matrix-synapse-client-root-replacepath.replacepath.path=/_matrix/static/
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-root.rule={{ matrix_synapse_container_labels_client_root_traefik_rule }}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-root.middlewares={{ client_root_middlewares | join(',') }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_root_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-synapse-client-root.priority={{ matrix_synapse_container_labels_client_root_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-root.service=matrix-synapse-client-api
|
||||
traefik.http.routers.matrix-synapse-client-root.entrypoints={{ matrix_synapse_container_labels_client_root_traefik_entrypoints }}
|
||||
traefik.http.routers.matrix-synapse-client-root.tls={{ matrix_synapse_container_labels_client_root_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_root_traefik_tls %}
|
||||
traefik.http.routers.matrix-synapse-client-root.tls.certResolver={{ matrix_synapse_container_labels_client_root_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Root path (/)
|
||||
#}
|
||||
|
||||
|
||||
{#
|
||||
Client-API (/_matrix)
|
||||
#}
|
||||
{% if matrix_synapse_container_labels_client_api_enabled %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-api.rule={{ matrix_synapse_container_labels_client_api_traefik_rule }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-synapse-client-api.priority={{ matrix_synapse_container_labels_client_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-api.service=matrix-synapse-client-api
|
||||
traefik.http.routers.matrix-synapse-client-api.entrypoints={{ matrix_synapse_container_labels_client_api_traefik_entrypoints }}
|
||||
traefik.http.routers.matrix-synapse-client-api.tls={{ matrix_synapse_container_labels_client_api_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_api_traefik_tls %}
|
||||
traefik.http.routers.matrix-synapse-client-api.tls.certResolver={{ matrix_synapse_container_labels_client_api_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Client-API (/_matrix)
|
||||
#}
|
||||
|
||||
|
||||
{#
|
||||
Synapse Admin API (/_synapse/client)
|
||||
#}
|
||||
{% if matrix_synapse_container_labels_client_synapse_client_api_enabled %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-synapse-client-api.rule={{ matrix_synapse_container_labels_client_synapse_client_api_traefik_rule }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_synapse_client_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-client-api.priority={{ matrix_synapse_container_labels_client_synapse_client_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-synapse-client-api.service=matrix-synapse-client-synapse-client-api
|
||||
traefik.http.routers.matrix-synapse-client-synapse-client-api.entrypoints={{ matrix_synapse_container_labels_client_synapse_client_api_traefik_entrypoints }}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-client-api.tls={{ matrix_synapse_container_labels_client_synapse_client_api_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_synapse_client_api_traefik_tls %}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-client-api.tls.certResolver={{ matrix_synapse_container_labels_client_synapse_client_api_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Synapse Admin API (/_synapse/client)
|
||||
#}
|
||||
|
||||
|
||||
{#
|
||||
Synapse OIDC API (/_synapse/oidc)
|
||||
#}
|
||||
{% if matrix_synapse_container_labels_client_synapse_oidc_api_enabled %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-synapse-oidc-api.rule={{ matrix_synapse_container_labels_client_synapse_oidc_api_traefik_rule }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_synapse_oidc_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-oidc-api.priority={{ matrix_synapse_container_labels_client_synapse_oidc_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-synapse-oidc-api.service=matrix-synapse-client-synapse-oidc-api
|
||||
traefik.http.routers.matrix-synapse-client-synapse-oidc-api.entrypoints={{ matrix_synapse_container_labels_client_synapse_oidc_api_traefik_entrypoints }}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-oidc-api.tls={{ matrix_synapse_container_labels_client_synapse_oidc_api_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_synapse_oidc_api_traefik_tls %}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-oidc-api.tls.certResolver={{ matrix_synapse_container_labels_client_synapse_oidc_api_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Synapse OIDC API (/_synapse/oidc)
|
||||
#}
|
||||
|
||||
|
||||
{#
|
||||
Synapse Admin API (/_synapse/admin)
|
||||
#}
|
||||
{% if matrix_synapse_container_labels_client_synapse_admin_api_enabled %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-synapse-admin-api.rule={{ matrix_synapse_container_labels_client_synapse_admin_api_traefik_rule }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_synapse_admin_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-admin-api.priority={{ matrix_synapse_container_labels_client_synapse_admin_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-client-synapse-admin-api.service=matrix-synapse-client-synapse-admin-api
|
||||
traefik.http.routers.matrix-synapse-client-synapse-admin-api.entrypoints={{ matrix_synapse_container_labels_client_synapse_admin_api_traefik_entrypoints }}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-admin-api.tls={{ matrix_synapse_container_labels_client_synapse_admin_api_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_synapse_container_labels_client_synapse_admin_api_traefik_tls %}
|
||||
traefik.http.routers.matrix-synapse-client-synapse-admin-api.tls.certResolver={{ matrix_synapse_container_labels_client_synapse_admin_api_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Synapse Admin API (/_synapse/admin)
|
||||
#}
|
||||
|
||||
|
||||
{#
|
||||
Federation-API (/_matrix)
|
||||
#}
|
||||
{% if matrix_synapse_container_labels_federation_api_enabled %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-federation-api.rule={{ matrix_synapse_container_labels_federation_api_traefik_rule }}
|
||||
|
||||
{% if matrix_synapse_container_labels_federation_api_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-synapse-federation-api.priority={{ matrix_synapse_container_labels_federation_api_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-synapse-federation-api.service=matrix-synapse-federation-api
|
||||
traefik.http.routers.matrix-synapse-federation-api.entrypoints={{ matrix_synapse_container_labels_federation_api_traefik_entrypoints }}
|
||||
traefik.http.routers.matrix-synapse-federation-api.tls={{ matrix_synapse_container_labels_federation_api_traefik_tls | to_json }}
|
||||
|
||||
{% if matrix_synapse_container_labels_federation_api_traefik_tls %}
|
||||
traefik.http.routers.matrix-synapse-federation-api.tls.certResolver={{ matrix_synapse_container_labels_federation_api_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{#
|
||||
/Federation-API (/_matrix)
|
||||
#}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ matrix_synapse_container_labels_additional_labels }}
|
@ -56,6 +56,7 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||||
{% endif %}
|
||||
--mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \
|
||||
--mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
|
||||
--label-file={{ matrix_synapse_base_path }}/labels \
|
||||
{% for volume in matrix_synapse_container_additional_volumes %}
|
||||
-v {{ volume.src }}:{{ volume.dst }}:{{ volume.options }} \
|
||||
{% endfor %}
|
||||
|
Reference in New Issue
Block a user