Vnet integration SonarQube docker in Azure (App Service)

Our Situation:

Our organization is moving to the cloud and we are creating a azure landing zone for DevOps Teams so that they can start quick. SonarQube was one of the first application we delivered to the cloud that the DevOps Teams could use.

We deployed SonarQube with a Azure DevOps pipeline (YAML) to Azure, so that we can maintain it with upcoming updates.

Our setup:

  • Azure App Service (Sonar Docker running in a Linux environment) with App Service Plan
  • SonarQube 8.2 Developer Edition (docker image)
  • SQL server database
  • Storage account for the mounted data drives

This setup is working and the teams can use SonarQube for their builds.

But we want to go further in our deployment and have some questions on if SonarQube supports this.

Question:

In the current setup we have not integrated our VNET plan in to the SonarQube deployment, which we want to use because the app service can get an ip-adress from our subnet within the VNET we would like to use. Otherwise SQL Server is now exposed to the global internet and with vnet integration we can make SQL server only accessible within the VNET/SubNet.

We tried to implement this:

https://docs.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet

But is not working and SonarQube crashes after the first user access the application.

In the article it is mentioned that the port should be variable and not hard coded:

If you host your app on Linux with the built-in images, regional VNet Integration works without additional changes. If you use Web or Function App for Containers, you must modify your docker image to use VNet Integration. In your docker image, use the PORT environment variable as the main web server’s listening port, instead of using a hardcoded port number. The PORT environment variable is automatically set by the platform at the container startup time. If you use SSH, the SSH daemon must be configured to listen on the port number specified by the SSH_PORT environment variable when you use regional VNet Integration. There’s no support for gateway-required VNet Integration on Linux.

We see in the SonarQube docker configuration port 9000 is hard coded, is their a way to make this variable? Our are you planning to make this possible?

Hello,

I’ll focus on the latest question you asked

We see in the SonarQube docker configuration port 9000 is hard coded, is their a way to make this variable? Our are you planning to make this possible?

You may want to look at SONAR_WEB_PORT environment variable.
The full list of supported environment variables that could be passed to a container can be found at Environment variables.

Hope that helps.
Kris

I’m experiencing the same issue. Have you found a solution?