From f2a2cad107e5514915c90382ccc68472128e1726 Mon Sep 17 00:00:00 2001 From: paulbdavis Date: Fri, 1 Mar 2019 14:01:46 -0700 Subject: [PATCH 1/2] allow exposing mautrix_telegram port --- roles/matrix-synapse/defaults/main.yml | 3 ++- .../systemd/matrix-mautrix-telegram.service.j2 | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index fd320ab48..1073c2e1f 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -209,7 +209,8 @@ matrix_mautrix_telegram_api_hash: YOUR_TELEGRAM_API_HASH # Mautrix telegram public endpoint to log in to telegram # Use an uuid so it's not easily discoverable matrix_mautrix_telegram_public_endpoint: "/{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'telegram') | to_uuid }}" - +# Set this to a port number to expose on the host when not using the nginx proxy +matrix_mautrix_telegram_container_expose_port: false # Matrix mautrix is a Matrix <-> Whatsapp bridge # Enable whatsapp bridge diff --git a/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 b/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 index 7e965804c..d46cbc50b 100644 --- a/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 +++ b/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 @@ -21,6 +21,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-telegram \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ --network={{ matrix_docker_network }} \ + {% if matrix_mautrix_telegram_container_expose_port %} + -p 127.0.0.1:{{ matrix_mautrix_telegram_container_expose_port }}:8080 \ + {% endif %} -v {{ matrix_mautrix_telegram_base_path }}:/data:z \ {{ matrix_mautrix_telegram_docker_image }} \ python3 -m mautrix_telegram -c /data/config.yaml From 17e86ba8178eccbd9cf88b0ae67b7ad944e15c37 Mon Sep 17 00:00:00 2001 From: paulbdavis Date: Thu, 7 Mar 2019 12:45:58 -0700 Subject: [PATCH 2/2] implement requested changes --- roles/matrix-synapse/defaults/main.yml | 2 +- .../systemd/matrix-mautrix-telegram.service.j2 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index 1073c2e1f..f3acef66a 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -210,7 +210,7 @@ matrix_mautrix_telegram_api_hash: YOUR_TELEGRAM_API_HASH # Use an uuid so it's not easily discoverable matrix_mautrix_telegram_public_endpoint: "/{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'telegram') | to_uuid }}" # Set this to a port number to expose on the host when not using the nginx proxy -matrix_mautrix_telegram_container_expose_port: false +matrix_mautrix_telegram_container_exposed_port_number: ~ # Matrix mautrix is a Matrix <-> Whatsapp bridge # Enable whatsapp bridge diff --git a/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 b/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 index d46cbc50b..54d0d84f0 100644 --- a/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 +++ b/roles/matrix-synapse/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 @@ -21,8 +21,8 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-telegram \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ --network={{ matrix_docker_network }} \ - {% if matrix_mautrix_telegram_container_expose_port %} - -p 127.0.0.1:{{ matrix_mautrix_telegram_container_expose_port }}:8080 \ + {% if matrix_mautrix_telegram_container_exposed_port_number is not none %} + -p 127.0.0.1:{{ matrix_mautrix_telegram_container_exposed_port_number }}:8080 \ {% endif %} -v {{ matrix_mautrix_telegram_base_path }}:/data:z \ {{ matrix_mautrix_telegram_docker_image }} \