Sonarqube: Authentication failed | First time Deploying on Docker (docker-compose)

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

lts-community

  • how is SonarQube deployed: zip, Docker, Helm

Docker - docker-compose

  • what are you trying to achieve

Hi, I am very new to Sonarqube. So over the past week I have been reading the documentation, blogs and stackoverflow to understand it better and solve the bugs and issues I faced.

I want to implement Sonarqube, for code quality analysis for our DevSecOps pipeline.

I am using an AWS Instance and using a docker-compose file on it.

Instance Specifications (Host) :

t2.2xlarge
22.04.3 LTS (Jammy Jellyfish)
EBS Volume: 30 GB

docker-compose.yml

version: "3"

services:
  sonarqube:
    image: sonarqube:lts-community
    command: -Dsonar.ce.javaOpts=-Xmx1192m -Dsonar.web.javaOpts=-Xmx1192m
    restart: unless-stopped
    container_name: sonarqube
    depends_on:
      - sonar
    ports:
      - "9000:9000"
    networks:
      - sonar-net
    environment:
      - SONARQUBE_JDBC_URL=jdbc:postgresql://sonar:5432/sonar
      - SONARQUBE_JDBC_USERNAME=sonar
      - SONARQUBE_JDBC_PASSWORD=sonar
    volumes:
      - /home/ubuntu/sonar-data/data:/opt/sonarqube/data
      - /home/ubuntu/sonar-data/extensions:/opt/sonarqube/extensions
      - /home/ubuntu/sonar-data/logs:/opt/sonarqube/logs

  sonar:
    image: postgres
    container_name: sonar
    restart: unless-stopped
    networks:
      - sonar-net
    environment:
      - POSTGRES_USER=sonar
      - POSTGRES_PASSWORD=sonar
    volumes:
      - /home/ubuntu/postgres/postgresql:/var/lib/postgresql
      - /home/ubuntu/postgres/data:/var/lib/postgresql/data

networks:
  sonar-net:
    external: false

The issue that I am facing currently is, I am successfully able to login and create a project while the container is running.

But when I restart the container, and go the url http://<Elastic-IP>:9000 I am redirected to this url http://:9000/sessions/new?return_to=%2F

I am unable to login into sonarqube and get this error: Authentication failed

The logs for the sonarqube container:

2024.01.31 08:16:21 INFO  es[][o.e.n.Node] version[7.17.8], pid[26], build[default/tar/120eabe1c8a0cb2ae87cffc109a5b65d213e9df1/2022-12-02T17:33:09.727072865Z], OS[Linux/6.2.0-1018-aws/amd64], JVM[Eclipse Adoptium/OpenJDK 64-Bit Server VM/17.0.10/17.0.10+7]
2024.01.31 08:16:21 INFO  es[][o.e.n.Node] JVM home [/opt/java/openjdk]
2024.01.31 08:16:21 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, -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]
2024.01.31 08:16:21 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2024.01.31 08:16:21 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2024.01.31 08:16:21 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2024.01.31 08:16:21 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2024.01.31 08:16:21 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2024.01.31 08:16:21 INFO  es[][o.e.p.PluginsService] no plugins loaded
2024.01.31 08:16:21 INFO  es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/opt/sonarqube/data (/dev/root)]], net usable_space [19.6gb], net total_space [28.8gb], types [ext4]
2024.01.31 08:16:21 INFO  es[][o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2024.01.31 08:16:21 INFO  es[][o.e.n.Node] node name [sonarqube], node ID [EQb8F-m5TrK0AaZV9Q4JKQ], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]
2024.01.31 08:16:24 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=512mb}]
2024.01.31 08:16:24 INFO  es[][o.e.i.r.RecoverySettings] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
2024.01.31 08:16:24 INFO  es[][o.e.d.DiscoveryModule] using discovery type [zen] and seed hosts providers [settings]
2024.01.31 08:16:24 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.01.31 08:16:25 INFO  es[][o.e.n.Node] initialized
2024.01.31 08:16:25 INFO  es[][o.e.n.Node] starting ...
2024.01.31 08:16:25 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:42707}, bound_addresses {127.0.0.1:42707}
2024.01.31 08:16:25 WARN  es[][o.e.b.BootstrapChecks] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
2024.01.31 08:16:25 INFO  es[][o.e.c.c.Coordinator] cluster UUID [B_5X_1wtRleAzXNTmcKvXQ]
2024.01.31 08:16:25 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[{sonarqube}{EQb8F-m5TrK0AaZV9Q4JKQ}{N4V-F5rSTayBpQszakeDlw}{127.0.0.1}{127.0.0.1:42707}{cdfhimrsw} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 3, version: 63, delta: master node changed {previous [], current [{sonarqube}{EQb8F-m5TrK0AaZV9Q4JKQ}{N4V-F5rSTayBpQszakeDlw}{127.0.0.1}{127.0.0.1:42707}{cdfhimrsw}]}
2024.01.31 08:16:25 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{EQb8F-m5TrK0AaZV9Q4JKQ}{N4V-F5rSTayBpQszakeDlw}{127.0.0.1}{127.0.0.1:42707}{cdfhimrsw}]}, term: 3, version: 63, reason: Publication{term=3, version=63}
2024.01.31 08:16:25 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2024.01.31 08:16:25 INFO  es[][o.e.n.Node] started
2024.01.31 08:16:25 INFO  es[][o.e.g.GatewayService] recovered [7] indices into cluster_state
2024.01.31 08:16:26 INFO  es[][o.e.c.r.a.AllocationService] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[components][4], [components][2], [metadatas][0]]]).
2024.01.31 08:16:26 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2024.01.31 08:16:26 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 -Xmx1192m -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-9.9.3.79811.jar:/opt/sonarqube/lib/jdbc/h2/h2-2.1.214.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process16012086498518146382properties
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.3.79811.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.01.31 08:16:27 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2024.01.31 08:16:28 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 9.9.3.79811 / 4fefd8061afc12c43078b4cee31db2e4618b4fd6
2024.01.31 08:16:28 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.01.31 08:16:28 INFO  web[][o.s.s.p.d.EmbeddedDatabase] Embedded database started. Data stored in: /opt/sonarqube/data
2024.01.31 08:16:28 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar;NON_KEYWORDS=VALUE
2024.01.31 08:16:28 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Starting...
2024.01.31 08:16:28 INFO  web[][c.z.h.p.HikariPool] HikariPool-1 - Added connection conn2: url=jdbc:h2:tcp://127.0.0.1:9092/sonar user=
2024.01.31 08:16:28 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Start completed.
2024.01.31 08:16:28 WARN  web[][o.s.db.dialect.H2] H2 database should be used for evaluation purpose only.
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2024.01.31 08:16:29 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy C# Code Quality and Security / 8.51.0.59060 / e14c642f118958f22fd08841dc42f9aae480366a
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Configuration detection fot Code Quality and Security / 1.2.0.267 / 4f37ba9ffb37a96d5883e52ad392ed32c5c6eaab
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Flex Code Quality and Security / 2.8.0.3166 / 01f66bdddc678966c81a9064ed139156a6a89c97
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Go Code Quality and Security / 1.11.0.3905 / e1f28bc000e04ca01881e84218d01d464a17a36f
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy HTML Code Quality and Security / 3.7.1.3306 / d720acc6860c6d8b69ec4d17570a398a1e216da1
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy IaC Code Quality and Security / 1.11.0.2847 / 6892bd3a7320b3c110717acfdb18c4c7451069fd
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy JaCoCo / 1.3.0.1538 / 74a7798c7cea687c72ed9df40c93eb7ea2a58c49
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Java Code Quality and Security / 7.16.0.30901 / 4b1436558dfd5fc00c8d9aae8bb0364ba122c73e
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy JavaScript/TypeScript/CSS Code Quality and Security / 9.13.0.20537 / 68ff7657415044b86033814795ed95fc1f1558f1
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Kotlin Code Quality and Security / 2.12.0.1956 / a6df1ae252bd62d63f8673c28f87ad14258a7904
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy PHP Code Quality and Security / 3.27.1.9352 / 3ddc5a03e1a7e3729d41e7c1a30a37d5715958c7
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Python Code Quality and Security / 3.24.1.11916 / cc8f4fa745eb33d31c3869bdfdfd45514e67c1fe
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Ruby Code Quality and Security / 1.11.0.3905 / e1f28bc000e04ca01881e84218d01d464a17a36f
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Scala Code Quality and Security / 1.11.0.3905 / e1f28bc000e04ca01881e84218d01d464a17a36f
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy Text Code Quality and Security / 2.0.2.1090 / 7eb026363b98f5f98b43c603772b5177869c2c6a
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy VB.NET Code Quality and Security / 8.51.0.59060 / e14c642f118958f22fd08841dc42f9aae480366a
2024.01.31 08:16:29 INFO  web[][o.s.s.p.ServerPluginManager] Deploy XML Code Quality and Security / 2.7.0.3820 / 656bccc1910d50c8984536bd2dfd917066b858e6
2024.01.31 08:16:30 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [http://localhost:9001]
2024.01.31 08:16:31 WARN  web[][o.s.a.s.w.WebService$Action] Description is not set on action api/monitoring/metrics
2024.01.31 08:16:31 WARN  web[][o.s.a.s.w.WebService$Action] Since is not set on action api/monitoring/metrics
2024.01.31 08:16:31 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/monitoring/metrics
2024.01.31 08:16:31 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2024.01.31 08:16:31 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@7c71c889 [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2024.01.31 08:16:31 INFO  web[][o.s.s.p.DetectPluginChange] Detect plugin changes
2024.01.31 08:16:31 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2024.01.31 08:16:31 INFO  web[][o.s.s.p.DetectPluginChange] No plugin change detected
2024.01.31 08:16:32 INFO  web[][o.s.s.s.LogServerId] Server ID: 147B411E-AY1eMyurHUNQ5VbH7V5g
2024.01.31 08:16:32 WARN  web[][o.s.s.a.LogOAuthWarning] For security reasons, OAuth authentication should use HTTPS. You should set the property 'Administration > Configuration > Server base URL' to a HTTPS URL.
2024.01.31 08:16:32 INFO  web[][o.s.s.p.UpdateCenterClient] Update center: https://update.sonarsource.org/update-center.properties
2024.01.31 08:16:33 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action saml/validation_init
2024.01.31 08:16:33 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/system/liveness
2024.01.31 08:16:33 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/plugins/download
2024.01.31 08:16:33 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/analysis_cache/get
2024.01.31 08:16:33 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/alm_integrations/check_pat
2024.01.31 08:16:33 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/push/sonarlint_events
2024.01.31 08:16:33 INFO  web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired session tokens has removed 0 elements
2024.01.31 08:16:33 INFO  web[][o.s.s.a.p.ExpiredSessionsCleaner] Purge of expired SAML message ids has removed 0 elements
2024.01.31 08:16:33 INFO  web[][o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2024.01.31 08:16:33 INFO  web[][o.s.s.t.TelemetryDaemon] Sharing of SonarQube statistics is enabled.
2024.01.31 08:16:33 INFO  web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2024.01.31 08:16:33 INFO  web[][o.s.s.s.RegisterPermissionTemplates] Register permission templates
2024.01.31 08:16:33 INFO  web[][o.s.s.s.RenameDeprecatedPropertyKeys] Rename deprecated property keys
2024.01.31 08:16:33 INFO  web[][o.s.s.s.RegisterPlugins] Register plugins
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.SonarLintConnectionFilter@1f462133 [pattern=UrlPattern{inclusions=[/api/*], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@154ce9ed [pattern=UrlPattern{inclusions=[/api/issues/delete_comment.*, ...], exclusions=[/api/authentication/login.*, ...]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceReroutingFilter@259f67c8 [pattern=UrlPattern{inclusions=[/api/components/bulk_update_key, ...], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.DefaultAdminCredentialsVerifierFilter@5edb043 [pattern=UrlPattern{inclusions=[/*], exclusions=[*.css, ...]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.InitFilter@2b0c5674 [pattern=UrlPattern{inclusions=[/sessions/init/*], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.SamlValidationRedirectionFilter@59fdd179 [pattern=UrlPattern{inclusions=[/oauth2/callback/saml], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.OAuth2CallbackFilter@7024ca9 [pattern=UrlPattern{inclusions=[/oauth2/callback/*], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ResetPasswordFilter@6f859ba2 [pattern=UrlPattern{inclusions=[/*], exclusions=[*.css, ...]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.LoginAction@4703db3 [pattern=UrlPattern{inclusions=[/api/authentication/login], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.LogoutAction@3b9412c9 [pattern=UrlPattern{inclusions=[/api/authentication/logout], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.ws.ValidateAction@5cd71e18 [pattern=UrlPattern{inclusions=[/api/authentication/validate], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.saml.ws.ValidationInitAction@1ac3bccd [pattern=UrlPattern{inclusions=[/saml/validation_init], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.saml.ws.ValidationAction@67c6e4fc [pattern=UrlPattern{inclusions=[/saml/validation], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.user.ws.ChangePasswordAction@2673dfd0 [pattern=UrlPattern{inclusions=[/api/users/change_password], exclusions=[]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.plugins.PluginsRiskConsentFilter@1132b47e [pattern=UrlPattern{inclusions=[/*], exclusions=[*.css, ...]}]
2024.01.31 08:16:33 INFO  web[][o.s.s.q.ProjectsInWarningDaemon] Counting number of projects in warning is not started as there are no projects in this situation.
2024.01.31 08:16:33 INFO  web[][o.s.s.p.p.PlatformLevelStartup] Running Community Edition
2024.01.31 08:16:33 INFO  app[][o.s.a.SchedulerImpl] Process[web] is up
2024.01.31 08:16:33 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[COMPUTE_ENGINE] 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-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=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 -Xmx1192m -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-9.9.3.79811.jar:/opt/sonarqube/lib/jdbc/h2/h2-2.1.214.jar org.sonar.ce.app.CeServer /opt/sonarqube/temp/sq-process4451653671378575704properties
2024.01.31 08:16:33 INFO  web[][o.s.s.p.Platform] Web Server is operational
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.3.79811.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.01.31 08:16:34 INFO  ce[][o.s.p.ProcessEntryPoint] Starting Compute Engine
2024.01.31 08:16:34 INFO  ce[][o.s.ce.app.CeServer] Compute Engine starting up...
2024.01.31 08:16:34 INFO  ce[][o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar;NON_KEYWORDS=VALUE
2024.01.31 08:16:34 INFO  ce[][c.z.h.HikariDataSource] HikariPool-1 - Starting...
2024.01.31 08:16:34 INFO  ce[][c.z.h.p.HikariPool] HikariPool-1 - Added connection conn0: url=jdbc:h2:tcp://127.0.0.1:9092/sonar user=
2024.01.31 08:16:34 INFO  ce[][c.z.h.HikariDataSource] HikariPool-1 - Start completed.
2024.01.31 08:16:34 WARN  ce[][o.s.db.dialect.H2] H2 database should be used for evaluation purpose only.
2024.01.31 08:16:35 INFO  ce[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2024.01.31 08:16:35 INFO  ce[][o.s.c.c.CePluginRepository] Load plugins
2024.01.31 08:16:36 INFO  ce[][o.s.c.c.ComputeEngineContainerImpl] Running Community edition
2024.01.31 08:16:36 INFO  ce[][o.s.ce.app.CeServer] Compute Engine is started
2024.01.31 08:16:36 INFO  app[][o.s.a.SchedulerImpl] Process[ce] is up
2024.01.31 08:16:36 INFO  app[][o.s.a.SchedulerImpl] SonarQube is operational

logs for the sonar(postgres) container:

ostgreSQL Database directory appears to contain a database; Skipping initialization

2024-01-31 08:16:18.618 UTC [1] LOG:  starting PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-01-31 08:16:18.618 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-01-31 08:16:18.618 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2024-01-31 08:16:18.623 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-01-31 08:16:18.640 UTC [29] LOG:  database system was shut down at 2024-01-31 08:16:18 UTC
2024-01-31 08:16:18.647 UTC [1] LOG:  database system is ready to accept connections
2024-01-31 08:21:18.719 UTC [27] LOG:  checkpoint starting: time
2024-01-31 08:21:18.733 UTC [27] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.002 s, total=0.014 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/1954B00, redo lsn=0/1954AC8

I have given the required file permissions as well:

sudo chmod 777 /home/ubuntu/sonar-data/data /home/ubuntu/sonar-data/extensions /home/ubuntu/sonar-data/logs

I want to use Sonarqube for production in the future. So any guidance is appreciated with regards to changes to be made or practices to be followed, even if you can direct me to some useful guides :slight_smile:

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

The problem is probably that you aren’t really connected to the database, therefore it’s resetting to the embedded database on each restart.

Docker images updated

  • The deprecated SONARQUBE_JDBC_USERNAME, SONARQUBE_JDBC_PASSWORD, and SONARQUBE_JDBC_URL variables have been removed. See Environment variables for up-to-date configuration variables.