Once we manually started Sonar with sonar.sh and the svc user we were able to get the application started however we’re still running into a permission issue to start as a Linux service. RUN_AS_USER is set in sonar.sh and the service is defined to run as the same user. However it still doesnt start properly and without error. It appears to be something with ES, is there a specific setting to make that work?
I didnt see any actual errors in es.log or sonar.log, the logs are below.
es.log
2019.05.07 20:06:50 INFO es[][o.e.n.Node] initializing ...
2019.05.07 20:06:51 INFO es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (/dev/xvda1)]], net usable_space [9.9gb], net total_space [15.6gb], spins? [no], types [ext4]
2019.05.07 20:06:51 INFO es[][o.e.e.NodeEnvironment] heap size [495.3mb], compressed ordinary object pointers [true]
2019.05.07 20:06:51 INFO es[][o.e.n.Node] node name [sonarqube], node ID [Ztjmm_o3TNW5n9NaG4IN6Q]
2019.05.07 20:06:51 INFO es[][o.e.n.Node] version[5.6.3], pid[13734], build[1a2f265/2017-10-06T20:33:39.012Z], OS[Linux/4.4.0-98-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_131/25.131-b11]
2019.05.07 20:06:51 INFO es[][o.e.n.Node] JVM arguments [-XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -Xms512m, -Xmx512m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/services/sonar/elasticsearch]
2019.05.07 20:06:51 INFO es[][o.e.p.PluginsService] loaded module [aggs-matrix-stats]
2019.05.07 20:06:51 INFO es[][o.e.p.PluginsService] loaded module [ingest-common]
2019.05.07 20:06:51 INFO es[][o.e.p.PluginsService] loaded module [parent-join]
2019.05.07 20:06:51 INFO es[][o.e.p.PluginsService] loaded module [percolator]
2019.05.07 20:06:51 INFO es[][o.e.p.PluginsService] loaded module [reindex]
2019.05.07 20:06:51 INFO es[][o.e.p.PluginsService] loaded module [transport-netty4]
2019.05.07 20:06:51 INFO es[][o.e.p.PluginsService] no plugins loaded
sonar.log
2019.05.07 20:06:49 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/services/sonar/temp
2019.05.07 20:06:49 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
2019.05.07 20:06:49 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/services/sonar/elasticsearch]: /opt/services/sonar/elasticsearch/bin/elasticsearch -Epath.conf=/opt/services/sonar/temp/conf/es
2019.05.07 20:06:49 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2019.05.07 20:06:49 INFO app[][o.e.p.PluginsService] no modules loaded
2019.05.07 20:06:49 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2019.05.07 20:06:51 INFO app[][o.s.a.SchedulerImpl] Stopping SonarQube
2019.05.07 20:06:51 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped
2019.05.07 20:06:51 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
2019.05.07 20:06:51 WARN app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
<-- Wrapper Stopped
When I was starting it as a Linux service there was no web.log, it wasnt getting that far. When I started it as the svc user by manually running the sonar.sh script it got a lot further and we were able to correct errors that popped up. That is why this is so strange.
Assuming that we’re talking about a 'nix OS, I’ll share that I wrestled with the file & process limits yesterday trying to test some cluster stuff. I had set the correct values in the correct places but some quirk kept them from being applied unless I su'd to myself (). Even after I su'd to myself, the correct values weren’t applied in spawned processes ().
Is this at all relevant to your situation? Maybe not; I got errors in the logs so I knew what to work on. And yet I can’t help wondering what’s being applied or not in your two different situations. I think the first thing to do is verify that your service really does run with the expected user.