{"id":641,"date":"2013-09-08T16:19:35","date_gmt":"2013-09-08T15:19:35","guid":{"rendered":"http:\/\/qualilogy.com\/en\/?p=641"},"modified":"2013-09-08T18:05:56","modified_gmt":"2013-09-08T17:05:56","slug":"migrate-sonarqube-tomcat-to-windows-service","status":"publish","type":"post","link":"http:\/\/qualilogy.com\/en\/migrate-sonarqube-tomcat-to-windows-service\/","title":{"rendered":"Migrate SonarQube from Tomcat to a Windows service"},"content":{"rendered":"<p><a href=\"http:\/\/vicken.deviantart.com\/\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft  wp-image-1078\" alt=\"SonarQubeService\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/SonarQubeService.jpg\" width=\"315\" height=\"473\" \/><\/a><\/p>\n<p>As I have already mentioned, SonarQube will soon be no\u00a0longer available for Tomcat, but only as a Windows service. That means that I will have to migrate my platform SonarQube \/ Jenkins.<\/p>\n<p>This brings some questions: will I loose my settings? Will I loose my analysis? SonarQube uses a database to store the results of the analysis, so we can expect to keep them and their history.<\/p>\n<p>But what about my SonarQube configuration? Will I have to reinstall plugins? Damn, where did I put the license keys for these plugins? And my Quality Profiles? Are they stored in the database or in a file?<\/p>\n<p><!--more--><\/p>\n<p>In what order should I proceed: first migrate Jenkins then check if Jenkins is still able to recognize my SonarQube installation and continue to work on existing projects? In fact, I will start by migrating SonarQube, because it is far simpler than Jenkins.<\/p>\n<p>We then have the opportunity to continue with this last one and install it as a service, so we will finally be able to get rid of Tomcat.<\/p>\n<h2>Migrate SonarQube to a Windows service<\/h2>\n<h3>Objectives<\/h3>\n<p>Note that I will migrate my current version 3.5.1\u00a0of SonarQube. There is a newer version 3.7 &#8230; at the time I am writing this post. It changes very quickly, the SonarSource team is highly productive. This latest 3.7 version has many new features, and it will be the subject of future posts.<\/p>\n<p>This is also an opportunity to check how to perform an upgrade of version of SonarQube as a service. If this topic interests you, we have seen how to perform such an upgrade there:\u00a0<a style=\"line-height: 1.714285714;font-size: 1rem\" title=\"Upgrade Sonar\" href=\"http:\/\/qualilogy.com\/en\/sonar-upgrade\/\" target=\"_blank\">Upgrade Sonar<\/a>.<\/p>\n<p>I will also dedicate this post to a migration of the SonarQube as a Windows service, and ensure that I can continue to work with my existing repository: my dashboard, my analysis, my configurations, etc.. We will see in the next post the changes to make in my current Jenkins (under Tomcat) to work with my new SonarQube installation.<\/p>\n<h3>Documentation<\/h3>\n<p>Like any (good) IT specialist, I never read documentations, and especially not those about installation. I find it quite unnatural if a software does not know how to install itself (you know: &#8216;Next&#8217;, &#8216;Next&#8217;, &#8216;Next&#8217;, etc.) and requires to first read an installation guide. But well, here is the link to the SonarSource website:\u00a0<a style=\"line-height: 1.714285714;font-size: 1rem\" title=\"Documentation SonarSource\" href=\"http:\/\/docs.codehaus.org\/display\/SONAR\/Running+SonarQube+as+a+Service+on+Windows\" target=\"_blank\">http:\/\/docs.codehaus.org\/display\/SONAR\/Running+SonarQube+as+a+Service+on+Windows<\/a>.<\/p>\n<p>Well, it looks super simple:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_InstallWinService.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1088\" alt=\"Sonar_InstallWinService\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_InstallWinService.jpg\" width=\"526\" height=\"102\" \/><\/a><\/p>\n<h3>Installation<\/h3>\n<p>I will first stop Tomcat, to be sure that I will not be working with my current SonarQube installation.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Stop_Tomcat.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1089\" alt=\"Stop_Tomcat\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Stop_Tomcat.jpg\" width=\"478\" height=\"92\" \/><\/a><\/p>\n<p>Then I open a DOS windows and go to the directory of installation of SonarQube.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_Bin.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1090\" alt=\"Sonar_Bin\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_Bin.jpg\" width=\"679\" height=\"344\" \/><\/a><\/p>\n<p>My current SonarQube version is 3.5.1. In the foleer &#8216;\\sonar-3.5.1\\bin&#8217;, I can find two sub-directories \u2018windows-x86-32\u2019 and \u2018windows-x86-64\u2019, this last one for an installation with a Windows 64 bits.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_InstallWinService2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-1091\" alt=\"Sonar_InstallWinService2\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_InstallWinService2.jpg\" width=\"272\" height=\"126\" \/><\/a><\/p>\n<p>I won&#8217;t go into details of what this batch program. does. We&#8217;ll just follow the recommendation of the documentation and run this program as an Administrator.<\/p>\n<p>It&#8217;s very fast. I note the appearance of the Sonar service in the Services window.<\/p>\n<p><a style=\"line-height: 1.714285714;font-size: 1rem\" href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_Service.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1092\" alt=\"Sonar_Service\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_Service.jpg\" width=\"537\" height=\"48\" \/><\/a><\/p>\n<p>I can launch this service, either with a\u00a0&#8216;Start&#8217; from this service, either executing the corresponding file in the &#8216;bin&#8217; directory of SonarQube, from my DOS window.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/sonar_Runservice1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1095\" alt=\"sonar_Runservice1\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/sonar_Runservice1.jpg\" width=\"679\" height=\"120\" \/><\/a><\/p>\n<p>But this will bring the following error message:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceLaunchError.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1096\" alt=\"Sonar_ServiceLaunchError\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceLaunchError.jpg\" width=\"684\" height=\"119\" \/><\/a><\/p>\n<p>Same if I try to start the SonarQube service:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceLaunchError2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1097\" alt=\"Sonar_ServiceLaunchError2\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceLaunchError2.jpg\" width=\"446\" height=\"184\" \/><\/a><\/p>\n<p><a style=\"line-height: 1.714285714;font-size: 1rem\" href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-1098\" alt=\"Sonar_ServiceProp1\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp1.jpg\" width=\"214\" height=\"237\" \/><\/a><\/p>\n<p>Now, if we open the service Properties (right click on the service to get the menus)\u2026<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u2026and goes on the tab &#8216;Log On&#8217;.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1100\" alt=\"Sonar_ServiceProp2\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp2.jpg\" width=\"428\" height=\"183\" \/><\/a><\/p>\n<p>Check the box \u2018This account\u2019 and then the button \u2018Browse\u2019 :<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1103\" alt=\"Sonar_ServiceProp3\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp3.jpg\" width=\"427\" height=\"264\" \/><\/a><\/p>\n<p>In the following windows, click the button &#8216;Advanced&#8217;.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp4a.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1104\" alt=\"Sonar_ServiceProp4a\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp4a.jpg\" width=\"471\" height=\"257\" \/><\/a><\/p>\n<p>Then &#8216;Find Now&#8217; in order to list the users who can connect (Log On) to launch this service.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1105\" alt=\"Sonar_ServiceProp4\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp4.jpg\" width=\"538\" height=\"523\" \/><\/a><\/p>\n<p>I will select the Windows user I use to log on my laptop:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp5.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1106\" alt=\"Sonar_ServiceProp5\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp5.jpg\" width=\"286\" height=\"145\" \/><\/a><\/p>\n<p>&#8216;OK&#8217; to validate. Notice that my Window user is prefixed with the ID of my machine (JPFPC).<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp6.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1107\" alt=\"Sonar_ServiceProp6\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/Sonar_ServiceProp6.jpg\" width=\"475\" height=\"259\" \/><\/a><\/p>\n<p>&#8216;OK&#8217; again to get back to the &#8216;Log On&#8217; tab, where I can enter the password corresponding to my user. &#8216;Apply&#8217; then &#8216;OK&#8217; to close the Properties window.<\/p>\n<p>Now we can start again the service and &#8230;\u00a0Yes, it works ! The error message has disappeared and the service displays a &#8216;Started&#8217; status.<\/p>\n<h3>Validation<\/h3>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/SonarQubeURL.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-1109\" alt=\"SonarQubeURL\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2013\/09\/SonarQubeURL.jpg\" width=\"395\" height=\"143\" \/><\/a><\/p>\n<p>Your SonarQube dashboard- as a Windows service &#8211; is available at the url <strong>localhost:9000<\/strong>. Enter it in your favorite browser, and you will see your SonarQube portal as it was the last one you&#8217;ve been consulting it.<\/p>\n<p>You can check that your previous analysis appear correctly, your custom Quality Profiles are present, your plugins are also there, and active (no need to re-enter the licenses). Your entire SonarQube configuration\u00a0under Tomcat and your projects, well your whole repository, is fully available and ready for use.<\/p>\n<p>We still have to perform an analysis from our current Jenkins under Tomcat.<\/p>\n<p>This we will see in the next post. In the meantime, have a good week.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I have already mentioned, SonarQube will soon be no\u00a0longer available for Tomcat, but only as a Windows service. That means that I will have to migrate my platform SonarQube \/ Jenkins. This brings some questions: will I loose my settings? Will I loose my analysis? SonarQube uses a database to store the results of [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-641","post","type-post","status-publish","format-standard","hentry","category-sonar-installation"],"_links":{"self":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/641"}],"collection":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/comments?post=641"}],"version-history":[{"count":16,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/641\/revisions"}],"predecessor-version":[{"id":643,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/641\/revisions\/643"}],"wp:attachment":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/media?parent=641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/categories?post=641"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/tags?post=641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}