Skip to content

Instantly share code, notes, and snippets.

@textarcana
Last active September 12, 2016 05:37
Show Gist options
  • Save textarcana/4679293 to your computer and use it in GitHub Desktop.
Save textarcana/4679293 to your computer and use it in GitHub Desktop.

Revisions

  1. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions _install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,9 @@ unzip sonar-3.4.1.zip
    wget --no-check-certificate https://raw.github.com/SonarSource/sonar/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql
    mysql -u root -p < create_database.sql

    # edit /etc/my.cnf and add the following line to the [mysqld] block:
    # max_allowed_packet=500M

    # start sonar
    sonar-3.4.1/bin/linux-x86-64/sonar.sh start

  2. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion jenkins-and-bamboo-integration.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,5 @@
    My Jenkins master config looks like this (Using the default Sonar Web and MySQL DB passwords.): <img src="https://farm9.staticflickr.com/8326/8433506400_d09f376299_o.png">
    # Jenkins integration

    My Jenkins master config looks like this (Using the default Sonar Web and MySQL DB passwords.):

    <img src="https://farm9.staticflickr.com/8326/8433506400_d09f376299_o.png">
  3. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions jenkins-and-bamboo-integration.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    My Jenkins master config looks like this (Using the default Sonar Web and MySQL DB passwords.): <img src="https://farm9.staticflickr.com/8326/8433506400_d09f376299_o.png">
  4. @textarcana-automation textarcana-automation renamed this gist Jan 31, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. @textarcana-automation textarcana-automation revised this gist Jan 31, 2013. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -34,8 +34,6 @@ chkconfig --add sonar
    wget http://repository.codehaus.org/org/codehaus/sonar-plugins/sonar-runner/2.0/sonar-runner-2.0.zip
    unzip sonar-runner-2.0.zip

    export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0

    # edit /var/sonar/sonar-runner-2.0/conf/sonar-runner.properties
    # and uncomment the lines pertaining to mysql
    # and uncomment and update the domain name of the sonar host
  6. Noah Sussman renamed this gist Jan 31, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. @textarcana-automation textarcana-automation revised this gist Jan 31, 2013. 1 changed file with 2 additions and 5 deletions.
    7 changes: 2 additions & 5 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -71,11 +71,8 @@ pear install PHP_CodeSniffer-1.3.2
    # the CLI says "starting sonar" and when the Web UI actually becomes
    # available.

    # Now test the install.
    #
    # Check out the example PHP project and copy the sonar-project.properties file
    # from this repo into the root of the php project directory.
    #
    # Now test the install:
    # Check out the example PHP project
    # See https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/php/php-sonar-runner

    git clone https://github.com/SonarSource/sonar-examples
  8. @textarcana-automation textarcana-automation revised this gist Jan 31, 2013. 1 changed file with 0 additions and 16 deletions.
    16 changes: 0 additions & 16 deletions sonar-project.properties
    Original file line number Diff line number Diff line change
    @@ -1,16 +0,0 @@
    # Required metadata
    sonar.projectKey=org.codehaus.sonar:php-sonar-runner
    sonar.projectName=PHP project analyzed with the Sonar Runner
    sonar.projectVersion=1.0

    # Comma-separated paths to directories with sources (required)
    sonar.sources=.

    # Language
    sonar.language=php

    # To deactivate features related to unit tests execution and coverage
    sonar.dynamicAnalysis=false

    # Encoding of the source files
    sonar.sourceEncoding=UTF-8
  9. @textarcana-automation textarcana-automation revised this gist Jan 31, 2013. 1 changed file with 49 additions and 18 deletions.
    67 changes: 49 additions & 18 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,41 @@
    # Sonar for PHP installation for CentOS 6
    # See http://docs.codehaus.org/display/SONAR/Installing+PHP+Environment

    mkdir /var/sonar
    wget http://repository.codehaus.org/org/codehaus/sonar-plugins/sonar-runner/2.0/sonar-runner-2.0.zip
    unzip sonar-runner-2.0.zip

    export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0

    /sbin/service mysqld start
    sudo /usr/bin/mysql_secure_installation
    # for non-production instances, choose not to create a root password

    mkdir /var/sonar
    wget http://dist.sonar.codehaus.org/sonar-3.4.1.zip
    unzip sonar-3.4.1.zip

    # edit sonar-3.4.1/conf/sonar.properties
    # and update sonar.web.host
    # then comment out the default sonar.jdbc.url
    # and uncomment the lines for jdbc mysql driver

    wget --no-check-certificate https://raw.github.com/SonarSource/sonar/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql
    mysql -u root -p < create_database.sql

    # start sonar
    sonar-3.4.1/bin/linux-x86-64/sonar.sh start

    # Installing Sonar as a service.
    # See http://docs.codehaus.org/display/SONAR/Running+Sonar+as+a+Service+on+Linux
    #
    # copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar

    ln -s /var/sonar/sonar-3.4.1/bin/linux-x86-64/sonar.sh /usr/bin/sonar
    chmod 755 /etc/init.d/sonar
    chkconfig --add sonar

    # download the sonar CLI

    wget http://repository.codehaus.org/org/codehaus/sonar-plugins/sonar-runner/2.0/sonar-runner-2.0.zip
    unzip sonar-runner-2.0.zip

    export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0

    # edit /var/sonar/sonar-runner-2.0/conf/sonar-runner.properties
    # and uncomment the lines pertaining to mysql
    # and uncomment and update the domain name of the sonar host
    @@ -28,8 +50,7 @@ yum -y install php-devel
    pecl install xdebug

    # edit /etc/php.ini and add this line:
    # zend_extension="FULL_PATH_TO/xdebug.so"

    # zend_extension="/usr/lib64/php/modules/xdebug.so"

    pear channel-discover pear.pdepend.org
    pear install pdepend/PHP_Depend-1.0.3
    @@ -39,16 +60,26 @@ pear install --alldeps phpmd/PHP_PMD-1.3.2

    pear install PHP_CodeSniffer-1.3.2

    # Installing Sonar as a service.
    # See http://docs.codehaus.org/display/SONAR/Running+Sonar+as+a+Service+on+Linux
    #
    # copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar

    ln -s /var/sonar/sonar-runner-2.0/bin/sonar-runner /usr/bin/sonar
    chmod 755 /etc/init.d/sonar
    chkconfig --add sonar
    # Now visit your sonar instance in a browser and install the PHP plugin.
    # See http://docs.codehaus.org/display/SONAR/PHP+Plugin
    # Note the default Sonar user is named "admin" with password "admin"
    #
    # Sign in and go to Configuration (top nav) > Update Center (left nav)
    # then click PHP > install and restart sonar
    #
    # Note when restarting Sonar that it takes about 30 seconds between
    # the CLI says "starting sonar" and when the Web UI actually becomes
    # available.

    # check out a PHP project and copy the sonar-project.properties file
    # Now test the install.
    #
    # Check out the example PHP project and copy the sonar-project.properties file
    # from this repo into the root of the php project directory.
    #
    # See https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/php/php-sonar-runner
    # See https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/php/php-sonar-runner

    git clone https://github.com/SonarSource/sonar-examples
    cd sonar-examples/projects/languages/php/php-sonar-runner
    /var/sonar/sonar-runner-2.0/bin/sonar-runner


  10. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ mysql -u root -p < create_database.sql
    # edit /var/sonar/sonar-runner-2.0/conf/sonar-runner.properties
    # and uncomment the lines pertaining to mysql
    # and uncomment and update the domain name of the sonar host
    # and the line specifying character-encoding (the default of utf-8 is fine)

    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
  11. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,7 @@ mysql -u root -p < create_database.sql

    # edit /var/sonar/sonar-runner-2.0/conf/sonar-runner.properties
    # and uncomment the lines pertaining to mysql
    # and uncomment and update the domain name of the sonar host

    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
  12. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,9 @@ sudo /usr/bin/mysql_secure_installation
    wget --no-check-certificate https://raw.github.com/SonarSource/sonar/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql
    mysql -u root -p < create_database.sql

    # edit /var/sonar/sonar-runner-2.0/conf/sonar-runner.properties
    # and uncomment the lines pertaining to mysql

    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear install phpunit/PHPUnit-3.5.5
  13. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0
    sudo /usr/bin/mysql_secure_installation
    # for non-production instances, choose not to create a root password

    wget https://github.com/SonarSource/sonar/blob/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql
    wget --no-check-certificate https://raw.github.com/SonarSource/sonar/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql
    mysql -u root -p < create_database.sql

    pear channel-discover pear.phpunit.de
  14. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,9 @@ unzip sonar-runner-2.0.zip

    export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0

    /etc/init.d/mysqld start
    /sbin/service mysqld start
    sudo /usr/bin/mysql_secure_installation
    # for non-production instances, choose not to create a root password

    wget https://github.com/SonarSource/sonar/blob/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql
    mysql -u root -p < create_database.sql
  15. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,9 @@ export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0

    /etc/init.d/mysqld start

    wget https://github.com/SonarSource/sonar/blob/master/sonar-application/src/main/assembly/extras/database/mysql/create_database.sql
    mysql -u root -p < create_database.sql

    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear install phpunit/PHPUnit-3.5.5
  16. Noah Sussman revised this gist Jan 31, 2013. 2 changed files with 7 additions and 2 deletions.
    7 changes: 6 additions & 1 deletion install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -36,4 +36,9 @@ pear install PHP_CodeSniffer-1.3.2

    ln -s /var/sonar/sonar-runner-2.0/bin/sonar-runner /usr/bin/sonar
    chmod 755 /etc/init.d/sonar
    chkconfig --add sonar
    chkconfig --add sonar

    # check out a PHP project and copy the sonar-project.properties file
    # from this repo into the root of the php project directory.
    #
    # See https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/php/php-sonar-runner
    2 changes: 1 addition & 1 deletion sonar-project.properties
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ sonar.projectName=PHP project analyzed with the Sonar Runner
    sonar.projectVersion=1.0

    # Comma-separated paths to directories with sources (required)
    sonar.sources=src
    sonar.sources=.

    # Language
    sonar.language=php
  17. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions sonar-project.properties
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Required metadata
    sonar.projectKey=org.codehaus.sonar:php-sonar-runner
    sonar.projectName=PHP project analyzed with the Sonar Runner
    sonar.projectVersion=1.0

    # Comma-separated paths to directories with sources (required)
    sonar.sources=src

    # Language
    sonar.language=php

    # To deactivate features related to unit tests execution and coverage
    sonar.dynamicAnalysis=false

    # Encoding of the source files
    sonar.sourceEncoding=UTF-8
  18. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -35,5 +35,5 @@ pear install PHP_CodeSniffer-1.3.2
    # copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar

    ln -s /var/sonar/sonar-runner-2.0/bin/sonar-runner /usr/bin/sonar
    sudo chmod 755 /etc/init.d/sonar
    sudo chkconfig --add sonar
    chmod 755 /etc/init.d/sonar
    chkconfig --add sonar
  19. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -32,5 +32,8 @@ pear install PHP_CodeSniffer-1.3.2
    # Installing Sonar as a service.
    # See http://docs.codehaus.org/display/SONAR/Running+Sonar+as+a+Service+on+Linux
    #
    # 1. copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar
    # 2.
    # copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar

    ln -s /var/sonar/sonar-runner-2.0/bin/sonar-runner /usr/bin/sonar
    sudo chmod 755 /etc/init.d/sonar
    sudo chkconfig --add sonar
  20. Noah Sussman revised this gist Jan 31, 2013. 2 changed files with 13 additions and 3 deletions.
    1 change: 0 additions & 1 deletion etc_init_d_sonar
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    #!/bin/sh
    #
    # rc file for Sonar
    15 changes: 13 additions & 2 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,14 @@
    # Sonar for PHP installation for CentOS 6
    # See http://docs.codehaus.org/display/SONAR/Installing+PHP+Environment

    mkdir /var/sonar
    wget http://repository.codehaus.org/org/codehaus/sonar-plugins/sonar-runner/2.0/sonar-runner-2.0.zip
    unzip sonar-runner-2.0.zip

    export SONAR_RUNNER_HOME=/var/sonar/sonar-runner-2.0

    /etc/init.d/mysqld start

    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear install phpunit/PHPUnit-3.5.5
    @@ -21,5 +29,8 @@ pear install --alldeps phpmd/PHP_PMD-1.3.2

    pear install PHP_CodeSniffer-1.3.2

    # installing Sonar as a service:
    # copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar
    # Installing Sonar as a service.
    # See http://docs.codehaus.org/display/SONAR/Running+Sonar+as+a+Service+on+Linux
    #
    # 1. copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar
    # 2.
  21. Noah Sussman revised this gist Jan 31, 2013. 2 changed files with 23 additions and 1 deletion.
    19 changes: 19 additions & 0 deletions etc_init_d_sonar
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@

    #!/bin/sh
    #
    # rc file for Sonar
    #
    # chkconfig: 345 96 10
    # description: Sonar system (www.sonarsource.org)
    #
    ### BEGIN INIT INFO
    # Provides: sonar
    # Required-Start: $network
    # Required-Stop: $network
    # Default-Start: 3 4 5
    # Default-Stop: 0 1 2 6
    # Short-Description: Sonar system (www.sonarsource.org)
    # Description: Sonar system (www.sonarsource.org)
    ### END INIT INFO

    /usr/bin/sonar $*
    5 changes: 4 additions & 1 deletion install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,7 @@ pear install pdepend/PHP_Depend-1.0.3
    pear channel-discover pear.phpmd.org
    pear install --alldeps phpmd/PHP_PMD-1.3.2

    pear install PHP_CodeSniffer-1.3.2
    pear install PHP_CodeSniffer-1.3.2

    # installing Sonar as a service:
    # copy the etc_init_d_sonar file from this repo, to /etc/init.d/sonar
  22. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,13 @@ yum -y install php-devel
    pecl install xdebug

    # edit /etc/php.ini and add this line:
    # zend_extension="FULL_PATH_TO/xdebug.so"
    # zend_extension="FULL_PATH_TO/xdebug.so"


    pear channel-discover pear.pdepend.org
    pear install pdepend/PHP_Depend-1.0.3

    pear channel-discover pear.phpmd.org
    pear install --alldeps phpmd/PHP_PMD-1.3.2

    pear install PHP_CodeSniffer-1.3.2
  23. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,8 @@ pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear install phpunit/PHPUnit-3.5.5

    yum -y install php-devel

    pecl install xdebug

    # edit /etc/php.ini and add this line:
  24. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,9 @@

    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear install phpunit/PHPUnit-3.5.5
    pear install phpunit/PHPUnit-3.5.5

    pecl install xdebug

    # edit /etc/php.ini and add this line:
    # zend_extension="FULL_PATH_TO/xdebug.so"
  25. Noah Sussman revised this gist Jan 31, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # Sonar for PHP installation for CentOS 6
    # See http://docs.codehaus.org/display/SONAR/Installing+PHP+Environment

    pear channel-discover pear.phpunit.de
  26. Noah Sussman created this gist Jan 31, 2013.
    5 changes: 5 additions & 0 deletions install_sonar_php.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    # See http://docs.codehaus.org/display/SONAR/Installing+PHP+Environment

    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear install phpunit/PHPUnit-3.5.5