Skip to content

Commit

Permalink
Added tomcat tunables and reverse ssl proxy support
Browse files Browse the repository at this point in the history
* jira::tomcatMaxThreads
* jira::tomcatAcceptCount
* jira::proxy

See readme and jira.yaml for more information
  • Loading branch information
mkrakowitzer committed Mar 5, 2014
1 parent aa99875 commit 1f0a2ef
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ and extract it into /opt/jira/atlassian-jira-$version
This module requires: https://github.com/mkrakowitzer/puppet-deploy.git

An example on how to use this module:

```puppet
class { 'jira':
version => '6.0.1',
installdir => '/opt/atlassian-jira',
Expand All @@ -67,9 +67,18 @@ An example on how to use this module:
javahome => '/opt/java/jdk1.7.0_21/',
downloadURL => 'http://myserver/pub/development-tools/atlassian/',
}

```
If you would prefer to use Hiera then see jira.yaml file for an example.

Reverse proxy can be configured as a hash as part of the jira resource
```puppet
proxy => {
scheme => 'https',
proxyName => 'www.example.com',
proxyPort => '443',
},
```

### Fixes and Future Work
Please feel free to raise any issues here for fixes. I'm happy to fix them
up. Also feel free to make a pull request for anything so I can hopefully
Expand Down
9 changes: 9 additions & 0 deletions jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,12 @@ jira::downloadURL: "http://www.atlassian.com/software/jira/downloads/binary/"
# Boolean dictating if puppet should manage the service
jira::manage_service: true

# Tomcat settings
jira::tomcatMaxThreads: '150'
jira::tomcatAcceptCount: '100'

# Configure reverse ssl proxy
jira::proxy:
scheme: 'https'
proxyName: 'www.exmaple.co.za'
proxyPort: '443'
7 changes: 7 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@
notify => Class['jira::service'],
}

file { "${jira::webappdir}/conf/server.xml":
content => template("jira/server.xml.erb"),
mode => '0600',
require => Class['jira::install'],
notify => Class['jira::service'],
}

}
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
# Manage service
$manage_service = true,

# Tomcat Tunables
$tomcatMaxThreads = '150',
$tomcatAcceptCount = '100',
# Reverse https proxy
$proxy = {},

) {

$webappdir = "${installdir}/atlassian-${product}-${version}-standalone"
Expand Down
174 changes: 174 additions & 0 deletions templates/server.xml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
====================================================================================
Atlassian JIRA Standalone Edition Tomcat Configuration.
See the following for more information
http://confluence.atlassian.com/display/JIRA/Configuring+JIRA+Standalone
====================================================================================
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Server port="8005" shutdown="SHUTDOWN">

<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>

<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->

<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">

<Connector port="8080"

maxThreads="<%= scope.lookupvar('jira::tomcatMaxThreads') %>"
minSpareThreads="25"
connectionTimeout="20000"

enableLookups="false"
maxHttpHeaderSize="8192"
protocol="HTTP/1.1"
useBodyEncodingForURI="true"
redirectPort="8443"
acceptCount="<%= scope.lookupvar('jira::tomcatAcceptCount') %>"
disableUploadTimeout="true"
<% if @proxy -%>
<% @proxy.sort.each do |key,value| -%>
<%= key %> = <%= "\'#{value}\'" %>
<% end -%>
<% end -%>
/>

<!--
====================================================================================
To run JIRA via HTTPS:
* Uncomment the Connector below
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and the keystore itself.
* If you are on JDK1.3 or earlier, download and install JSSE 1.0.2 or later, and put the JAR files into
"$JAVA_HOME/jre/lib/ext"
* Restart and visit https://localhost:8443/
For more info, see :
http://confluence.atlassian.com/display/JIRA/Running+JIRA+over+SSL+or+HTTPS
and
http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html
====================================================================================
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxHttpHeaderSize="8192" SSLEnabled="true"
maxThreads="150" minSpareThreads="25"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" useBodyEncodingForURI="true"/>
-->


<!--
====================================================================================
If you have Apache AJP Connector (mod_ajp) as a proxy in front of JIRA you should uncomment the following connector configuration line
See the following for more information :
http://confluence.atlassian.com/display/JIRA/Configuring+Apache+Reverse+Proxy+Using+the+AJP+Protocol
====================================================================================
-->

<!--
<Connector port="8009" redirectPort="8443" enableLookups="false" protocol="AJP/1.3" URIEncoding="UTF-8"/>
-->

<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">

<Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">


<!--
====================================================================================
Note, you no longer configure your database driver or connection parameters here.
These are configured through the UI during application setup.
====================================================================================
-->

<Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
<Manager pathname=""/>
</Context>

</Host>

<!--
====================================================================================
Access Logging.
This should produce access_log.<date> files in the 'logs' directory.
The output access log lies has the following fields :
IP Request_Id User Timestamp "HTTP_Method URL Protocol_Version" HTTP_Status_Code ResponseSize_in_Bytes RequestTime_In_Millis Referer User_Agent ASESSIONID
eg :
192.168.3.238 1243466536012x12x1 admin [28/May/2009:09:22:17 +1000] "GET /jira/secure/admin/jira/IndexProgress.jspa?taskId=1 HTTP/1.1" 200 24267 1070 "http://carltondraught.sydney.atlassian.com:8090/jira/secure/admin/jira/IndexAdmin.jspa" "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10" "C2C99B632EE0F41E90F8EF7A201F6A78"
NOTES:
The RequestId is a millis_since_epoch plus request number plus number of concurrent users
The Request time is in milliseconds
The ASESSIONID is an hash of the JSESSIONID and hence is safe to publish within logs. A session cannot be reconstructed from it.
See http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html for more information on Tomcat Access Log Valves
====================================================================================
-->
<Valve className="org.apache.catalina.valves.AccessLogValve" resolveHosts="false"
pattern="%a %{jira.request.id}r %{jira.request.username}r %t &quot;%m %U%q %H&quot; %s %b %D &quot;%{Referer}i&quot; &quot;%{User-Agent}i&quot; &quot;%{jira.request.assession.id}r&quot;"/>

</Engine>
</Service>
</Server>

0 comments on commit 1f0a2ef

Please sign in to comment.