ocisonarqube

Upgrade SonarQube

It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you try to create and restore a backup to ensure that everything works properly.

  • Log in to the server console.
  • Create a directory to save all the data you need to backup.

    $ mkdir ~/sonarqube-backup $ mkdir ~/sonarqube-backup/httpd $ mkdir ~/sonarqube-backup/httpd-ssl $ mkdir ~/sonarqube-backup/sonarqube

  • Back up the bitnami_sonarqube database as described on the PostgreSQL page.

  • Copy the Web server configuration and SonarQube configuration directories to your backup directory. You can use the commands below:

    $ sudo cp -rf /opt/bitnami/apps/sonarqube/sonarqube/conf/* ~/sonarqube-backup/sonarqube $ sudo cp -rf /opt/bitnami/apps/sonarqube/conf/* ~/sonarqube-backup/httpd $ sudo cp /opt/bitnami/apache2/conf/server.crt ~/sonarqube-backup/httpd-ssl $ sudo cp /opt/bitnami/apache2/conf/server.key ~/sonarqube-backup/httpd-ssl $ sudo cp /opt/bitnami/apache2/conf/server-ca.crt ~/sonarqube-backup/httpd-ssl

  • Compress the backup directory.

    $ tar cfz sonarqube-backup.tar.gz ~/sonarqube-backup

  • Download the backup files sonarqube-backup.tar.gz and backup.sql using SFTP. Refer to the FAQ for more information on this.

  • Launch a new SonarQube server.

  • Upload via SFTP the backups files sonarqube-backup.tar.gz and backup.sql to the new server. Refer to the FAQ for more information on this.

  • Log in to the server console.

  • Restore the database backup as described on the PostgreSQL page.

  • Update the contents of the /opt/bitnami/apps/sonarqube/sonarqube/conf/sonar.properties and /opt/bitnami/apps/sonarqube/sonarqube/conf/wrapper.conf files with the settings of the related files in the sonarqube-backup/sonarqube backup directory. To do so, use an editor to modify them with the old settings (Web server URL, database, LDAP settings, …).

    NOTE: Edit the settings files manually. Do not copy-paste the old files.

  • Restore the Apache configuration files in the new SonarQube stack. You can use the commands below. Note that the second command will restore the server SSL certificates from your previous server, so only execute this command if required.

    $ sudo cp -rf sonarqube-backup/httpd/* /opt/bitnami/apps/sonarqube/conf $ sudo cp sonarqube-backup/httpd-ssl/* /opt/bitnami/apache2/conf

  • Check if the plugins installed on the old stack are compatible with the new version of SonarQube by consulting the SonarQube compatibility Matrix. If any of them are incompatible, you will need to install the latest version of these plugins manually as described in the Manual Plugins installation instructions.

  • Restart SonarQube using the graphical manager or the command line script:

    $ sudo /opt/bitnami/ctlscript.sh restart sonarqube

  • Browse to http://SERVER-IP/setup and follow the setup instructions (SERVER-IP is a placeholder that you should replace with the actual domain name or IP address of your SonarQube server).

  • Analyze your projects (and compute your Views if you are the owner of the governance product) to get fresh data.

Upgrade only SonarQube in the Bitnami SonarQube Stack

  • Log in to the server console.
  • Browse to https://www.sonarqube.org/downloads/ and find the link for the latest version of SonarQube.
  • Download the latest version using the link obtained in the previous step. For example (for version 6.3), run the commands below:

    $ wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.3.1.zip
    $ unzip sonarqube-6.3.1.zip
    
  • Backup your current SonarQube installation. To do that, use the command:

    $ sudo mv /opt/bitnami/apps/sonarqube/sonarqube/ /opt/bitnami/apps/sonarqube/sonarqube-backup/
    
  • Substitute your old installation with the new version. To do that, use the command below:

    $ sudo mv ~/sonarqube-6.3.1/ /opt/bitnami/apps/sonarqube/sonarqube
    
  • Update the contents of the /opt/bitnami/apps/sonarqube/sonarqube/conf/sonar.properties and /opt/bitnami/apps/sonarqube/sonarqube/conf/wrapper.conf files with the settings of the related files in the /opt/bitnami/apps/sonarqube-backup/sonarqube/conf backup directory. To do so, use an editor to modify them with the old settings (web server URL, database, LDAP settings, etc.).

    NOTE: Edit the settings files manually. Do not copy-paste the old files.

  • Restore the permissions.

    $ sudo chown -R root:sonarqube /opt/bitnami/apps/sonarqube/sonarqube
    
  • Check if the plugins installed on the old stack are compatible with the new version of SonarQube by consulting the SonarQube compatibility Matrix. If any of them are incompatible, you need to install manually the latest version of these plugins as described in the Manual Plugins installation instructions.

  • Restart SonarQube using the graphical manager or the command line script:

    $ sudo /opt/bitnami/ctlscript.sh restart sonarqube

  • Browse to http://SERVER-IP/setup and follow the setup instructions (SERVER-IP is a placeholder that you should replace with the actual domain name or IP address of your SonarQube server).

  • Analyze your projects (and compute your Views if you own the Governance product) to get fresh data.

Last modification July 4, 2019