Home / Platform management / DevOps toolchain / Tool deployment and upgrade / Deploy SonarQube

Deploy SonarQube

SonarQube is an open source code quality management tool that helps you find defects in your code.

Cautions

Prerequisites

Storage

Please make sure that at least one of the following prerequisites is met. Each prerequisite corresponds to a different storage method .

Tip: After deleting the tool created by the function, the PVC bound to the tool will still remain.

Network

On-premise deployment

  1. Prepare a Postgresql database with a version between 11.x and 15.x. You can create this via the platform’s Data Service > Postgresql. Create a PostgreSQL instance

  2. In the left navigation bar, click DevOps Toolchain > Instances.

  3. Click Create Instance.

  4. On the Deploy and Integrate page, select SonarQube.

  5. In the Location section, select the Clusters and Namespaces where you want to deploy the tool.

  6. In the Resources section, select a CPU and memory allocation method and complete the configuration.

    Allocation Method Description
    Tool Allocates total resources for the tool to ensure overall availability. If you have no special requirements for individual components, the global allocation method is more convenient.
    Components Used to allocate resources for each component under the tool, to ensure the business performance related to specific components.
    Note: It is recommended to maintain a resource ratio of 3:7 between the db component and the webservice component.
  7. In the storage area, select a type of storage method and complete the configuration.

    Caution: Storage configuration cannot be modified after the instance is created.

    Storage Method Description
    Dynamically created PVCs Prerequisites: Storage classes need to be prepared in advance.
    After setting the required storage capacity for each SonarQube component, the platform will dynamically generate a PVC for each component and dynamically create a persistent volume for each component based on the storage class requested by the PVC.
    If you need to expand storage, switch to Container Platform to expand the PVC.
    Available PVCs Prerequisites: PVCs need to be prepared in advance.
    After specifying an available PVC for each SonarQube component, the platform will dynamically create a persistent volume for each component based on the storage class requested by the PVC to meet the different storage demands of each component (expansion, snapshots, etc.).
    Supports direct storage expansion in Platform Management.
    Node storage Request storage resources on cluster nodes through the hostpath storage solution. NO StorageClasses is required.
    Caution:
    • To avoid mounting failure, ensure that the path has not been used.
    • When deploying the tool in a public cloud cluster, this solution is unavailable to avoid data loss because of node elasticty.
  8. In the Database Secret section, configure the database connection secret. If you do not have a secret yet, click on “Create Secrets”, then fill out the secret form on the popup page. Choose the type as Opaque, and enter the following fields into the secret:

    Field Description
    host The database connection address
    port The database connection port
    username The database account username
    password The database account password
    database The database name, the database should exists and be empty
    sslmode Is SSL enabled for the database connection? Enter enable to enable or disable to disable, default is enabled

    The Postgresql instances created through the Data Service have SSL connections enabled by default. If you use the Data Service Postgresql instance, set sslmode to enable. In other cases, check with your server’s configuration to confirm whether SSL connections are supported.

    After filling out and submitting the Secret creation, return to the SonarQube create page and use the Secret to continue the creation.

  9. In the Networking section, configure the network requirements.

    Caution:

    • After deployment, please be cautious when updating the service access address. If updated, external settings such as DNS resolution need to be configured for normal access. Moreover, this update only applies to the current network setting status. When the network setting changes again, the service access address will be automatically replaced with a restricted value.

    • If there are dual NIC nodes in the cluster where the deployment tool is located, check whether the default load balancer IP address or node IP address used for service access is available for external access. Otherwise, the tool cannot be accessed normally after deployment, and the error message “check xx alive failed” will appear.

    • Ingress method

      Parameter Description
      Domain Select a domain name that already exists in the platform. Make sure the selected domain name has been assigned to the project that will use this tool.
      Scheme Supports selecting HTTP and HTTPS protocols.
      Certificate If using the HTTPS protocol, a certificate matching the domain name must also be configured.
      Service access address Will be automatically generated, with the rule of http://{Ingress name} or https://{Ingress name}.
    • Nodeport method

      Parameter Description
      HTTPS port The port used to access the tool.
      Service access address Will be generated automatically, following the format http://{cluster address}:{HTTP port}.
  10. In the Accounts section, configure the account-related information.

    Parameter Description
    Name Default value is admin and cannot be modified.
    Note: Default password is admin.
    SSO login Single sign-on. If enabled, SonarQube can be authorized to log in with the platform account.
  11. In the Integration area, enter an integration name that will help the project members to identify and select this tool in DevOps.

  12. After the configuration is complete, click Deploy and Integrate.

    The instance integrates into the plaftform automatically.

Public cloud deployment

It is recommended to open a virtual machine and deploy a public cloud cluster before deploying DevOps tools, and use the same storage and network solution as the native cluster. In this way, the tools and capabilities supported for deployment are synchronized with the native cluster deployment tools.

Verification

During the creation process, click the icon to view the instance creation status in real time. When you encounter the following error message, it means that there is an error in your Database Secret.

Error Message Description
required postgres database name, got empty dbname from provided secret No database name was entered, the user needs to specify an existing empty database
Connection refused. Check your host and port in the given secret Connection creation failed, check if the address and port are incorrect
Authentication failed. Check your username and password in the given secret Server rejected the connection, check if the username or password is incorrect
SSL is not enabled on the server, please change ‘sslmode’ to ‘disable’ in secret if this server is the right one to connect The server does not support SSL connections, set sslmode to disable
server asks for an SSL connection, please change ‘sslmode’ to ’enable’ in secret if this server is the right one to connect The server requires an SSL connection, set sslmode to enable
get secret “ns/secret” failed, please check if it exists Failed to get the secret, check if the secret have been created successfully

Please check and correct the information within the corresponding secret based on the error message. After making corrections, the component will re-check the secret within one minute. If it is correct, the creation process will continue to finish.

Once the deployment status become Deployed, verify the tool’s accessibility by accessing the URL.

What’s next

Allocate tool resources to platform projects .