Setting up Sonarqube instance on Azure appservice (not using the container) with postgres as the database engine
Please note this only tested with sonarqube 8.4 and if this is version you're working with please read on. Tried with sonarqube 8.6 with this setup and no luck :(
Setting up App service
First we need to setup our web app service. The requirement are it requires JDK 11 (that's because of the sonarqube version that i'm using) and must be a Windows. The start up scrip that we are using requires that.
Create an instance of this application and continue below.
Copy sonarqube binaries and startup files overAfter that, use FTP tool to copy some files over to wwwroot. This FTP credentials can be obtained from Deployment center as shown below:
Please download sonarqube from here. I am using version 8.4, developer version. Unpack it into a folder called sonar.
Your folder should look something like this. We have web.config, HttpPlatformHandlerStartup.ps1 and the unzip sonarqube binaries.
Copy all EXCEPT sonarqube-developer-8.4.135646 to app service wwwroot.
Updating your app settings
This is where we need to update your sonar.jdbc.url, sonar.jdbc.password, sonar.jdbc.username which will be injected into your environment settings. Do not modify sonar.properties as our HttpPlatformHandlerStartup.ps1 will comment all those settings out.
The tricky part is sonar.jdbc.url, contrary to the docs, it should look something like this. (Copy the jdbc connection string from your Azure Postgres's connection string tab)
sonar.jdbc.url (*** Important ***)
jdbc:postgresql://yourdatabasename.postgres.database.azure.com:5432/sonarqube?user=sonarqube@YourdatabaseServerName&password=secret&sslmode=require
sonar.jdbc.username
sonarqube@YourdatabaseServerName
sonar.jdbc.password
secret
Your final app settings should look like this
Restart your webapp and browse the url. Give it a few minutes to start up.
Troubleshooting.
Goto app service instance -> Development Tools -> Console. Go to your sonarqube folder (sonarqube-postgres), then logs folder and open up web.log to see if you start up sonarqube successfully.
Check if your sonar environment settings are configured correctly by typing "set " and enter.
Comments