Upgrade guide
On this page
This is a generic guide for upgrading across versions of SonarQube. Carefully read the release upgrade notes of your target version and of any intermediate version(s).
Before upgrading, we recommend practicing your upgrade on a staging environment that's as similar to your production environment as possible. For more on this and other important upgrading concepts, read through the Before you upgrade page.
Before upgrading, back up your SonarQube database. Upgrade problems are rare, but you'll want the backup if anything does happen.
Database disk usage recommendations
During your upgrade, tables may be duplicated to speed up the migration process. This could cause your database disk usage to temporarily increase to as much as double the normal usage. Because of this, we recommend that your database disk usage is below 50% before starting a migration.
Upgrading instructions
You can upgrade your SonarQube instance using the ZIP file, Docker image, or Helm Chart. To expand the upgrading instructions, click the option below that corresponds to your setup.
If your upgrade requires the rebuild of Elasticsearch indexes, your projects and applications will become available as they are reindexed. Portfolios won't be available until all projects are indexed.
Upgrading from the ZIP file
To upgrade from the ZIP file:
- Download and unzip the SonarQube distribution of your edition in a fresh directory, let's say
<NEW_SONARQUBE_HOME>
- If you're using third-party plugins, Manually install plugins that are compatible with your version of SonarQube. Use the plugin version matrix to ensure that the versions you install are compatible with your server version. Simply copying plugins from the old server to the new is not recommended; incompatible or duplicate plugins could cause startup errors. Analysis of all languages provided by your edition is available by default without plugins.
- Update the contents of
sonar.properties
file (in<NEW_SONARQUBE_HOME>/conf
) with the settings in the<OLD_SONARQUBE_HOME>/conf
directory (web server URL, database, ldap settings, etc.). Do not copy-paste the old files. If you are using the Oracle DB, copy its JDBC driver into<NEW_SONARQUBE_HOME>/extensions/jdbc-driver/oracle
- Stop your old SonarQube Server
- Start your new SonarQube Server
- Browse to
http://yourSonarQubeServerURL/setup
and follow the setup instructions - Reanalyze your projects to get fresh data
Upgrading from the Docker image
If you're upgrading with an Oracle database or you're using plugins, you can reuse your extensions volume from the previous version to avoid moving plugins or drivers. Use the Plugin version matrix to ensure that your plugins are compatible with your version. Analysis of all languages provided by your edition is available by default without plugins.
To upgrade SonarQube using the Docker image:
- Stop and remove the existing SonarQube container (a restart from the UI is not enough as the environment variables are only evaluated during the first run, not during a restart):
2. Run Docker
3. Go to http://yourSonarQubeServerURL/setup
and follow the setup instructions.
4. Reanalyze your projects to get fresh data.
From 8.9.x LTS to another 8.9.x LTS
No specific Docker operations are needed, just use the new tag.
Upgrading from the Helm chart
If you're upgrading with an Oracle database or you're using plugins, you can reuse your extensions PVC from the previous version to avoid moving plugins or drivers. Use the Plugin Version Matrix to ensure that your plugins are compatible with your version. Analysis of all languages provided by your edition is available by default without plugins.
To upgrade SonarQube using our official Helm Chart:
- Change the SonarQube version on your
values.yaml
. - Redeploy SonarQube with the same helm chart:
3. Go to http://yourSonarQubeServerURL/setup
and follow the setup instructions.
4. Reanalyze your projects to get fresh data.
Please verify that any custom configurations or custom values.yaml
files contain only parameters that are still compatible with the targeted chart, and adjust them if needed. Some default parameters may have changed between versions of the chart.
Reverting to the previous version
If you need to revert to the previous version of SonarQube, the high-level rollback procedure for all deployments is as follows:
- Shutdown your SonarQube instance or cluster.
- Roll back your database to the backup you took before starting the upgrade.
- Switch back to the previous version of your SonarQube installation.
- Start your SonarQube instance or cluster.
Changing your edition
You can move to a different SonarQube edition (for example, moving from Community Edition to a commercial edition) while you're upgrading your version. Just use the appropriate edition file or Docker image tag in the upgrade instructions above.
If you want to move to a different edition without upgrading your SonarQube version, the steps are exactly the same as in the upgrading instructions above without needing to navigate to http://yourSonarQubeServerURL/setup
or reanalyze your projects.
Migrating from a ZIP file instance to a Docker instance
To migrate from the ZIP file to Docker:
- Configure your Docker instance to point to your existing database.
- Shut down your ZIP instance.
- Start your Docker instance.
Additional steps and information
Oracle clean-up
Starting with version 6.6, there's an additional step you may want to perform if you're using Oracle. On Oracle, the database columns to be dropped are now marked as UNUSED and are not physically dropped anymore. To reclaim disk space, Oracle administrators must drop these unused columns manually. The SQL request is ALTER TABLE foo DROP UNUSED COLUMNS
. The relevant tables are listed in the system table all_unused_col_tabs
.
Additional database maintenance
Once you've finished a technical upgrade, you should refresh your database's statistics and rebuild your database's indices before starting SonarQube and reanalyzing your projects.
For PostgreSQL, that means executing VACUUM FULL
. According to the PostgreSQL documentation:
Scanner update
When upgrading SonarQube, you should also make sure you’re using the latest versions of the SonarQube scanners to take advantage of features and fixes on the scanner side. Please check the documentation pages of the scanners you use for the most recent version compatible with SonarQube and your build tools.
See also this section for what might change after a software update.
SonarQube as Linux or Windows service
If you use an external configuration, such as a script or Windows Service to control your server, you'll need to update it to point to <NEW_SONARQUBE_HOME>
.
- For Linux it depends on how you implemented the service.
- For Windows you can update your service by running:
Rebuilding indexes
If your upgrade requires the rebuild of Elasticsearch indexes, your projects and Applications will become available as they are reindexed. Portfolios won't be available until all projects are indexed.
Release upgrade notes
Usually, SonarQube releases come with some specific recommendations for upgrading from the previous version. You should read the upgrade notes for each version between your current version and the target version.
Was this page helpful?