Move matrix-bridge-appservice-webhooks to its own container network

This commit is contained in:
Slavi Pantaleev
2024-01-07 12:48:30 +02:00
parent 5f329f72ab
commit a5618a893b
8 changed files with 150 additions and 87 deletions

View File

@ -0,0 +1,36 @@
{% if matrix_appservice_webhooks_container_labels_traefik_enabled %}
traefik.enable=true
{% if matrix_appservice_webhooks_container_labels_traefik_docker_network %}
traefik.docker.network={{ matrix_appservice_webhooks_container_labels_traefik_docker_network }}
{% endif %}
{#
Start of public
#}
{% if matrix_appservice_webhooks_container_labels_public_endpoint_enabled %}
traefik.http.middlewares.matrix-appservice-webhooks-public-strip-prefix.stripprefix.prefixes={{ matrix_appservice_webhooks_container_labels_public_endpoint_prefix }}
traefik.http.routers.matrix-appservice-webhooks-public-endpoint.rule={{ matrix_appservice_webhooks_container_labels_public_endpoint_traefik_rule }}
traefik.http.routers.matrix-appservice-webhooks-public-endpoint.middlewares=matrix-appservice-webhooks-public-strip-prefix
{% if matrix_appservice_webhooks_container_labels_public_endpoint_traefik_priority | int > 0 %}
traefik.http.routers.matrix-appservice-webhooks-public-endpoint.priority={{ matrix_appservice_webhooks_container_labels_public_endpoint_traefik_priority }}
{% endif %}
traefik.http.routers.matrix-appservice-webhooks-public-endpoint.service=matrix-appservice-webhooks
traefik.http.routers.matrix-appservice-webhooks-public-endpoint.entrypoints={{ matrix_appservice_webhooks_container_labels_public_endpoint_traefik_entrypoints }}
traefik.http.routers.matrix-appservice-webhooks-public-endpoint.tls={{ matrix_appservice_webhooks_container_labels_public_endpoint_traefik_tls | to_json }}
{% if matrix_appservice_webhooks_container_labels_public_endpoint_traefik_tls %}
traefik.http.routers.matrix-appservice-webhooks-public-endpoint.tls.certResolver={{ matrix_appservice_webhooks_container_labels_public_endpoint_traefik_tls_certResolver }}
{% endif %}
traefik.http.services.matrix-appservice-webhooks.loadbalancer.server.port={{ matrix_appservice_webhooks_matrix_port }}
{% endif %}
{#
/End of public
#}
{% endif %}
{{ matrix_appservice_webhooks_container_labels_additional_labels }}

View File

@ -19,7 +19,9 @@ ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_s
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
ExecStartPre={{ matrix_host_command_sleep }} 5
ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-appservice-webhooks \
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name=matrix-appservice-webhooks \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
@ -27,14 +29,21 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name
{% if matrix_appservice_webhooks_container_http_host_bind_port %}
-p {{ matrix_appservice_webhooks_container_http_host_bind_port }}:{{matrix_appservice_webhooks_matrix_port}} \
{% endif %}
-v {{ matrix_appservice_webhooks_config_path }}:/config:z \
-v {{ matrix_appservice_webhooks_data_path }}:/data:z \
--mount type=bind,src={{ matrix_appservice_webhooks_config_path }},dst=/config \
--mount type=bind,src={{ matrix_appservice_webhooks_data_path }},dst=/data \
--label-file={{ matrix_appservice_slack_base_path }}/labels \
{% for arg in matrix_appservice_webhooks_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ matrix_appservice_webhooks_docker_image }} \
node index.js -p {{ matrix_appservice_webhooks_matrix_port }} -c /config/config.yaml -f /config/webhooks-registration.yaml
{% for network in matrix_appservice_webhooks_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-appservice-webhooks
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-appservice-webhooks
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-appservice-webhooks 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-appservice-webhooks 2>/dev/null || true'
Restart=always