Installing Sonarqube on AWS ECS Fargate?
A Quick Guide to Installing SonarQube on AWS ECS Fargate
Table of Contents
- What is AWS Fargate?
- What is SonarQube?
- Prerequisites
- Creating the AWS Fargate Cluster
- Create a task definition?
- Create a service?
- 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 - Cleanup
- References
- Conclusion
- 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.
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.
Prerequisites
- 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.
Creating the AWS Fargate Cluster
Open the Amazon ECS console at https://console.aws.amazon.com/ecs/
- From the navigation bar, select the Region to use (N. Virginia - us-east-1).
- Select the ecs in search.
- 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.
Create a task definition?
- Open the Amazon ECS console at https://console.aws.amazon.com/ecs/taskdefination/
- In the navigation pane, choose Task Definitions.
- 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 mappings — 9000
- 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
Create a service?
- Open the Amazon ECS console at https://console.aws.amazon.com/ecs/service/
- Click on create service and create the 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
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..
References
![](https://miro.medium.com/v2/resize:fill:388:388/1*l1CuH62cZnhRB9zbXSAHSQ.png)
![](https://miro.medium.com/v2/resize:fill:388:388/0*7nzpLTlihpQRvZaF.png)
![](https://miro.medium.com/v2/resize:fill:388:388/1*LoiZfv2FOmvU1x-7TQhpgg.png)
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
![](https://miro.medium.com/v2/resize:fill:388:388/1*l1CuH62cZnhRB9zbXSAHSQ.png)
![](https://miro.medium.com/v2/resize:fill:388:388/0*7nzpLTlihpQRvZaF.png)
![](https://miro.medium.com/v2/resize:fill:388:388/1*LoiZfv2FOmvU1x-7TQhpgg.png)
More content at uniquecentury.medium.com. Follow us on uniquecentury.medium.com, Twitter, and LinkedIn.