3

i am trying to install the lastest version of sonar in a openshift instance, when search tries to start, it tries to bind to 0.0.0.0:9001 but openshift does not allow to bind to all interfaces, so i have to set the ip, where in the configuration can i set this propertie?

I have already configured the sonar ip for binding like this

# Binding IP address. For servers with more than one IP address, this property specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
sonar.web.host=${env:OPENSHIFT_DIY_IP}

Thanks in advance

[Edit]

I've changed the config file so that it assigns the ip directly, but still have the same error, is it that it ignores the setting?

2015.01.13 20:09:47 WARN  sea[o.s.p.ProcessEntryPoint]  Starting search
2015.01.13 20:09:47 INFO  sea[o.s.s.SearchServer]  Starting ES[sonarqube] on port: 15000
2015.01.13 20:09:47 INFO  sea[o.elasticsearch.node]  [sonar-1421197785954] version[1.1.2], pid[286110], build[e511f7b/2014-05-22T12:27:39Z]
2015.01.13 20:09:47 INFO  sea[o.elasticsearch.node]  [sonar-1421197785954] initializing ...
2015.01.13 20:09:47 INFO  sea[o.e.plugins]  [sonar-1421197785954] loaded [], sites []
2015.01.13 20:09:51 INFO  sea[o.elasticsearch.node]  [sonar-1421197785954] initialized
2015.01.13 20:09:51 INFO  sea[o.elasticsearch.node]  [sonar-1421197785954] starting ...
2015.01.13 20:09:52 WARN  sea[o.s.p.ProcessEntryPoint]  Fail to start search
org.elasticsearch.transport.BindTransportException: Failed to bind to [15000]
    at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:381) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.transport.TransportService.doStart(TransportService.java:92) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:229) ~[elasticsearch-1.1.2.jar:na]
    at org.sonar.search.SearchServer.start(SearchServer.java:135) [sonar-search-4.5.2.jar:na]
    at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:77) ~[sonar-process-4.5.2.jar:na]
    at org.sonar.search.SearchServer.main(SearchServer.java:261) [sonar-search-4.5.2.jar:na]
Caused by: org.elasticsearch.common.netty.channel.ChannelException: Failed to bind to: 0.0.0.0/0.0.0.0:15000
    at org.elasticsearch.common.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.transport.netty.NettyTransport$3.onPortNumber(NettyTransport.java:372) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.transport.PortsRange.iterate(PortsRange.java:58) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.transport.netty.NettyTransport.doStart(NettyTransport.java:368) ~[elasticsearch-1.1.2.jar:na]
    ... 7 common frames omitted
java.net.SocketException: Permiso denegado
    at sun.nio.ch.Net.bind0(Native Method) ~[na:1.7.0_71]
    at sun.nio.ch.Net.bind(Net.java:444) ~[na:1.7.0_71]
    at sun.nio.ch.Net.bind(Net.java:436) ~[na:1.7.0_71]
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) ~[na:1.7.0_71]
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.7.0_71]
    at org.elasticsearch.common.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) ~[elasticsearch-1.1.2.jar:na]
    at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) ~[elasticsearch-1.1.2.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_71]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_71]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_71]
schnatterer
  • 7,525
  • 7
  • 61
  • 80
jaxkodex
  • 484
  • 2
  • 6
  • 17

2 Answers2

1

${env:OPENSHIFT_DIY_IP} does not work because environment variable are not handled yet.

Please see and vote for http://jira.codehaus.org/browse/SONAR-3682

  • So, i was trying, not to use the env variable, so i asssigned the ip directly... It seems it completly ignores the setting. I've edited my question with the error. – jaxkodex Jan 14 '15 at 01:11
  • Can you show us the content of your sonar.properties file? (for example, put it on http://pastebin.com). Thanks – Fabrice - SonarSource Team Jan 14 '15 at 09:51
  • Hey, sorry about the delay, here are my configs https://gist.github.com/jaxkodex/468d3c53dc32a4fdaa3c – jaxkodex Jan 16 '15 at 02:06
  • I tested changing the ip in the config on my local machine and i got the [log](http://pastebin.com/SgNXzr1z) see `bound_address {inet[/0.0.0.0:9001]}, publish_address {inet[/192.168.1.39:9001]}` it has bound_address as 0.0.0.0, shouldn't it have the ip 192.168.1.39? PD: The only change i am doing to the config is `sonar.web.host=192.168.1.39` – jaxkodex Jan 16 '15 at 03:14
0

You could replace the variables in a build script like these guys did.
The problem from your edit can be avoided by adding this to your build

# Adapt elasticsearch host
sed -i "s/^#sonar.search.javaAdditionalOpts=.*$/sonar.search.javaAdditionalOpts=-Des.network.host=$OPENSHIFT_DIY_IP/" sonar.properties
# Adapt elasticsearch host to be in permitted range 15000-35530 for openshift, as specified here: https://help.openshift.com/hc/en-us/articles/202185874
sed -i "s/^#sonar.search.port=.*$/sonar.search.port=35530/" sonar.properties

But you'll end up with a NoNodeAvailableException: No node available. I asked a more specific question about that here. Hopefully, someone turns up with an idea on how to solve this.

Community
  • 1
  • 1
schnatterer
  • 7,525
  • 7
  • 61
  • 80