After preparing the upgrade of our SonarQube version in the previous post, about upgrade prerequisites, which allowed us to present how to make a backup of our Oracle database (or at least of the Sonar schema), we will see now how to perform this upgrade.
Remember that you can always consult the documentation on this subject since the SonarSource site. This procedure changes very rarely, but I recommend that you always refer to it, in case this article would become obsolete.
Also, our will realize an upgrade of SonarQube installed as a Windows service.
We have seen in the previous post how to perform our upgrade from the Update Center of SonarQube. Here are the operations to do, at the time I dit it:
We can see a number of operations to be performed on the plugins we have installed in our environment code analysis.
Generally, I doing this upgrade of plugins in two steps, the first of which is to uninstall the plugins that I do not want anymore, or are no more compatible with the new version of SonarQube that I want to install.
You can select multiple plugins to uninstall.
It is necessary to restart SonarQube to update the Update Center. In our environment, it requires a Start / Stop of the Windows service.
Upgrade / Installation de plugins
Once SonarQube has started again, we can see in the Update Center that the plugins previously deleted are not anymore present in the tab ‘Installed Plugins’. They also have disappeared from the directory ‘..\extensions\plugins’ where they are located by default.
We can now perform a second step to upgrade the plugins that need to be …
… and install either new plugins, either new versions of plugins that we did remove in the previous step.
A new Re-start of the Windows service, and back to the Update Center to ensure that all operations have been successfull. You can also download yourself the plugins from the SonarSource site into their own folder, but this requires the knowledge of the correct versions of the plugins. And this is where the Update Center does the job for you!
We already addressed this subject some months ago, in this post Sonar Upgrade, when Sonar was not yet named SonarQube. The only other difference is that this article was related to a Sonar installation under Tomcat while now we have SonarQube as a Windows service. But the architecture of our environment remains the same, and therefore the steps to update also. So I will just list them without much details.
Uninstall the current SonarQube Service
First, we must unininstall the current version of the SonarQube service. For this, we open a DOS command windows, and go into:
- the ‘..\bin’ directory of the current SonarQube version;
- then the sub-directory corresponding to our OS.
Which is ‘sonar-3..5.1\bin\windows-x86-64’, in my case.
In this folder, we launch the file ‘UninstallNTService.bat’.
The following figure shows this uninstall in a DOS windows and the message about the successfull remove of the Windows service SonarQube.
Prepare to install the new version SonarQube
We will get the new version from the download page of SonarSource. Take this opportunity to read the Release Notes, never a loss of time.
I’ll unzip this new version in its own directory: ‘..\sonar 3.7.2′.
I will then reuse the existing configuration files, so:
- Copy the files ‘sonar.properties’ (with the parameters of your environment) and ‘wrapper.conf’ from ‘..\sonar-3.5.1\conf’ to ‘..\sonar-3.7.2\conf’.
- Copy the Oracle database driver from ‘..\sonar-3.5.1\extensions\jdbc-driver\oracle\ojdbc6.jar’ the directory ‘..\sonar-3.7.2\extensions\jdbc-driver\oracle’ (depending of the database you are using).
- Copy the .jar files for the plugins installed in your current environment from ‘..\sonar-3.5.1\extensions\plugins’ to ‘..\sonar-3.7.2\extensions\plugins’.
And if you want to install new plugins, or forgot to install one from the Update Center, you can do it now.
Now that we have configured the new version of SonarQube, we can install the corresponding service. To do this, we go into the ‘bin’ directory of the new version: ‘sonar-7..3.2\bin\windows-x86-64’, and we launch the file ‘InstallNTService.bat’ .
Note: You must choose between launching a 64-bit or 32-bit batch file, depending on the version – 64-bit or 32-bit – of your JVM, and therefore of your Java installation.
You can start the Sonar service to verify that the installation was successful. If you encounter an error message, I suggest you check that your user has the rights to run the Windows service.
One final step is to update the SonarSource database from the ‘Setup’ page.
Click on the ‘Upgrade’ button.
And after few minutes (depending on the size of you SonarQube repository):
Going to the Update Center, we can see that now our environment is ‘up to date’.
Et voilà !
See you soon for the next post: we will celebrate 2 years of this blog Qualilogy.