sonarqubeopenshiftsonarqube-5.0sonarqube-4.5openshift-cartridge

SonarQube: Change the elastic search client host


In brief: Is there a way of changing the target address within the elastic search client used by SonarQube?

More Info: I'd love to use SonarQube > 4.1 on OpenShift. Unfortunately, you can't bind to localhost in that environment. So these guys changed the service wrapper to piped mode and used the sonar.web.host property to set up SonarQube 4.0. Starting with SonarQube 4.1 we'll also have the elastic search server that tries to bind to localhost, which leads to a crash at startup. But there's no such thing as a sonar.search.host property (similar to sonar.search.port), is there?

As a workaround, changing the binding of the server can be changed using the sonar.search.javaAdditionalOpts and es.network.host parameters. Yeah I know, I shouldn't be doing this. Because now the app crashes with a NoNodeAvailableException: No node available. That's why I'm looking for a way to change this.
Looking at SonarQubes source code, I presume that the client's target address is hard-coded. (I might have gotten that wrong, though)

I presume without a solution for this, we'll never SonarQube 5.0 running on OpenShift or any other environment with strict security policy.

Can anyone think of another workaround?
Maybe changing Java's definition for "localhost"/loopback interface? However, changing /etc/hosts doesn't work without root access. Any other ideas?

Edit: If you want to have a look yourself here's how far I got so far. The build file is the essential part.


Solution

  • This is possible since SonarQube 5.2, using the sonar.search.host property.
    For an example on how to deploy this on OpenShift, see here.