Thursday, 1 December 2016

Setting Up Sonar Server for TFS

SonarQube helps to check overall health of your source code.This allows you to write cleaner code and it will improve your code base dramatically. SonarQube is capable of integrating into CI engines and facilitate DevOps by providing code quality measurements. It supports multiple languages and makes it easy for you to detects bugs in your code. Qaulity management of your code bases can be centralized and integration with TFS server and Team services is seamless. Lets look at setting up a SonarQube server to be used with TFS.


Below are instructions to setup a Sonarqube server in windows platform with SQL server.
1. Install SQL server 2012 or 2014.
2.  Create SQL Server data base named sonar with collation settings set to case-sensitive (CS) and accent-sensitive (AS).image
3 Download Java Runtime Environment 8 or later and install it. Set JAVA_HOME and JRE_HOME.image
4. Download Sonarqube 6.1 and extract the zip file into C:\sonarqubeimage
5. Set connection info in C:\sonarqube\conf\sonar.properties
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar
sonar.jdbc.username=sonarqube
sonar.jdbc.password=mypassword  
6. In SQL Configuration Manager, enable TCP/IP for SQL network.image image 
7. Restart SQL services
8. Run startsonar.bat in C:\sonarqube\bin\windows-x86-64, to test. This creates the tables in DB. Sonar is running. image
You can now browse SonarQube at http://localhost:9000 (the default System administrator credentials are admin/admin).
9. Stop by pressing ctrl+c
To install
  1. Install/uninstall NT service (may have to run these files via Run As Administrator):
    %SONARQUBE_HOME%/bin/windows-x86-32/InstallNTService.bat
    %SONARQUBE_HOME%/bin/windows-x86-32/UninstallNTService.bat
  2. Start/stop the service:
    %SONARQUBE_HOME%/bin/windows-x86-32/StartNTService.bat
    %SONARQUBE_HOME%/bin/windows-x86-32/StopNTService.bat


Allow firewall inbound port 9000 to make http://sonarsvr.domainx.local:9000/ work.
image





No comments: