Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Commit da47a52

Browse files
author
Riccardo Capecchi
committed
Extended instance manifest with 2 new options to give custom parameters to the http and ajp connector, add also an example for a server.xml template to be used with these options
1 parent 2e82860 commit da47a52

File tree

2 files changed

+153
-0
lines changed

2 files changed

+153
-0
lines changed

manifests/instance.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
$create_instance_cmd_template = '',
3636
$create_instance_cmd_exec = '',
3737
$server_xml_template = '',
38+
$http_connector_options = '',
39+
$ajp_connector_options = '',
3840
$context_xml_template = '',
3941
$tomcat_users_xml_template = '',
4042
$web_xml_template = '',

templates/server.xml.erb

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<!-- File Managed by Puppet! -->
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one or more
5+
contributor license agreements. See the NOTICE file distributed with
6+
this work for additional information regarding copyright ownership.
7+
The ASF licenses this file to You under the Apache License, Version 2.0
8+
(the "License"); you may not use this file except in compliance with
9+
the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
-->
19+
<!-- Note: A "Server" is not itself a "Container", so you may not
20+
define subcomponents such as "Valves" at this level.
21+
Documentation at /docs/config/server.html
22+
-->
23+
<Server port="<%= @control_port %>" shutdown="SHUTDOWN">
24+
<!-- Security listener. Documentation at /docs/config/listeners.html
25+
<Listener className="org.apache.catalina.security.SecurityListener" />
26+
-->
27+
<!--APR library loader. Documentation at /docs/apr.html -->
28+
<!--
29+
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
30+
-->
31+
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
32+
<Listener className="org.apache.catalina.core.JasperListener" />
33+
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
34+
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
35+
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
36+
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
37+
38+
<!-- Global JNDI resources
39+
Documentation at /docs/jndi-resources-howto.html
40+
-->
41+
<GlobalNamingResources>
42+
<!-- Editable user database that can also be used by
43+
UserDatabaseRealm to authenticate users
44+
-->
45+
<Resource name="UserDatabase" auth="Container"
46+
type="org.apache.catalina.UserDatabase"
47+
description="User database that can be updated and saved"
48+
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
49+
pathname="conf/tomcat-users.xml" digest="MD5" />
50+
</GlobalNamingResources>
51+
52+
<!-- A "Service" is a collection of one or more "Connectors" that share
53+
a single "Container" Note: A "Service" is not itself a "Container",
54+
so you may not define subcomponents such as "Valves" at this level.
55+
Documentation at /docs/config/service.html
56+
-->
57+
<Service name="Catalina">
58+
59+
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
60+
<!--
61+
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
62+
maxThreads="150" minSpareThreads="4"/>
63+
-->
64+
65+
66+
<!-- A "Connector" represents an endpoint by which requests are received
67+
and responses are returned. Documentation at :
68+
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
69+
Java AJP Connector: /docs/config/ajp.html
70+
APR (HTTP/AJP) Connector: /docs/apr.html
71+
Define a non-SSL HTTP/1.1 Connector on port 8080
72+
-->
73+
<Connector port="<%= @http_port %>" protocol="HTTP/1.1"
74+
<%- if @http_connector_options.is_a?(Hash) -%>
75+
<%- @http.each do |key,value| -%>
76+
<%= key %>="<%= value %>"
77+
<%- end -%>
78+
<%- end -%>
79+
redirectPort="8443" />
80+
<!-- A "Connector" using the shared thread pool-->
81+
<!--
82+
<Connector executor="tomcatThreadPool"
83+
port="8080" protocol="HTTP/1.1"
84+
connectionTimeout="20000"
85+
redirectPort="8443" />
86+
-->
87+
<!-- Define a SSL HTTP/1.1 Connector on port 8443
88+
This connector uses the JSSE configuration, when using APR, the
89+
connector should be using the OpenSSL style configuration
90+
described in the APR documentation -->
91+
<!--
92+
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
93+
maxThreads="150" scheme="https" secure="true"
94+
clientAuth="false" sslProtocol="TLS" />
95+
-->
96+
97+
<!-- Define an AJP 1.3 Connector on port 8009 -->
98+
<Connector port="<%= @ajp_port %>"
99+
<%- if @ajp_connector_options.is_a?(Hash) -%>
100+
<%- @ajp_connector_options.each do |key,value| -%>
101+
<%= key %>="<%= value %>"
102+
<%- end -%>
103+
<%- end -%>
104+
protocol="AJP/1.3" redirectPort="8443" />
105+
106+
<!-- An Engine represents the entry point (within Catalina) that processes
107+
every request. The Engine implementation for Tomcat stand alone
108+
analyzes the HTTP headers included with the request, and passes them
109+
on to the appropriate Host (virtual host).
110+
Documentation at /docs/config/engine.html -->
111+
112+
<Engine name="Catalina" defaultHost="localhost" jvmRoute="<%= @instance_name %>">
113+
114+
<!--For clustering, please take a look at documentation at:
115+
/docs/cluster-howto.html (simple how to)
116+
/docs/config/cluster.html (reference documentation) -->
117+
<!--
118+
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
119+
-->
120+
121+
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
122+
via a brute-force attack -->
123+
<Realm className="org.apache.catalina.realm.LockOutRealm">
124+
<!-- This Realm uses the UserDatabase configured in the global JNDI
125+
resources under the key "UserDatabase". Any edits
126+
that are performed against this UserDatabase are immediately
127+
available for use by the Realm. -->
128+
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
129+
resourceName="UserDatabase" digest="MD5"/>
130+
</Realm>
131+
132+
<Host name="localhost" appBase="webapps"
133+
unpackWARs="true" autoDeploy="true">
134+
135+
<!-- SingleSignOn valve, share authentication between web applications
136+
Documentation at: /docs/config/valve.html -->
137+
<!--
138+
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
139+
-->
140+
141+
<!-- Access log processes all example.
142+
Documentation at: /docs/config/valve.html
143+
Note: The pattern used is equivalent to using pattern="common" -->
144+
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
145+
prefix="localhost_access_log." suffix=".txt"
146+
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
147+
148+
</Host>
149+
</Engine>
150+
</Service>
151+
</Server>

0 commit comments

Comments
 (0)