Project/Quality Gate/ Quality Profile/Users missing while upgrading from 8.9.0/9.8.0 to 9.9.0

While upgrading Sonarqube from 8.9.0 LTS to 9.9.0 LTS community Project/Quality Gate/ Quality Profile/Users are not shown in the Sonarqube interface.

Upgrade is performed in the following manner and after each upgrade verified user and project details are present in Sonarqube

8.9.0 → 9.0.0 → 9.3.0 → 9.5.0 → 9.7.0 → 9.8.0

Same issue is faced while upgrading from 9.8.0 to 9.9.0

Issue is faced on both scenarios:
8.9.0 → 9.9.0
9.8.0 → 9.9.0

Database–> Postgresql 12.11

Solution tried:

  1. Stopped docker container, Cleared sonarqube/data/es7 and restarted docker container.

Hey there.

You mentioned Docker. Did you notice this part of the upgrade note?

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.

Hi yes we noticed that below is our docker run script. could you guide on where we need to update that variable?

function docker_run {
log “Docker run command”
export POSTGRES_USERNAME=$(aws secretsmanager get-secret-value --secret-id ${aws_secretsmanager_secret_id} --region eu-central-1 | jq -r ‘(.SecretString | fromjson | .postgres_username)’)
export POSTGRES_PASSWORD=$(aws secretsmanager get-secret-value --secret-id ${aws_secretsmanager_secret_id} --region eu-central-1 | jq -r ‘(.SecretString | fromjson | .postgres_password)’)
mkdir -p /EBS/sonarqube/conf /EBS/sonarqube/data /EBS/sonarqube/logs /EBS/sonarqube/extensions
chown -R 1000:1000 /EBS/sonarqube
export SONARQUBE_HOME=/EBS/sonarqube
docker run -d --name sonarqube
–ulimit nofile=65535:65535
-p 9000:9000
-e sonar.web.context=
-e sonar.jdbc.username=$POSTGRES_USERNAME
-e sonar.jdbc.password=$POSTGRES_PASSWORD
-e sonar.jdbc.url=jdbc:postgresql://${postgress_endpoint}:5432/sonarqube
-e sonar.search.javaAdditionalOpts=-Dlog4j2.formatMsgNoLookups=true
-v $SONARQUBE_HOME/conf:/opt/sonarqube/conf
-v $SONARQUBE_HOME/extensions:/opt/sonarqube/extensions
-v $SONARQUBE_HOME/logs:/opt/sonarqube/logs
-v $SONARQUBE_HOME/data:/opt/sonarqube/data
sonarqube:${sonarqube_community_version}-community
}

Here.

1 Like

Thanks for the quick response Colin.

I have one more doubt. What is the difference between sonar.jdbc.username and SONAR_JDBC_USERNAME?

In this document (Install the server), the configuration line below is mentioned to access the database and configure the database settings

Example for PostgreSQL
sonar.jdbc.username=sonarqube
sonar.jdbc.password=mypassword
sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube

That would be for if these properties were being configured in a conf/sonar.properties file. You should use environment variables (and the ones documented for the version you’re upgrading to) when deploying via Docker.

Hi colin we have upgrade our sonarqube docker container from 9.8 to 9.9.3 after ugrade sonarqube is not loading and showing mainteance page

upon checking we could see below warning error in sonar.log. could you please check ?

2024.01.25 13:21:18 WARN app[startup] ################################################################################
2024.01.25 13:21:18 WARN app[startup] The database must be manually upgraded. Please backup the database and browse /setup. For more information: https://docs.sonarqube.org/latest/setup/upgrading
2024.01.25 13:21:18 WARN app[startup] ################################################################################
[root@ip-10-160-191-30 logs]#

Docker container is up
[root@ip-10-160-191-30 logs]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dc8d76ca290d sonarqube:9.9.3-community “/opt/sonarqube/dock…” 40 minutes ago Up 40 minutes 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp sonarqube
[root@ip-10-160-191-30 logs]#

my postgres RDS version is 12.14

We could see below log from ce.log

[root@ip-10-160-191-45 logs]# cat ce.log
2024.01.26 08:12:36 INFO ce[o.s.p.ProcessEntryPoint] Gracefully stopping process
2024.01.26 08:12:36 INFO ce[o.s.ce.app.CeServer] Compute Engine is stopping…
2024.01.26 08:12:36 INFO ce[o.s.c.t.CeProcessingSchedulerImpl] Gracefully stopping workers…
2024.01.26 08:12:36 INFO ce[c.z.h.HikariDataSource] HikariPool-1 - Shutdown initiated…
2024.01.26 08:12:36 INFO ce[c.z.h.HikariDataSource] HikariPool-1 - Shutdown completed.
2024.01.26 08:12:36 INFO ce[o.s.ce.app.CeServer] Compute Engine is stopped
[root@ip-10-160-191-45 logs]#

You’ve just reached step 3 of the upgrade guide

  1. Go to http://yourSonarQubeServerURL/setup and follow the setup instructions.

Hi Colin, in my case Sonarqube is installed as docker container in AWS ec2 instance and AWS PostgreSQL RDS instance is been used for database, and the version is already 12.14. Still do I need to follow these steps?

This is required to migrate the schema from one that works with an v8.9 instance to one that works with a v9.9 instance. it’s not upgrading/migrating your database software.

Thank you Colin, it works…

1 Like