SonarQube: Change the elastic search client host

孤街浪徒 提交于 2019-11-28 11:07:40

问题


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.


回答1:


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.




回答2:


In Sonar 5.2 will be possible to set these properties, see here . I have tried and it works (I changed this class in Sonar 5.1 source to allow configure these ES properties, see here).



来源:https://stackoverflow.com/questions/28594063/sonarqube-change-the-elastic-search-client-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!