Oteemo / charts

Helm chart repository
https://oteemo.github.io/charts
MIT License
181 stars 232 forks source link

Plugins directory mounting issue #250

Closed Thyagaraj1611 closed 3 years ago

Thyagaraj1611 commented 3 years ago

Hi,

I'm trying to install plugins through this helm chart using "9.2.7" version however i see an issue when the ephemeral volume is used. I get the below error

java.lang.IllegalStateException: Fail to move plugin: /opt/sonarqube/extensions/downloads/sonar-findbugs-plugin-4.0.3.jar to /opt/sonarqube/extensions/plugins/sonar-findbugs-plugin-4.0.3.jar
    at org.sonar.server.plugins.ServerPluginRepository.overrideAndRegisterPlugin(ServerPluginRepository.java:185)
    at org.sonar.server.plugins.ServerPluginRepository.moveDownloadedPlugins(ServerPluginRepository.java:146)
    at org.sonar.server.plugins.ServerPluginRepository.start(ServerPluginRepository.java:104)
    at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
    at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
    at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
    at org.picocontainer.behaviors.Stored.start(Stored.java:110)
    at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
    at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
    at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
    at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:113)
    at org.sonar.server.platform.Platform.start(Platform.java:211)
    at org.sonar.server.platform.Platform.startLevel2Container(Platform.java:177)
    at org.sonar.server.platform.Platform.init(Platform.java:87)
    at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4817)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5283)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: Destination '/opt/sonarqube/extensions/plugins' directory cannot be created
    at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1070)
    at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1028)
    at org.apache.commons.io.FileUtils.moveFile(FileUtils.java:3008)
    at org.sonar.server.plugins.ServerPluginRepository.overrideAndRegisterPlugin(ServerPluginRepository.java:182)
    ... 26 common frames omitted

Whereas if i use lower versions like 9.2.6, 9.2.5 i get permission denied error, PFB stacktrace java.lang.IllegalStateException: Fail to move plugin: /opt/sonarqube/extensions/downloads/sonar-findbugs-plugin-4.0.3.jar to /opt/sonarqube/extensions/plugins/sonar-findbugs-plugin-4.0.3.jar at org.sonar.server.plugins.ServerPluginRepository.overrideAndRegisterPlugin(ServerPluginRepository.java:185) at org.sonar.server.plugins.ServerPluginRepository.moveDownloadedPlugins(ServerPluginRepository.java:146) at org.sonar.server.plugins.ServerPluginRepository.start(ServerPluginRepository.java:104) at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40) at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) at org.picocontainer.behaviors.Stored.start(Stored.java:110) at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016) at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009) at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135) at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90) at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:113) at org.sonar.server.platform.Platform.start(Platform.java:211) at org.sonar.server.platform.Platform.startLevel2Container(Platform.java:177) at org.sonar.server.platform.Platform.init(Platform.java:87) at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4817) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5283) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.io.FileNotFoundException: /opt/sonarqube/extensions/plugins/sonar-findbugs-plugin-4.0.3.jar (Permission denied) at java.base/java.io.FileOutputStream.open0(Native Method) at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187) at org.apache.commons.io.FileUtils.doCopyFile(FileUtils.java:1123) at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1076) at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1028) at org.apache.commons.io.FileUtils.moveFile(FileUtils.java:3008) at org.sonar.server.plugins.ServerPluginRepository.overrideAndRegisterPlugin(ServerPluginRepository.java:182) ... 26 common frames omitted

To solve this, i had to enable persistence volume by mounting "/opt/sonarqube/extensions" and use version 9.2.5. Version > 9.2.5 doesn't work with persistence enabled as well.

ricardojdsilva87 commented 3 years ago

Hello, I have the exact same error, but with only version 9.2.7 of the chart. I can confirm that versions 9.2.4 and 9.2.6 are working with no issues. I'm currently using version 8.6.0 of sonarqube with no persistent storage and multiple pods. Seems that some update on the helm templates broke something with the plugin instalation. Let me know if you need any more information. Thanks

Thyagaraj1611 commented 3 years ago

Thanks for the fix, but i forgot to mention that i'm trying to install 7.9.1 (LTS) version of sonarqube with the custom Dockerfile so i still get "Permission Denied" error while installing plugins.

Caused by: java.io.FileNotFoundException: /opt/sonarqube/extensions/plugins/sonar-findbugs-plugin-4.0.3.jar (Permission denied)

Thyagaraj1611 commented 3 years ago

Figured out the issue, the problem was with the Dockerfile of 7.9.1 version. The group id and user id for the user "sonarqube" was missing and hence the securityContext was never working in this case.

Adding the below line in Dockerfile did the trick - RUN groupadd -r -g 1000 sonarqube && useradd -r -u 1000 -g sonarqube sonarqube

randy-concepcion commented 3 years ago

Hello, I have the exact same error, but with only version 9.2.7 of the chart. I can confirm that versions 9.2.4 and 9.2.6 are working with no issues. I'm currently using version 8.6.0 of sonarqube with no persistent storage and multiple pods. Seems that some update on the helm templates broke something with the plugin instalation. Let me know if you need any more information. Thanks

@ricardojdsilva87 Thank you for providing the chart versions which were working for you. I also ran into the same issue, but used v9.2.6 and confirmed that this works.

ricardojdsilva87 commented 3 years ago

@randy-concepcion I've updated after to v9.3.1, after being restored the previous behaviour of the chart with this PR. All is working as before