Sonarqube azure sql database

Hi

I currently make a test of Sonarqube 8.9.10 enterprise in azure container instance with an mssql database. I met issues with azure mssql database. But it works when i execute my container without the mssql service. I deploy my services with terraform and use this settings as environment variables:

environment_variables = {
SONARQUBE_JDBC_URL = “jdbc:sqlserver://${azurerm_sql_server.sql.name}.database.windows.net:1433;database=${azurerm_mssql_database.sqldb.name}”
SONARQUBE_JDBC_USERNAME = “adminuser”
SONARQUBE_JDBC_PASSWORD = “${azurerm_key_vault_secret.secret.value}”
}
I have also tried to install the service without terraform. But i have also the same issue

Thank you for your help.

Hi,

Welcome to the community!

Since you’re still in your initial test phase, can you switch to SonarQube 9.9 LTS, announced yesterday, and try again?

 
Ann

Hi,

I have tried with the latest version 9.9 but it still doesn’t work.

Hi,

I guess what you mean is that you have trouble connecting to the DB?

If so what do your server logs say?

Also, and I should have mentioned this before, you’ll want to make sure you’re using the current, supported envvars to specify your DB credentials.

 
Ann

log.zip (18.6 KB)
Hi please find my log files attached
I use an Azure container instance as part of my test.

Hi,

I’m confused.

That’s not reflected in your logs:
2023.02.14 16:02:09 INFO web[][o.s.s.p.d.EmbeddedDatabase] Starting embedded database on port 9092 with url jdbc:h2:tcp://127.0.0.1:9092/sonar;NON_KEYWORDS=VALUE

While I do see plenty of errors in your logs, they appear unrelated to startup. Your server was up for ~1.5h before the trouble started:

2023.02.14 16:09:24 INFO  web[][o.s.s.p.Platform] Web Server is operational
2023.02.14 17:49:58 INFO  web[][o.a.c.h.Http11Processor] Error parsing HTTP request header\n Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
...
2023.02.14 17:49:58 ERROR web[][o.a.c.h.Http11Processor] Error processing request
java.lang.NullPointerException: Cannot invoke "String.replaceFirst(String, String)" because the return value of "javax.servlet.http.HttpServletRequest.getRequestURI()" is null
	at org.sonar.server.platform.web.SecurityServletFilter.addSecurityHeaders(SecurityServletFilter.java:70)

It would be interesting to know what those requests are, but I suppose the first order of business is your DB connection. Can you re-evaluate your settings and try again?

BTW, in 9.9, the long-deprecated parameters SONARQUBE_JDBC_USERNAME and SONARQUBE_JDBC_PASSWORD are no longer supported. The docs should help.

 
Ann

If i understand, according to the documentation, i have to use this settings for the authentication:
SONAR_JDBC_URL=jdbc:sqlserver://;databaseName=sonar;integratedSecurity=true

Which directory i have to copy the file mssql-jdbc_auth-11.2.2.x64.dll?

Hi,

The docs should help.

 
Ann

I understand. I use sql server in azure as Paas. Unfortunately i think it’s not compatible i have nowhere to copy the dll file.

Hi,

I’m confused. The dll needs to be in the path on the server hosting SonarQube.

 
Ann

Hi,

It still doesn’t work. I changed my configuration with the settings recomanded on the documentation:

environment_variables = {
SONARQUBE_JDBC_URL = “jdbc:sqlserver://${azurerm_sql_server.sql.name}.database.windows.net;databaseName=sonar;integratedSecurity=true”
}
and i also copy the dll file.
Please find attached my log files
log.zip (14.2 KB)

Hi,

If you’re using SonarQube 9.9, as you said earlier, then that environment variable isn’t going to work. The envvar docs and the LTS to LTS upgrade notes should help.

 
HTH,
Ann

I don’t really understand. According to the documentation the environnement variable SONARQUBE_JDBC_URL variables have been removed. But when i go to the environement variable recomended on that link: Environment variables (sonarqube.org)

It still recommand it for azur sql database.
What environment variables should i use to make it works?

Hi,

It’s subtle, but it’s a lot easier to see when they’re side by side:

SONARQUBE_JDBC_URL
SONAR_JDBC_URL

 
HTH,
Ann

Hi,

I have tried with this settings but it still does not work.

secure_environment_variables = {
SONAR_JDBC_URL = “jdbc:sqlserver://${azurerm_sql_server.sql.name}.database.windows.net:1433;databaseName=sonar;integratedSecurity=true”
}

I also need to test with login and password such as in this exemple Azure ACI – SonarQube | Coding With Taz but i don’t know if these settings are still used with the sonarqube 9.9 version
Please find my logs attached
log.zip (9.4 KB)

Hi,

Have you read those logs?

I see this a lot in es.log. What do you make of it:

2023.02.22 15:08:16 ERROR es[][o.e.b.Bootstrap] node validation exception
[1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

 
Ann

Where can i change this property? are there an environment variable to change this?

Hi,

This is a server-level setting. The Elasticsearch docs should help.

 
Ann

Hi,

I use Azure container instance. It’s a paas servive. Unfortunately i can’t define this service on the host.

You will need to add following Environment variable:
SONAR_SEARCH_JAVAADDITIONALOPTS
with a value that contains
”-Dnode.store.allow_mmap=false” (in case you have some other setting also)

2 Likes