Sonar

Add support for enabling AJP13Listener (mod_jk) in embedded Jetty

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.6
  • Fix Version/s: 1.9
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

It would be great to run Sonar with it's embedded Jetty behind an Apache via mod_jk. Here we need a way to enable Jetty's org.mortbay.http.ajp.AJP13Listener with an port (configurable via sonar.properties, e.g. as property sonar.ajp13.port).

Activity

Hide
Freddy Mallet added a comment -

You can use mod_proxy while waiting for this feature to be fixed. This is what we used for Nemo. If you want to provide a patch, you can take a look to JettyEmbedder class.

Show
Freddy Mallet added a comment - You can use mod_proxy while waiting for this feature to be fixed. This is what we used for Nemo. If you want to provide a patch, you can take a look to JettyEmbedder class.
Hide
Basil James Whitehouse III added a comment -

Can you describe your mod_proxy configuration? I've successfully used this for several Java and non Java applications but with my minimal configuration with Sonar the data is displayed but not styled at all.

Here's the proxy configuration I've used:

ProxyPass /sonar http://localhost:9000
Show
Basil James Whitehouse III added a comment - Can you describe your mod_proxy configuration? I've successfully used this for several Java and non Java applications but with my minimal configuration with Sonar the data is displayed but not styled at all. Here's the proxy configuration I've used:
ProxyPass /sonar http://localhost:9000
Hide
Basil James Whitehouse III added a comment -

Figured it out. For future reference Sonar's web context needs to be changed to. Here's the full config that's working for me

Apache configuration

<VirtualHost *:80>
        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPreserveHost On
        ProxyPass /sonar http://localhost:9000/sonar
</VirtualHost>

sonar.properties

# Change context path to work with Apache mod_proxy.
sonar.web.context:                        /sonar
Show
Basil James Whitehouse III added a comment - Figured it out. For future reference Sonar's web context needs to be changed to. Here's the full config that's working for me Apache configuration
<VirtualHost *:80>
        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPreserveHost On
        ProxyPass /sonar http://localhost:9000/sonar
</VirtualHost>
sonar.properties
# Change context path to work with Apache mod_proxy.
sonar.web.context:                        /sonar
Hide
Freddy Mallet added a comment - - edited

There no need to define a web context.
Here is the Apache configuration used for Nemo :

<VirtualHost *:80>
        ServerName nemo.sonar.codehaus.org
        ProxyPass / http://localhost:9000/
        ProxyPassReverse / http://localhost:9000
        ProxyRequests Off

        CustomLog /mnt/tmp/apache2/access_nemo.log common 

        <Proxy *>
                Order allow,deny
                Allow from all
        </Proxy>
</VirtualHost>
Show
Freddy Mallet added a comment - - edited There no need to define a web context. Here is the Apache configuration used for Nemo :
<VirtualHost *:80>
        ServerName nemo.sonar.codehaus.org
        ProxyPass / http://localhost:9000/
        ProxyPassReverse / http://localhost:9000
        ProxyRequests Off

        CustomLog /mnt/tmp/apache2/access_nemo.log common 

        <Proxy *>
                Order allow,deny
                Allow from all
        </Proxy>
</VirtualHost>
Hide
Basil James Whitehouse III added a comment -

I should clarify, I needed to change the context path since I want sonar to be located at http://myserver.com/sonar instead of at the root http://myserver.com/ .

Show
Basil James Whitehouse III added a comment - I should clarify, I needed to change the context path since I want sonar to be located at http://myserver.com/sonar instead of at the root http://myserver.com/ .
Hide
Alphonse Bendt added a comment -

it doesn't seem to be possible to run sonar behind a https proxy.

some of the generated links point to the wrong url.
e.g. in the violations drilldown window:

<script type="text/javascript">
var config = {};
var request_parameters = {};
config['sonar_url']='http://xyz/sonar';

it should be https://xyz/sonar instead

is it possible to run sonar behind a https proxy?

Show
Alphonse Bendt added a comment - it doesn't seem to be possible to run sonar behind a https proxy. some of the generated links point to the wrong url. e.g. in the violations drilldown window: <script type="text/javascript"> var config = {}; var request_parameters = {}; config['sonar_url']='http://xyz/sonar'; it should be https://xyz/sonar instead is it possible to run sonar behind a https proxy?
Hide
Freddy Mallet added a comment -

You're right Alphonse. I've created a new ticket SONAR-752.

Show
Freddy Mallet added a comment - You're right Alphonse. I've created a new ticket SONAR-752.
Hide
Guillaume Boucherie added a comment -

Hi, I'm trying to make a patch for ajp13 support.
I start from tag 1.7 in svn.
I add two properties in sonar.properties file:

  • sonar.ajp13.activate: to activate or not ajp13 controller
  • sonar.ajp13.port: to specify ajp13 port to use

My modification is on file attachment.

Show
Guillaume Boucherie added a comment - Hi, I'm trying to make a patch for ajp13 support. I start from tag 1.7 in svn. I add two properties in sonar.properties file:
  • sonar.ajp13.activate: to activate or not ajp13 controller
  • sonar.ajp13.port: to specify ajp13 port to use
My modification is on file attachment.
Hide
Simon Brandhof added a comment -

Thank you Guillaume for the patch. It will be released in version 1.9.
I updated configuration in order to have only one parameter in sonar.properties :

# Apache mod_jk connector. Supported only in standalone mode. 
# Uncomment to activate AJP13 connector. 
#sonar.ajp13.port: 8009
Show
Simon Brandhof added a comment - Thank you Guillaume for the patch. It will be released in version 1.9. I updated configuration in order to have only one parameter in sonar.properties :
# Apache mod_jk connector. Supported only in standalone mode. 
# Uncomment to activate AJP13 connector. 
#sonar.ajp13.port: 8009

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: