Welcome to Github-Actions-EKS-CICD-Cafe-Coffee! This project aims to streamline the deployment pipeline for a MERN (MongoDB, Express.js, React.js, Node.js) web application using a DevOps approach. By leveraging GitHub Actions, Docker, Terraform, and SonarQube, we've crafted an automated Continuous Integration/Continuous Deployment (CI/CD) pipeline that ensures efficiency, reliability, and quality in deploying your MERN web application to Amazon Elastic Kubernetes Service (EKS).
-
Automated EKS Cluster Creation: Utilize Terraform to automate the provisioning of Amazon EKS clusters, providing a scalable and managed Kubernetes environment.
-
Dockerized Deployment: Docker containers are used to package the MERN application, ensuring consistency across different environments and facilitating easy deployment.
-
Github Actions Integration: Seamlessly integrate Github Actions for automating the CI/CD pipeline, enabling continuous integration, code quality checks, and deployment.
-
SonarQube Integration: Enhance code quality and security with SonarQube static code analysis, integrated into the CI/CD pipeline for thorough code inspection.
-
Secure Secrets Management: Safely manage sensitive information such as API keys and credentials through Github Actions secrets, ensuring secure integration with external services like SonarQube.
-
AWS Account: You need an AWS account to utilize services like Amazon EKS and EC2. If you don't have an AWS account, you can create one here.
-
EC2 Instance with Ubuntu AMI: - Launch EC2 Instance: Log in to your AWS Management Console and navigate to EC2. Launch an EC2 instance with Ubuntu AMI by following these steps:
- Choose an Ubuntu AMI (Amazon Machine Image).
- Select the instance type. For this project, choose "t2.medium" to ensure sufficient resources.
- Configure instance details according to your requirements.
- Add storage: Choose at least 20GB of storage to accommodate the application and dependencies.
- Configure security group and key pair settings.
- Review and launch the instance.
- Connect to EC2 Instance: Once the instance is launched, connect to it using SSH or any other preferred method. This instance will serve as your development environment and may also be used to execute Terraform scripts.
-
-
now run the script for downloading- trivy, terraform, aws, kubectl, node, java in above repo you will get the
script
namedtools.sh
chmod +x ./tools.sh ./tools.sh
-
Now check the whole tools that you have download-
trivy --version terraform --version aws --version kubectl version node -v java --version
- Firstly lauch Sonarqube using this -
docker run -d --name sonar -p 9000:9000 sonarqube:lts-community
-
Then use the ip with port :9000 in your browser then SonarQube start, and type username-
admin
and password-admin
. -
Now, execute below commands one by one
git clone https://github.com/mdazfar2/Github-Actions-EKS-CICD-Cafe-Coffee.git
cd Github-Actions-EKS-CICD-Cafe-Coffee
cd s3-bucket
terraform init
terraform fmt
terraform validate
terraform plan
terraform apply --auto-approve
cd ..
- Now check your S3 bucket that it is created or not
cd Eks-terraform
terraform init
terraform fmt
terraform validate
terraform plan
terraform apply --auto-approve
cd ..
- Now, use the process of GitHub Runner in your terminal. The command will take you to Settings > Actions > Runners > new self-hosted runner. Then, choose Linux and follow all the steps.
If you encounter any hurdles or technical challenges along the way, know that I'm here to assist you every step of the journey. Feel free to reach out to me for support and guidance. You can easily connect with me through LinkedIn, Instagram or Discord