From 20c6bd686e5200d5a6b42b6d24b7edde385861e3 Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Fri, 12 Mar 2021 11:10:00 +0100 Subject: [PATCH] Added the matrix_bot_go_neb_container_http_host_bind_port variable to allow the container to expose its listen port --- group_vars/matrix_servers | 2 ++ roles/matrix-bot-go-neb/defaults/main.yml | 5 +++++ .../templates/systemd/matrix-bot-go-neb.service.j2 | 3 +++ 3 files changed, 10 insertions(+) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 88e16d2a..a40c83ad 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -743,6 +743,8 @@ matrix_bot_go_neb_systemd_required_services_list: | ['docker.service'] }} +matrix_bot_go_neb_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:4050' }}" + ###################################################################### # # /matrix-bot-go-neb diff --git a/roles/matrix-bot-go-neb/defaults/main.yml b/roles/matrix-bot-go-neb/defaults/main.yml index a448c2c5..0a934811 100644 --- a/roles/matrix-bot-go-neb/defaults/main.yml +++ b/roles/matrix-bot-go-neb/defaults/main.yml @@ -12,6 +12,11 @@ matrix_bot_go_neb_config_path_in_container: "/config/config.yaml" matrix_bot_go_neb_data_path: "{{ matrix_bot_go_neb_base_path }}/data" matrix_bot_go_neb_data_store_path: "{{ matrix_bot_go_neb_data_path }}/store" +# Controls whether the matrix-bot-go-neb container exposes its HTTP port (tcp/4050 in the container). +# +# Takes an ":" or "" value (e.g. "127.0.0.1:4050"), or empty string to not expose. +matrix_bot_go_neb_container_http_host_bind_port: '' + # A list of extra arguments to pass to the container matrix_bot_go_neb_container_extra_arguments: [] diff --git a/roles/matrix-bot-go-neb/templates/systemd/matrix-bot-go-neb.service.j2 b/roles/matrix-bot-go-neb/templates/systemd/matrix-bot-go-neb.service.j2 index 27cfcdcc..cb529848 100644 --- a/roles/matrix-bot-go-neb/templates/systemd/matrix-bot-go-neb.service.j2 +++ b/roles/matrix-bot-go-neb/templates/systemd/matrix-bot-go-neb.service.j2 @@ -22,6 +22,9 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-bot-go-neb \ --cap-drop=ALL \ --read-only \ --network={{ matrix_docker_network }} \ + {% if matrix_bot_go_neb_container_http_host_bind_port %} + -p {{ matrix_bot_go_neb_container_http_host_bind_port }}:4050 \ + {% endif %} -e 'BIND_ADDRESS=:4050' \ -e 'DATABASE_TYPE={{ matrix_bot_go_neb_database_engine }}' \ -e 'BASE_URL=https://{{ matrix_server_fqn_bot_go_neb }}' \