From c05dd230c2a5bc50febaee878fc1c6a695c8b9e8 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 6 Dec 2017 18:17:31 +0100 Subject: [PATCH] nginx template: proxy the tomcat manager when requested. See https://support.d4science.org/issues/10597 --- .../defaults/main.yml | 4 ++++ .../generic-smartgears-virtualhost.j2 | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/smartgears/smartgears-nginx-frontend/defaults/main.yml b/smartgears/smartgears-nginx-frontend/defaults/main.yml index 6f1e5b74..56d03969 100644 --- a/smartgears/smartgears-nginx-frontend/defaults/main.yml +++ b/smartgears/smartgears-nginx-frontend/defaults/main.yml @@ -6,4 +6,8 @@ smartgears_install_generic_virthost: True #smartgears_nginx_serveraliases: smartgears_nginx_cors_enabled: False nginx_cors_acl_origin: '' +smartgears_tomcat_manager_exposed: False +smartgears_tomcat_manager_access_acls: + - { policy: 'allow', address: '0.0.0.0/0' } + smartgears_nginx_expose_tomcat_logs: False diff --git a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 index 787a7b65..a1675202 100644 --- a/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 +++ b/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2 @@ -107,6 +107,17 @@ server { proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/data-transfer-service; } {% endif %} + {% if tomcat_m_manager_install or tomcat_m_host_manager_install %} + {% if smartgears_tomcat_manager_exposed %} + location /manager { + {% for acl in smartgears_tomcat_manager_access_acls %} + {{ acl.policy }} {{ acl.address }}; + {% endfor %} + proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/manager; + } + {% endif %} + {% endif %} + {% if remote_opencpu_server is defined and remote_opencpu_server %} location {{ opencpu_context | default('/ocpu') }} { {% if smartgears_nginx_cors_enabled %} @@ -249,6 +260,16 @@ server { proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/data-transfer-service; } {% endif %} + {% if tomcat_m_manager_install or tomcat_m_host_manager_install %} + {% if smartgears_tomcat_manager_exposed %} + location /manager { + {% for acl in smartgears_tomcat_manager_access_acls %} + {{ acl.policy }} {{ acl.address }}; + {% endfor %} + proxy_pass http://127.0.0.1:{{ smartgears_http_port }}/manager; + } + {% endif %} + {% endif %} {% if remote_opencpu_server is defined and remote_opencpu_server %} location {{ opencpu_context | default('/ocpu') }} { {% if smartgears_nginx_cors_enabled %}