SonarQube Azure Instance Container Failing to start after adding SQL Azure

Hello everyone,
I am a student and I must have a sonar server for running report from Azure DevOps for an important final project of my grade.

  • ALM used Azure DevOps Services
  • CI system used Azure DevOps
  • Image Docker sonarqube:9.7.1-community

I managed to create a working SonarQube ACI (On Azure) but I need to persist the configuration when I stop it (token, project, …).
I try to connect a SQL Azure database but the server doesn’t work anymore when I launch an instance configured with SQL Azure.
I’m looking for the cheapest solution to present my work. Can you help me please?

Shell to create :

az container create --location westus --resource-group rg-sonarqube --name sonarqubeserver --image sonarqube:9.7.1-community --os-type Linux --ip-address Public --dns-name-label storagemanager --ports 9000 --cpu 2 --memory 3.5 --environment-variables ‘SONAR_JDBC_USERNAME’=‘sonar’ ‘SONAR_JDBC_PASSWORD’=‘xxx’ ‘SONAR_JDBC_URL’=‘jdbc:sqlserver://srv-sql-sonarqube-storagemanager.database.windows.net:1433;database=sonarqubeDb;user=sonar@srv-sql-sonarqube-storagemanager;password=xxx;encrypt=false;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30’ \

LOGS :

Dropping Privileges
2022.11.18 22:13:35 INFO app[o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2022.11.18 22:13:35 INFO app[o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:39501]
2022.11.18 22:13:36 INFO app[o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2022.11.18 22:13:36 INFO app[o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2022.11.18 22:13:44 INFO es[o.e.n.Node] version[7.17.5], pid[536], build[default/tar/8d61b4f7ddf931f219e3745f295ed2bbc50c8e84/2022-06-23T21:57:28.736740635Z], OS[Linux/5.10.102.2-microsoft-standard/amd64], JVM[Alpine/OpenJDK 64-Bit Server VM/11.0.15/11.0.15+10-alpine-r0]
2022.11.18 22:13:44 INFO es[o.e.n.Node] JVM home [/usr/lib/jvm/java-11-openjdk]
2022.11.18 22:13:44 INFO es[o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=…/logs/es_hs_err_pid%p.log, -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, -Djna.tmpdir=/opt/sonarqube/temp, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=COMPAT, -Dcom.redhat.fips=false, -Des.enforce.bootstrap.checks=true, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/sonarqube/elasticsearch, -Des.path.conf=/opt/sonarqube/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=false]
2022.11.18 22:13:46 INFO es[o.e.p.PluginsService] loaded module [analysis-common]
2022.11.18 22:13:46 INFO es[o.e.p.PluginsService] loaded module [lang-painless]
2022.11.18 22:13:46 INFO es[o.e.p.PluginsService] loaded module [parent-join]
2022.11.18 22:13:46 INFO es[o.e.p.PluginsService] loaded module [reindex]
2022.11.18 22:13:46 INFO es[o.e.p.PluginsService] loaded module [transport-netty4]
2022.11.18 22:13:46 INFO es[o.e.p.PluginsService] no plugins loaded
2022.11.18 22:13:46 INFO es[o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (overlay)]], net usable_space [46.6gb], net total_space [49.2gb], types [overlay]
2022.11.18 22:13:46 INFO es[o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2022.11.18 22:13:46 INFO es[o.e.n.Node] node name [sonarqube], node ID [KEzb6C6aT4iGiX-5a_6aUQ], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]

Hi,

Welcome to the community!

Is your code open source? If so, the cheapest & easiest is to use SonarCloud.

Alternately, since this is a nearly one-and-done proposition, you could get away with not configuring a DB, which will cause SQ to default back to the embedded-for-evaluation-only H2 DB. Note that you’ll need to make sure you’ve configured a persistent data volume.

 
HTH,
Ann

Thanks for reply.
My project must be private so I have tried to set a volume for persistance but it never works. I try to create some files share with /opt/data conf extensions … in environnement variable but when I turn off the ACI and reload, I lost all I do and nothing are in file share. I must be doing it wrong but I can’t find a solution.

For my thesis in computer science, I have to be able to load quickly the aci sonarqube to show the report after an execution of my pipeline devops to deploy a web application with some DevSecOps tests like SonarQube to prove its usefulness. I consulted the documentation, but I could not find a solution for the latest version of sonarqube community edition.
I consulted the documentation, but I could not find a solution for the latest version of sonarqube community edition.

Update : When I add the file share /opt/sonarqube/data in my aci bash, a directory “es7” appear in data files. But after that I can’t start the container… I don’t understand

Hi,

Maybe the docs will help.

 
Ann