Installing Sonarqube on AWS ECS Fargate?

A Quick Guide to Installing SonarQube on AWS ECS Fargate

Eazy Cloud Life
6 min readNov 20, 2022

Table of Contents

  1. What is AWS Fargate?
  2. What is SonarQube?
  3. Prerequisites
  4. Creating the AWS Fargate Cluster
  5. Create a task definition?
  6. Create a service?
  7. Accessing the sonarqube dashboard from the ECS cluster
    4.1 Log in to SonarQube
    4.2 Change or update the new password
    4.3 View SonarQube Dashboard
  8. Cleanup
  9. References
  10. Conclusion
  11. Recommended Topics

What is AWS Fargate?

AWS Fargate is a compute engine for deploying and managing containers without having to manage any of the underlying infrastructures. Fargate makes it easy to scale your applications. You no longer have to worry about provisioning enough compute resources for your container applications. You can check it out on AWS Fargate.

Table of Contents

What is SonarQube?

SonarQube® is an open-source platform which developed by SonarSource for continuous inspection of code quality. You can check it out on SonarQube.

Table of Contents

Prerequisites

  1. AWS Account

Note: 1. In this post, we will use the default VPC, Subnet, and Security group.

2. In default security group need to add the port 9000 to run SonarQube on default port.

Table of Contents

Creating the AWS Fargate Cluster

Open the Amazon ECS console at https://console.aws.amazon.com/ecs/

  1. From the navigation bar, select the Region to use (N. Virginia - us-east-1).
  2. Select the ecs in search.
  3. In the navigation pane, choose Clusters.
  • On the Clusters page, choose Create Cluster with the configurations.
  • For Select cluster template, choose Networking only, then choose Next step.
  • On the Configure cluster page, enter a Cluster name (sonarqube-demo-cluster).
  • In the Networking section, configure the VPC for your cluster.
  • You can retain the default settings, or you can modify these settings with the following steps.
  • In the CloudWatch Container Insights section, choose whether to enable Container Insights for the cluster Choose Create.
  • Click on view cluster to check the cluster launch status.

Table of Contents

Create a task definition?

  • Choose Create new Task Definition
  • On the Select launch type compatibility page, select the launch type (FARGATE) that your task should use and choose Next step.
  • Configure task and container definitions by the below steps.
  • For Task Definition Name* (sonarqube-demo-task-def) type a name for your task definition.
  • For Task Role — , choose an IAM role that provides permissions for containers in your task to make calls to AWS API operations For Task execution IAM role, either select your task execution role or choose Create new role so that the console can create one for you.
  • For Task size, choose a value for Task memory (GB) and Task CPU (vCPU).
  • Task memory (GB) — 2GB
  • Task CPU (vCPU) — 0.5GB
  • Add container details
  • Container name* — sonarqube-demo-cont
  • Image* — sonarqube:8.9-community
  • Port mappings9000
  • Add the bellow command under ENVIRONMENT section.
-Dsonar.search.javaAdditionalOpts=-Dnode.store.allow_mmap=false
  • Add the Log configuration and Ulimits
  • Limit Name — <none>
  • Soft limit — 65535
  • Hard limit — 65535
  • Click on create

Table of Contents

Create a service?

  • Configure service
  • Number of tasks — 1 and click on Next steps.
  • Configure network
  • Configure security group
  • Click on Next step
  • Set Auto Scaling and click on Next step
  • Review and click on Create Service
  • Refresh to see the task status.

Accessing the sonarqube dashboard from the ECS cluster

  • Navigate to cluster and click on tasks
  • click on container control flows to next page where underneath the network section you find the Public IP address.
  • Open any browser and type Public http://ipaddress:9000 , sonarqube dashboard will launch

Log in to SonarQube

  • Login — admin
  • Password — admin

Change or update the new password

  • old Password — admin
  • New Password — your_new_password
  • Confirm Password — your_new_password

View SonarQube Dashboard

Table of Contents

Cleanup

  • Navigate to clusters , select the service and click on Delete.
  • Type delete me and click on Delete.
  • Navigate to clusters , select the cluster (need to delete) and click on Delete Cluster.
  • Type delete me and click on Delete.
  • Navigate to Task Definations, click on task definations (need to delete), click on Action icon and click on Deregister..

Table of Contents

References

SonarQube

4 stories

Table of Contents

Conclusion

In this post, you learnt how to successfully run SonarQube with the AWS ECS Fargate. You can see how easy it is to integrate SonarQube with AWS ECS Fargate. Table of Contents

Recommended Topics

SonarQube

4 stories

More content at uniquecentury.medium.com. Follow us on uniquecentury.medium.com, Twitter, and LinkedIn.

--

--

No responses yet