Is it possible to move from H2 after setting up an instance of SonarQube?

Which versions are you using: SonarQube version 8.0.0 (developer edition)
What are you trying to achieve: I set up SonarQube on an Azure web app using the embedded database (H2) to start. I would now like to change that database and point to a SQL database I created in Azure.
What have you tried so far:

  • In Azure, I created a server with the firewall set up to allow Azure Services and Resources access.
  • I created a SQL database on that server
  • I created a contained user with:
CREATE USER [MyUser] WITH PASSWORD = 'MyPassword';
EXEC SP_ADDROLEMEMBER N'db_owner', N'MyUser'
  • I gave that user access to the database with"
GRANT ALTER, EXECUTE, SELECT, DELETE ON schema::schemaName TO [MyUser];
  • I updated the sonar.properties file to container the username, password and url information:
sonar.jdbc.username=MyUser
sonar.jdbc.password=MyPassword
sonar.jdbc.url=jdbc:sqlserver://[MyServerName]:1433;database=[MyDatabaseName];ssl=require;SelectMethod=Cursor
  • I restarted my SonarQube server using the button in the Administration > System section of the UI
  • I restarted my Azure app service

After restarting the Azure app service the properties I updated in the sonar.properties file are all commented out.

The log files all reflect that I am still connecting to the H2 database.

web-server-log.txt (28.5 KB) compute-engine-log.txt (2.1 KB)

Main Process Log

2020.03.03 20:16:14 INFO  app[][o.s.a.SchedulerImpl] SQ restart requested by Process[web]
2020.03.03 20:16:15 INFO  app[][o.s.a.SchedulerImpl] Process[ce] is stopped
2020.03.03 20:16:19 INFO  app[][o.s.a.SchedulerImpl] Process[web] is stopped
2020.03.03 20:16:20 INFO  app[][o.s.a.SchedulerImpl] Process[es] is stopped
2020.03.03 20:16:20 INFO  app[][o.s.a.SchedulerImpl] SonarQube is restarting
2020.03.03 20:16:20 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\home\site\wwwroot\sonarqube-8.0\temp
Unable to set the process priority:  Access is denied. (0x5)
Attempt to set the console title failed: The handle is invalid. (0x6)
--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2020.03.03 20:16:42 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\home\site\wwwroot\sonarqube-8.0\temp
2020.03.03 20:16:44 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.03.03 20:16:45 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [D:\home\site\wwwroot\sonarqube-8.0\elasticsearch]: D:\Program Files\Java\zulu11.29.3-jre11.0.2-win_x64\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=D:\home\site\wwwroot\sonarqube-8.0\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=D:\home\site\wwwroot\sonarqube-8.0\elasticsearch -Des.path.conf=D:\home\site\wwwroot\sonarqube-8.0\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2020.03.03 20:16:45 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2020.03.03 20:16:47 INFO  app[][o.e.p.PluginsService] no modules loaded
2020.03.03 20:16:47 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Unable to set the process priority:  Access is denied. (0x5)
Attempt to set the console title failed: The handle is invalid. (0x6)
--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2020.03.03 20:18:00 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\home\site\wwwroot\sonarqube-8.0\temp
2020.03.03 20:18:00 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.03.03 20:18:01 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [D:\home\site\wwwroot\sonarqube-8.0\elasticsearch]: D:\Program Files\Java\zulu11.29.3-jre11.0.2-win_x64\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=D:\home\site\wwwroot\sonarqube-8.0\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=D:\home\site\wwwroot\sonarqube-8.0\elasticsearch -Des.path.conf=D:\home\site\wwwroot\sonarqube-8.0\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2020.03.03 20:18:01 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2020.03.03 20:18:03 INFO  app[][o.e.p.PluginsService] no modules loaded
2020.03.03 20:18:03 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2020.03.03 20:19:59 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2020.03.03 20:19:59 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [D:\home\site\wwwroot\sonarqube-8.0]: D:\Program Files\Java\zulu11.29.3-jre11.0.2-win_x64\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=D:\home\site\wwwroot\sonarqube-8.0\temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*;D:\home\site\wwwroot\sonarqube-8.0\lib\jdbc\h2\h2-1.3.176.jar org.sonar.server.app.WebServer D:\home\site\wwwroot\sonarqube-8.0\temp\sq-process15725941714852907373properties
Unable to set the process priority:  Access is denied. (0x5)
Attempt to set the console title failed: The handle is invalid. (0x6)
--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2020.03.03 20:22:30 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\home\site\wwwroot\sonarqube-8.0\temp
2020.03.03 20:22:31 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2020.03.03 20:22:31 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [D:\home\site\wwwroot\sonarqube-8.0\elasticsearch]: D:\Program Files\Java\zulu11.29.3-jre11.0.2-win_x64\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=D:\home\site\wwwroot\sonarqube-8.0\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=D:\home\site\wwwroot\sonarqube-8.0\elasticsearch -Des.path.conf=D:\home\site\wwwroot\sonarqube-8.0\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch
2020.03.03 20:22:32 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2020.03.03 20:22:34 INFO  app[][o.e.p.PluginsService] no modules loaded
2020.03.03 20:22:34 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2020.03.03 20:24:27 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2020.03.03 20:24:27 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [D:\home\site\wwwroot\sonarqube-8.0]: D:\Program Files\Java\zulu11.29.3-jre11.0.2-win_x64\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=D:\home\site\wwwroot\sonarqube-8.0\temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*;D:\home\site\wwwroot\sonarqube-8.0\lib\jdbc\h2\h2-1.3.176.jar org.sonar.server.app.WebServer D:\home\site\wwwroot\sonarqube-8.0\temp\sq-process9674523485387274588properties
2020.03.03 20:27:21 INFO  app[][o.s.a.SchedulerImpl] Process[web] is up
2020.03.03 20:27:22 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[[key='ce', ipcIndex=3, logFilenamePrefix=ce]] from [D:\home\site\wwwroot\sonarqube-8.0]: D:\Program Files\Java\zulu11.29.3-jre11.0.2-win_x64\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=D:\home\site\wwwroot\sonarqube-8.0\temp --add-opens=java.base/java.util=ALL-UNNAMED -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/common/*;D:\home\site\wwwroot\sonarqube-8.0\lib\jdbc\h2\h2-1.3.176.jar org.sonar.ce.app.CeServer D:\home\site\wwwroot\sonarqube-8.0\temp\sq-process16969401747912299720properties
2020.03.03 20:28:11 INFO  app[][o.s.a.SchedulerImpl] Process[ce] is up
2020.03.03 20:28:11 INFO  app[][o.s.a.SchedulerImpl] SonarQube is up

We were struggling with this for a while. It seems the sonarqube-8.0\conf/sonar.properties file is not being used when running with IIS. Seemed odd, but we would set these and they would be commented out next time we started the application.

When running as an azure app service the setting need to be in the web.config, or in the Configuration -> App Settings section of the app service.

1 Like