How do I access my SonarQube from outside a server?
Info:
I am running a community edition. This because I need to prove the benefit for the company on using SonarQube before I can get permission to buy a developer license.
Using windows 2019 server
I finally got SonarQube up and running on the server and created tasks in task scheduler for start, scanning etc and it works. The next step for me is to provide team access to SonarQube via a web browser and without them having to log on to the server directly.
created a firewall rule which only allow internal traffic to reach SonarQube
We did the same with Jenkins Build server and that works just fine, but it does not work for SonarQube .
I tried to change “sonar.web.host=xxx.xxx.xxx.xxx” (server IP), but then SonarQube does not start. As soon as i remove / comment sonar.web.host then it will start again.
I´ve been searching with broad search terms and find that many other are asking a similar question and are having similar problems. I just did not find any solutions.
could you elaborate what is not working for you? are you trying to setup a reverse proxy or do you have problems with configuring the base url of sonarqube?
The property sonar.web.host is only to specify on which network interface sonarqube will listen on. per default sonarqube will be reachable on all network interfaces. If you have configured it to run on 127.0.0.1 it will only respond on the loopback interface and you would have to configure a reverse proxy in front of sonarqube to re route the traffic from “outside” to sonarqube
You are writing something similar to what the hosting firm did.
They wrote:
the firewall allows and forwards port 8080 to the server- however, it only seems to listen to port 8080 on localhost / loopback - and thus it cannot respond to traffic out of the server.
I think the java program should be configured to listen on the machine IP or on all IPs.
I changed the port to 8080 just to match what we do for other dns records.
# 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=0.0.0.0
# sonar.web.host=127.0.0.1
# Web context. When set, it must start with forward slash (for example /sonarqube).
# The default value is root context (empty value).
#sonar.web.context=
# TCP port for incoming HTTP connections. Default value is 9000.
#sonar.web.port=9000
sonar.web.port=8080
did you, or do you want to configure a reverse proxy in front of your sonarqube instance to handle this or do you want to open sonarqube to listen on any network interface on port 8080?
for the first one (more secure option) i would advise you to consult the link i posted in my previous post.
for the second one, you can set the following values in the sonar.properties file to match the desired behavior:
sonar.web.host=0.0.0.0
sonar.web.port=8080
you just need to ensure that there is no firewall blocking the connection on that port and that this port is noch blocked by another process