From 861806eafd70cf72245f6e8592064fce7ff5d636 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico <adellam@isti.cnr.it> Date: Wed, 22 Nov 2017 17:48:35 +0100 Subject: [PATCH] tomcat: Add new variables to server.xml. See https://support.d4science.org/issues/10153. --- tomcat/defaults/main.yml | 5 +++++ tomcat/templates/tomcat-server.xml.j2 | 24 +++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tomcat/defaults/main.yml b/tomcat/defaults/main.yml index 8f89f17..1c1801e 100644 --- a/tomcat/defaults/main.yml +++ b/tomcat/defaults/main.yml @@ -9,6 +9,7 @@ tomcat_pkgs: - libapr1 tomcat_user: tomcat7 tomcat_max_threads: 200 + tomcat_min_heap_size: 2048m tomcat_permgen_defined: True tomcat_heap_size: '{{ tomcat_min_heap_size }}' @@ -29,6 +30,10 @@ tomcat_ajp_enabled: False tomcat_ajp_port: 8009 tomcat_ajp_address: 127.0.0.1 tomcat_direct_access: False +tomcat_reverse_proxy_name_enabled: False +tomcat_reverse_proxy_name: '{{ ansible_fqdn }}' +tomcat_reverse_proxy_port: '{{ http_port | default(80) }}' +proxyName and proxyPort # There is a bug that kills tomcat after 50 days if the shutdown port is enabled # Disable the shutdown port by default #tomcat_shutdown_port: 8005 diff --git a/tomcat/templates/tomcat-server.xml.j2 b/tomcat/templates/tomcat-server.xml.j2 index 7007299..d64761b 100644 --- a/tomcat/templates/tomcat-server.xml.j2 +++ b/tomcat/templates/tomcat-server.xml.j2 @@ -62,8 +62,11 @@ {% if tomcat_http_enabled %} <!--The connectors can use a shared executor, you can define one or more named thread pools--> - <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" - maxThreads="{{ tomcat_max_threads }}" minSpareThreads="10"/> + <Executor name="tomcatThreadPool" + namePrefix="catalina-exec-" + maxQueueSize="{{ tomcat_max_queue_size | default(32767) }}" + maxThreads="{{ tomcat_max_threads }}" + minSpareThreads="10"/> {% endif %} <!-- A "Connector" represents an endpoint by which requests are received @@ -76,11 +79,16 @@ {% if tomcat_http_enabled %} <!-- A http "Connector" using the shared thread pool--> <Connector executor="tomcatThreadPool" - enableLookups="false" maxPostSize="{{ tomcat_max_post_size }}" + enableLookups="false" + maxQueueSize="{{ tomcat_max_queue_size | default(32767) }}" maxThreads="{{ tomcat_max_threads }}" connectionTimeout="60000" URIEncoding="UTF-8" bindOnInit="false" address="{{ tomcat_http_address }}" port="{{ tomcat_http_port }}" protocol="HTTP/1.1" maxPostSize="{{ tomcat_max_post_size | default(104857600) }}" + {% if tomcat_reverse_proxy_name_enabled %} + proxyName="{{ tomcat_reverse_proxy_name }}" + proxyPort="{{ tomcat_reverse_proxy_port }}" + {% endif %} redirectPort="8443" /> <!-- Define a SSL HTTP/1.1 Connector on port 8443 @@ -96,9 +104,15 @@ {% if tomcat_ajp_enabled %} <!-- Define an AJP 1.3 Connector on port {{ tomcat_ajp_port }} --> <Connector port="{{ tomcat_ajp_port }}" protocol="AJP/1.3" redirectPort="8443" - enableLookups="false" address="{{ tomcat_ajp_address }}" maxPostSize="{{ tomcat_max_post_size }}" - maxThreads="{{ tomcat_max_threads }}" connectionTimeout="60000" + enableLookups="false" address="{{ tomcat_ajp_address }}" + maxQueueSize="{{ tomcat_max_queue_size | default(32767) }}" + maxThreads="{{ tomcat_max_threads }}" + connectionTimeout="60000" maxPostSize="{{ tomcat_max_post_size | default(104857600) }}" + {% if tomcat_reverse_proxy_name_enabled %} + proxyName="{{ tomcat_reverse_proxy_name }}" + proxyPort="{{ tomcat_reverse_proxy_port }}" + {% endif %} URIEncoding="UTF-8" bindOnInit="false" /> {% endif %}