运行最后一个SonarQube docker版本(7.0),当我使用H2嵌入式数据库时,我可以看到该插件,但是当使用postgresql数据库连接运行相同的图像时,我不再拥有该插件< / p>
H2嵌入式数据库
2018.04.04 13:53:17 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.0.0.36138 / 3b827a9a9a4b133c9fbe168aec8db44d78efeaeb
2018.04.04 13:53:17 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
2018.04.04 13:53:17 INFO web[][o.s.s.p.d.EmbeddedDatabase] Embedded database started. Data stored in: /opt/sonarqube/data
2018.04.04 13:53:17 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar
2018.04.04 13:53:17 WARN web[][o.s.d.DatabaseChecker] H2 database should be used for evaluation purpose only
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2018.04.04 13:53:18 INFO web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2018.04.04 13:53:18 INFO web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarPython [python] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarJava [java] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarTS [typescript] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarJS [javascript] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarQube :: Plugins :: SCM :: SVN [scmsvn] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarPHP [php] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarXML [xml] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarQube :: Plugins :: SCM :: Git [scmgit] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin Flex [flex] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarC# [csharp] installed
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin Flex / 2.3 / 79167f762219bea1fd181ff5ef6ca4b34abd1675
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarC# / 6.7.1.4347 / c8c4474682a3cd67f345ff46b2a7e1c62c85441c
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 4.0.0.5862 / 7c3166ea3f0526e74aa53e521d2fee2290fa0820
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJava / 5.1.0.13090 / 5d2c41b3da0a3a6c11417a6d17d011d7a1fe8ba2
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 2.12.1.3018 / 75c2cebff53eeee63fe7eafc5e31c188270d5fe8
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 1.9.0.2010 / f17988b34c750c96c13ef5bdcc0645167233e3ad
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarQube :: Plugins :: SCM :: Git / 1.3.0.869 / 4da53e3f9e55f4f2e5796625cb0c5768ed152079
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarQube :: Plugins :: SCM :: SVN / 1.6.0.860 / 2111fdbd1dddda4ad6d4ed6486fd0b18c1010d3b
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 1.5.0.2122 / 7eb12e7593b8e02616914773451c6118f230c57a
2018.04.04 13:53:18 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 1.4.3.1027 / 39588245cecf538bb27be4e496ff303b0143d20b
2018.04.04 13:53:19 INFO web[][o.s.s.p.d.m.AutoDbMigration] Automatically perform DB migration on fresh install
postgresql数据库
2018.04.04 13:51:27 INFO web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2018.04.04 13:51:27 INFO web[][o.s.s.s.RegisterPlugins] Register plugins
2018.04.04 13:51:28 INFO web[][o.s.s.s.RegisterMetrics] Register metrics
2018.04.04 13:51:36 INFO web[][o.s.s.r.RegisterRules] Register rules
2018.04.04 13:51:38 INFO web[][o.s.s.q.BuiltInQProfileRepositoryImpl] Load quality profiles
...
2018.04.04 13:51:48 INFO ce[][o.e.p.PluginsService] no modules loaded
感谢您的支持
我做了其他测试:
使用新的postgresql数据库,没有数据,当我启动时 docker run -p 9000:9000 -p 9092:9092 -e SONARQUBE_JDBC_USERNAME = XXXX -e SONARQUBE_JDBC_PASSWORD = XXXXX -e SONARQUBE_JDBC_URL = jdbc:postgresql:// XXXX:1223 / dbname sonarqube
插件装得很好
2018.04.05 09:09:10 INFO web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2018.04.05 09:09:10 INFO web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2018.04.05 09:09:10 INFO web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarPython [python] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarJava [java] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarTS [typescript] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarJS [javascript] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarQube :: Plugins :: SCM :: SVN [scmsvn] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarPHP [php] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarXML [xml] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarQube :: Plugins :: SCM :: Git [scmgit] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin Flex [flex] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Plugin SonarC# [csharp] installed
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin Flex / 2.3 / 79167f762219bea1fd181ff5ef6ca4b34abd1675
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarC# / 6.7.1.4347 / c8c4474682a3cd67f345ff46b2a7e1c62c85441c
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 4.0.0.5862 / 7c3166ea3f0526e74aa53e521d2fee2290fa0820
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJava / 5.1.0.13090 / 5d2c41b3da0a3a6c11417a6d17d011d7a1fe8ba2
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 2.12.1.3018 / 75c2cebff53eeee63fe7eafc5e31c188270d5fe8
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 1.9.0.2010 / f17988b34c750c96c13ef5bdcc0645167233e3ad
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarQube :: Plugins :: SCM :: Git / 1.3.0.869 / 4da53e3f9e55f4f2e5796625cb0c5768ed152079
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarQube :: Plugins :: SCM :: SVN / 1.6.0.860 / 2111fdbd1dddda4ad6d4ed6486fd0b18c1010d3b
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 1.5.0.2122 / 7eb12e7593b8e02616914773451c6118f230c57a
2018.04.05 09:09:11 INFO web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 1.4.3.1027 / 39588245cecf538bb27be4e496ff303b0143d20b
2018.04.05 09:09:12 INFO web[][o.s.s.p.d.m.c.PostgresCharsetHandler] Verify that database charset supports UTF8
2018.04.05 09:09:12 INFO web[][o.s.s.p.d.m.AutoDbMigration] Automatically perform DB migration on fresh install
所以第一次运行都没问题。
当我通过docker重启服务器时,
2018.04.05 09:23:42 INFO web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2018.04.05 09:23:42 INFO web[][o.s.s.s.RegisterPlugins] Register plugins
2018.04.05 09:23:42 INFO web[][o.s.s.s.RegisterMetrics] Register metrics
2018.04.05 09:23:51 INFO web[][o.s.s.r.RegisterRules] Register rules
2018.04.05 09:23:52 INFO web[][o.s.s.r.RegisterRules] Disable rule Pylint:R0801
2018.04.05 09:23:52 INFO web[][o.s.s.r.RegisterRules] Disable rule squid:UselessParenthesesCheck
2018.04.05 09:23:52 INFO web[][o.s.s.r.RegisterRules] Disable rule squid:RightCurlyBraceSameLineAsNextBlockCheck
2018.04.05 09:23:52 INFO web[][o.s.s.r.RegisterRules] Disable rule javascript:S138
2018.04.05 09:23:52 INFO web[][o.s.s.r.RegisterRules] Disable rule squid:S1764
2018.04.05 09:23:52 INFO web[][o.s.s.r.RegisterRules] Disable rule csharpsquid:S112
答案 0 :(得分:0)
发生这种情况是由于在后续运行中映像fs和config数据库之间存在差异。
在第一次运行时,捆绑的插件从/opt/sonarqube/lib/bundled-plugins
复制到/opt/sonarqube/extensions/plugins
,并标记为已部署在数据库中。
当您拆下容器并再次运行它时,/opt/sonarqube/extensions/plugins
会丢失这些插件,因为它们是干净的,但它们仍被标记为已在数据库中部署。然后,Sonar假定有人手动删除了这些插件,并将其从已安装/部署的插件列表中删除。
H2不会发生这种情况-在内存中并且在同一映像中,每次重新启动时也会清除其状态。
解决方案是通过卷来持久化受影响的路径(不仅是/ plugins,而且还包括/ data,如链接issue中所述)
基于https://github.com/SonarSource/docker-sonarqube/issues/112#issuecomment-338277087(并使其更具可见性)