Bamboo integrated into Apache (SSL) using jetty.xml and wrapper.exe
Asked by lance_lyons:

Hi, We are trying to get bamboo to integrate in behind Apache using mod_proxy similar to how we did this for Jira and Confluence.

We updated our wrapper.conf and jetty.xml according to the confluence doc

<http://confluence.atlassian.com/display/BAMBOO/Getting+Bamboo+Standalone+to+use+the+jetty.xml+file>

Here are the parts of the wrapper.conf (used to run under <http://machinename:8084>)

# commenting out the parameter below to use the jetty.xml file instead llyons  
# discussed in <http://confluence.atlassian.com/display/BAMBOO/Getting+Bamboo+Standalone+to+use+the+jetty.xml+file>

<br />

#wrapper.app.parameter.2=8084  
wrapper.app.parameter.2=../webapp/WEB-INF/classes/jetty.xml  

# The location of the Bamboo web application files  
#  
# commenting out the parameter below to use the jetty.xml file instead llyons  
#wrapper.app.parameter.3=../webapp  

# The webapp context path. Which must be of form / or /your-context  
#  
# commenting out the parameter below to use the jetty.xml file instead llyons  
#wrapper.app.parameter.4=/

Here is our Jetty.xml (at least the important parts)

\<Call name="addConnector"\>  
\<Arg\>  
\<New class="org.eclipse.jetty.server.nio.SelectChannelConnector"\>  
\<Set name="host"\>\<Property name="jetty.host" /\>\</Set\>  
\<Set name="port"\>\<Property name="jetty.port" default="8084"/\>\</Set\>  
\<!--\<Set name="Host"\>127.0.0.1\</Set\>--\>  
\<!--\<Set name="ConfidentialPort"\>8443\</Set\>--\>  
\<!--\<Set name="IntegralPort"\>8443\</Set\>--\>  
\</New\>  
\</Arg\>  
\</Call\>

\<Call name="setHandler"\>  
\<Arg\>  
\<New class="org.eclipse.jetty.webapp.WebAppContext"\>  
\<Arg name="webApp"\>  
\<!--SystemProperty name="bamboo.webapp" default="/opt/dev/src/atlassian/bamboo-trunk/components/bamboo-web-app/src/main/webapp"/--\>  
\<SystemProperty name="bamboo.webapp" default="./webapp"/\>  
\</Arg\>  
\<Arg name="contextPath"\>/bamboo\</Arg\>  
\<!--\<Set name="parentLoaderPriority"\>true\</Set\>--\>  
\<Set name="defaultsDescriptor"\>webdefault.xml\</Set\>  
\<Get name="sessionHandler"\>  
\<Set name="sessionManager"\>  
\<New class="org.eclipse.jetty.server.session.HashSessionManager"\>  
\<Set name="httpOnly"\>true\</Set\> \<!-- use M$ http only cookies? --\>  
\</New\>  
\</Set\>  
\</Get\>  
\</New\>  
\</Arg\>  
\</Call\>

and for the AJP connector

\<Call name="addConnector"\>  
\<Arg\>  
\<New class="org.eclipse.jetty.ajp.Ajp13SocketConnector"\>  
\<Set name="port"\>8029\</Set\>  
\</New\>  
\</Arg\>  
\</Call\>

From the apache site configuration.

\<VirtualHost \*:80\>  
ServerName bamboo.onlifehealth.com  
Redirect / <https://bamboo.onlifehealth.com/>

<br />

\</VirtualHost\>

and

\<VirtualHost \*:443\>  
ServerName bamboo.onlifehealth.com  

ProxyRequests Off  
ProxyPreserveHost On  
\<Proxy \*\>  
Order deny,allow  
Allow from all  
\</Proxy\>  

SSLEngine On  
SSLCertificateFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/ssl/bamboo.cert"  
SSLCertificateKeyFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/ssl/bamboo.key"  

ProxyPass / ajp://corp-jiraweb:8029/  
ProxyPassReverse / ajp://corp-jiraweb:8029/  
\<Location /\>  
Order allow,deny  
Allow from all  
\</Location\>  
\</VirtualHost\>

I have the AJP addConnector commented out in the jetty.xml just to verify that <http://machinename:8084> still works but it does not.

I get

HTTP ERROR: 503 {#toc-hId-1648514588}
-------------------------------------

Problem accessing /. Reason:

```
    Service Unavailable
```

*** ** * ** ***

*\<small\>Powered by Jetty://\</small\>*

We are using the following Jetty jar file jetty-ajp-6.1.15.jar which DOES not match the version we have in the lib folder for the other jetty files (jetty-jndi-7.2.1.v20101111.jar, etc)

I cant find any log files in the either of the log file folders (bamboo-home\\logs) or \\program files\\bamboo\\logs

We used

Any thoughts or things I should look at?

Thanks

Lance


Answers:
author: Przemek Bruski
body: AJP support in Jetty is quirky and the problem you have is open in Jetty bug tracker for quite a while. If you can, stay away from AJP protocol and connect your two servers via HTTP. If you need to use AJP, please contact our support at [support.atlassian.com](http://support.atlassian.com) , we will conduct a more thorough investigation.


author: Przemek Bruski
body: Please use the AJP JAR for Jetty 7 attached to this page: [http://confluence.atlassian.com/display/BAMKB/Enable+AJP+Support+in+Bamboo+2.0+and+above.](http://confluence.atlassian.com/display/BAMKB/Enable+AJP+Support+in+Bamboo+2.0+and+above. "this page")

comments: author: lance_lyons
body: Thanks Przemek. Im sure that jar file is needed but it didnt fix my problem The bamboo service still stops in less than a minute. It seems to start and then quit. The log file is above. I cant see anything that makes me know what to do next.


author: Przemek Bruski
body: Does Bamboo start when you run it from the command line?


author: lance_lyons
body: here is my

No but it gave me more information. Not certain what this means.

jvm 1 \| 2011-08-31 06:33:03.793:WARN::FAILED SelectChannelConnector@null127.0.0.1:8084: java.net.SocketException: Unresolved address  
jvm 1 \| 2011-08-31 06:33:03.793:WARN::FAILED com.atlassian.bamboo.server.Server@65e1722c: java.net.SocketException: Unresolved address  
jvm 1 \| java.net.SocketException: Unresolved address  
jvm 1 \| at sun.nio.ch.Net.translateToSocketException(Unknown Source)  
jvm 1 \| at sun.nio.ch.Net.translateException(Unknown Source)  
jvm 1 \| at sun.nio.ch.Net.translateException(Unknown Source)  
jvm 1 \| at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)  
jvm 1 \| at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:196)  
jvm 1 \| at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:362)  
jvm 1 \| at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:274)  
jvm 1 \| at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)  
jvm 1 \| at org.eclipse.jetty.server.Server.doStart(Server.java:254)  
jvm 1 \| at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)  
jvm 1 \| at com.atlassian.bamboo.server.Server.main(Server.java:77)  
jvm 1 \| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
jvm 1 \| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
jvm 1 \| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
jvm 1 \| at java.lang.reflect.Method.invoke(Unknown Source)  
jvm 1 \| at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)  
jvm 1 \| at java.lang.Thread.run(Unknown Source)  
jvm 1 \| Caused by: java.nio.channels.UnresolvedAddressException  
jvm 1 \| at sun.nio.ch.Net.checkAddress(Unknown Source)  
jvm 1 \| at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)  
jvm 1


author: lance_lyons
body: ok the above error unresolved address was because we had set the jetty.host and should not have.

\<Set name="host"\>\<Property name="jetty.host" /\>127.0.0.1\</Set\>

We are able to get to <http://machinename:8084> using the jetty approach so thats good. However we enabled the ajp connector in jetty.xml by uncommenting

\<Call name="addConnector"\>  
\<Arg\>  
\<New class="org.eclipse.jetty.ajp.Ajp13SocketConnector"\>  
\<Set name="port"\>8029\</Set\>  
\</New\>  
\</Arg\>  
\</Call\>

and with the entry in our apach virtual hosts with

\<VirtualHost \*:443\>  
ServerName bamboo.onlifehealth.com  

ProxyRequests Off  
ProxyPreserveHost On  
\<Proxy \*\>  
Order deny,allow  
Allow from all  
\</Proxy\>  

SSLEngine On  
SSLCertificateFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/ssl/bamboo.cert"  
SSLCertificateKeyFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/ssl/bamboo.key"  

ProxyPass / ajp://corp-jiraweb:8029/  
ProxyPassReverse / ajp://corp-jiraweb:8029/  
\<Location /\>  
Order allow,deny  
Allow from all  
\</Location\>  
\</VirtualHost\>

we get intermittent results when using the url <https://bamboo.onlifehealth.com> and get the following errors

2011-08-31 11:16:28,719 INFO \[qtp1516115866-23\] \[AccessLogFilter\] 127.0.0.1 GET <https://bamboo.onlifehealth.com/allPlans.action> 121205kb  
2011-08-31 11:16:28.763:WARN::handle failed?  
java.io.IOException: Bad AJP13 rcv packet: 0x0 expected 0x1234 org.eclipse.jetty.ajp.Ajp13Parser@3da79a3f  
at org.eclipse.jetty.ajp.Ajp13Parser.parseNext(Ajp13Parser.java:273)  
at org.eclipse.jetty.ajp.Ajp13Parser.parseAvailable(Ajp13Parser.java:151)  
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)  
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:241)  
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)  
at java.lang.Thread.run(Unknow


author: Przemek Bruski
body: Are you running the latest Apache 2.2?


author: lance_lyons
body: yes we are using 2.2.19x. I went back and did ProxyPass / [http://machinename:bambooport](http://machinenamebambooport/) and everything works ok that way. It just didnt work with ajp.

This does not work

# ProxyPass / ajp://corp-jiraweb:8029/  
# ProxyPassReverse / ajp://corp-jiraweb:8029/

<br />

This works

ProxyPass / [http://corp-jiraweb:8084/](http://corp-jiraweb:8084/%3Cbr) ProxyPassReverse / <http://corp-jiraweb:8084/>

not certain why.