Reuse existing database for test environment during upgrade?

Status Quo:

  1. I have sonarqube enterprise 8.9.6 in production (on docker).
  2. with a database postgres 12.3-1 backend

To be done:

  1. Upgrade to sonarqube enterprise 8.9.10
  2. with a postgres 14.6 backend.
  3. Testing new version on separate test instance.

My plan for upgrading to the new version is as follows:

  1. Create a new sonarqube test container version 8.9.10 with a separate license key.
  2. Create an empty database on new postgres server (version 14.6).
  3. Clone the production data to the test environment.
  4. Perform tests on the test instance.
  5. After successful testing on the test instance
    a. Stop the production container version 8.9.6.
    b. Start a new production container version 8.9.10
    c. Ready!?

My Questions:

  1. Does this plan sound reasonable? Did I miss something important?
  2. How can I clone the production data into the test instance?
    a. Project move (Project move) seems not to be an option, as it is required to have the exact same version of sonarqube on both instances.
    b. Will it work, if I create a dump of the prod database (postgresql 12.3) and import the dump into the test database (postgresql 14.6).
    c. Any better suggestions?

Hey there.

Yes, restoring a backup of your SonarQube database to a test environment and practicing there is the recommended practice.

You should reference any documentation specific to your Postgres database about how to perform a backup and restore (look out for pg_dump and pg_restore)

And, you should know that you can upgrade directly to the current LTS (v9.9.0) from v8.9.6, you don’t have to make a stop at v8.9.10 :smiley:

@Colin: Thanks for the hint to skip the the 8.9.10 version. I still had to do it for compliance, but, as you suggested, it was not really nescessary.

1 Like