SonarQube 从 8.9 升级到 9.9 后为空

问题描述 投票:0回答:1

我有一个包含 SonarQube 8.9 社区服务和 postgres 16.3 服务的 swarm 堆栈。我想将我的 sonarQube 升级到 9.9-community。但是,当我尝试时,它系统地表现为全新安装,重新创建所有数据库并删除所有插件。结果,我丢失了所有项目,需要回滚并恢复我的最后一个备份......

我的docker-compose如下(我唯一改变的是sonarqube的版本):

version: "3.6"

services:
  sonarqube:
    image: sonarqube:8.9-community
    ports:
      - "9001:9000"
    networks:
      - sonar
    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar
      - SONARQUBE_JDBC_USERNAME=sonar
      - SONARQUBE_JDBC_PASSWORD=test
    security_opt:
      - "seccomp=/seccomp.js"
    volumes:
      - /sonar/sonar_qube/conf:/opt/sonarqube/conf
      - /sonar/sonar_qube/logs:/opt/sonarqube/logs
      - /sonar/sonar_qube/data:/opt/sonarqube/data
      - /sonar/sonar_qube/extensions:/opt/sonarqube/extensions
      - /sonar/sonar_qube/bundled-plugins:/opt/sonarqube/lib/bundled-plugins
    deploy:
      resources:
        limits:
          memory: 5G
        reservations:
          memory: 5G
      placement:
        constraints:
          - node.role==worker
  db:
    image: postgres:16.3
    networks:
      - sonar
    environment:
      - POSTGRES_USER=sonar
      - POSTGRES_PASSWORD=test
    volumes:
      - /sonar/postgresql:/var/lib/postgresql
      - /sonar/postgresql_data:/var/lib/postgresql/data
    deploy:
      resources:
        limits:
          memory: 1G
        reservations:
          memory: 1G
      placement:
        constraints:
          - node.role==worker
networks:
  sonar

我唯一能想到的解决办法就是执行中间更新。升级在 9.6 和 9.8 版本上运行良好,但之后就一切都一样了。日志明确指出迁移是自动触发的,因为它将其视为全新安装(意味着删除并重新创建数据库):

2024.06.13 15:05:41 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2024.06.13 15:05:41 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:40425]
2024.06.13 15:05:41 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2024.06.13 15:05:41 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2024.06.13 15:05:43 INFO  es[][o.e.n.Node] version[7.17.15], pid[26], build[default/tar/0b8ecfb4378335f4689c4223d1f1115f16bef3ba/2023-11-10T22:03:46.987399016Z], OS[Linux/5.14.0-284.11.1.el9_2.x86_64/amd64], JVM[Eclipse Adoptium/OpenJDK 64-Bit Server VM/17.0.11/17.0.11+9]
2024.06.13 15:05:43 INFO  es[][o.e.n.Node] JVM home [/opt/java/openjdk]
2024.06.13 15:05:43 INFO  es[][o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=/opt/sonarqube/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, -Xmx1024m, -Xms1024m, -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]
2024.06.13 15:05:43 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2024.06.13 15:05:43 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2024.06.13 15:05:43 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2024.06.13 15:05:43 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2024.06.13 15:05:43 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2024.06.13 15:05:43 INFO  es[][o.e.p.PluginsService] no plugins loaded
2024.06.13 15:05:43 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/opt/sonarqube/data (SFL052101:/data.di.dockerdivers/sonar-test/sonar/sonar_qube/data)]], net usable_space [181.4gb], net total_space [282.9gb], types [nfs]
2024.06.13 15:05:43 INFO  es[][o.e.e.NodeEnvironment] heap size [1gb], compressed ordinary object pointers [true]
2024.06.13 15:05:43 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [I7VCwqA6QReMUphdC9Pgnw], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]
2024.06.13 15:05:46 INFO  es[][o.e.t.NettyAllocator] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=256kb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=1mb, heap_size=1gb}]
2024.06.13 15:05:46 INFO  es[][o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2024.06.13 15:05:46 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and seed hosts providers [settings]
2024.06.13 15:05:46 INFO  es[][o.e.g.DanglingIndicesState] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
2024.06.13 15:05:46 INFO  es[][o.e.n.Node] initialized
2024.06.13 15:05:46 INFO  es[][o.e.n.Node] starting ...
2024.06.13 15:05:46 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:40425}, bound_addresses {127.0.0.1:40425}
2024.06.13 15:05:47 INFO  es[][o.e.c.c.Coordinator] cluster UUID [vdJAXekLTfu_RwLqOF-2Fg]
2024.06.13 15:05:47 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[{sonarqube}{I7VCwqA6QReMUphdC9Pgnw}{e9zQPE-vSfK6VUnuB1ffhQ}{127.0.0.1}{127.0.0.1:40425}{cdfhimrsw} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 20, version: 401, delta: master node changed {previous [], current [{sonarqube}{I7VCwqA6QReMUphdC9Pgnw}{e9zQPE-vSfK6VUnuB1ffhQ}{127.0.0.1}{127.0.0.1:40425}{cdfhimrsw}]}
2024.06.13 15:05:47 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{I7VCwqA6QReMUphdC9Pgnw}{e9zQPE-vSfK6VUnuB1ffhQ}{127.0.0.1}{127.0.0.1:40425}{cdfhimrsw}]}, term: 20, version: 401, reason: Publication{term=20, version=401}
2024.06.13 15:05:47 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2024.06.13 15:05:47 INFO  es[][o.e.n.Node] started
2024.06.13 15:05:47 INFO  es[][o.e.g.GatewayService] recovered [7] indices into cluster_state
2024.06.13 15:05:49 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[projectmeasures][3], [projectmeasures][2], [metadatas][0]]]).
2024.06.13 15:05:50 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2024.06.13 15:05:50 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube]: /opt/java/openjdk/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --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 --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-9.9.5.90363.jar:/opt/sonarqube/lib/jdbc/h2/h2-2.1.214.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process6380220738101035128properties
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.sonar.process.PluginSecurityManager (file:/opt/sonarqube/lib/sonar-application-9.9.5.90363.jar)
WARNING: Please consider reporting this to the maintainers of org.sonar.process.PluginSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
2024.06.13 15:05:50 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2024.06.13 15:05:51 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 9.9.5.90363 / dfc7d8d716ea13cce42ab9d806d74568f3f4693f
2024.06.13 15:05:51 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;NON_KEYWORDS=VALUE
2024.06.13 15:05:51 INFO  web[][o.s.s.p.d.EmbeddedDatabase] Embedded database started. Data stored in: /opt/sonarqube/data
2024.06.13 15:05:51 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar;NON_KEYWORDS=VALUE
2024.06.13 15:05:51 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Starting...
2024.06.13 15:05:51 INFO  web[][c.z.h.p.HikariPool] HikariPool-1 - Added connection conn2: url=jdbc:h2:tcp://127.0.0.1:9092/sonar user=
2024.06.13 15:05:51 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Start completed.
2024.06.13 15:05:51 WARN  web[][o.s.db.dialect.H2] H2 database should be used for evaluation purpose only.
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2024.06.13 15:05:52 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2024.06.13 15:05:52 INFO  web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy C# Code Quality and Security / 8.51.0.59060 / e14c642f118958f22fd08841dc42f9aae480366a
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Configuration detection fot Code Quality and Security / 1.2.0.267 / 4f37ba9ffb37a96d5883e52ad392ed32c5c6eaab
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Flex Code Quality and Security / 2.8.0.3166 / 01f66bdddc678966c81a9064ed139156a6a89c97
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Go Code Quality and Security / 1.11.0.3905 / e1f28bc000e04ca01881e84218d01d464a17a36f
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy HTML Code Quality and Security / 3.7.1.3306 / d720acc6860c6d8b69ec4d17570a398a1e216da1
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy IaC Code Quality and Security / 1.11.0.2847 / 6892bd3a7320b3c110717acfdb18c4c7451069fd
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy JaCoCo / 1.3.0.1538 / 74a7798c7cea687c72ed9df40c93eb7ea2a58c49
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Java Code Quality and Security / 7.16.0.30901 / 4b1436558dfd5fc00c8d9aae8bb0364ba122c73e
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy JavaScript/TypeScript/CSS Code Quality and Security / 9.13.0.20537 / 68ff7657415044b86033814795ed95fc1f1558f1
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Kotlin Code Quality and Security / 2.12.0.1956 / a6df1ae252bd62d63f8673c28f87ad14258a7904
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy PHP Code Quality and Security / 3.27.1.9352 / 3ddc5a03e1a7e3729d41e7c1a30a37d5715958c7
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Python Code Quality and Security / 3.24.1.11916 / cc8f4fa745eb33d31c3869bdfdfd45514e67c1fe
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Ruby Code Quality and Security / 1.11.0.3905 / e1f28bc000e04ca01881e84218d01d464a17a36f
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Scala Code Quality and Security / 1.11.0.3905 / e1f28bc000e04ca01881e84218d01d464a17a36f
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy ShellCheck Analyzer / 2.4.0 / null
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Text Code Quality and Security / 2.0.2.1090 / 7eb026363b98f5f98b43c603772b5177869c2c6a
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy VB.NET Code Quality and Security / 8.51.0.59060 / e14c642f118958f22fd08841dc42f9aae480366a
2024.06.13 15:05:52 INFO  web[][o.s.s.p.ServerPluginManager] Deploy XML Code Quality and Security / 2.7.0.3820 / 656bccc1910d50c8984536bd2dfd917066b858e6
2024.06.13 15:05:54 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [http://localhost:9001]
2024.06.13 15:05:54 WARN  web[][o.s.a.s.w.WebService$Action] Description is not set on action api/monitoring/metrics
2024.06.13 15:05:54 WARN  web[][o.s.a.s.w.WebService$Action] Since is not set on action api/monitoring/metrics
2024.06.13 15:05:54 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/monitoring/metrics
2024.06.13 15:05:54 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2024.06.13 15:05:54 INFO  web[][o.s.s.p.d.m.AutoDbMigration] Automatically perform DB migration on fresh install
sonarqube
1个回答
0
投票

您正在使用已弃用的变量

“已删除已弃用的 SONARQUBE_JDBC_USERNAME、SONARQUBE_JDBC_PASSWORD 和 SONARQUBE_JDBC_URL 变量。请参阅环境变量以获取最新的配置变量。”

您需要使用 SONAR_JDBC_USERNAME 和 SONAR_JDBC_PASSWORD

https://docs.sonarsource.com/sonarqube/9.9/setup-and-upgrade/release-upgrade-notes/

https://docs.sonarsource.com/sonarqube/9.9/setup-and-upgrade/configure-and-operate-a-server/environment-variables/

© www.soinside.com 2019 - 2024. All rights reserved.