Data Migration with a ServerID change (same SonarQube version)

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

    SonarQube Developer Edition
    Version: 7.9.1.27448

  • what are you trying to achieve

    As we are trying to host our SonarQube instance in our Kubernetes cluster instead of hosting it in a mere docker container, we need to migrate all the existing data in our current SonarQube instance to the new one.
    We will be using the exact same version of SonarQube and same version of PostgreSQL, but we will have to change the connection string (URL) to the database, which will in turn change the original ServerID.

  • what have you tried so far to achieve this

    We have tried the following:

    1. Generate a dump from our existing database (pg_dump) and load it to our new database before starting SonarQube
      This resulted in the situation where I can check all the projects and scan results from Administration > Projects > Management but the Projects page is not showing any project. Also, License Manager warns us that there is mismatch between the ServerID that the registered license key was issued for and the current ServerID, which should be solved by reissuing a license key and set that up again. We are not sure if setting a newly issued license key will solve the issue of the Projects page not showing any projects.
    2. Try using the following tool: https://github.com/awltech/sonar-data-migrator
      This didn’t really do anything because it seems that the tool assumed that we run scans of the same projects that we have in the old instance before running the tool. However, we have tons of projects with multiple branch analyses in the old one, and it is not feasible at this point to run the same scans again in the new instance.

With that said, our questions are

  1. What is the best way to migrate existing data to a new instance when we are not upgrading SonarQube version but only changing ServerID?
  2. What needs to be done for the Projects page to show projects that are only visible in Administration > Projects > Management in addition to the security settings?

I appreciate your support!