Skip to content

Repository files navigation

Devops-Project-1

This project demonstrates deploying an Amazon Prime clone using a set of DevOps tools and practices. The primary tools include:

Terraform: Infrastructure as Code (IaC) tool to create AWS infrastructure such as EC2 instances and EKS clusters.

GitHub: Source code management.

Jenkins: CI/CD automation tool.

SonarQube: Code quality analysis and quality gate tool.

NPM: Build tool for NodeJS.

Aqua Trivy: Security vulnerability scanner.

Docker: Containerization tool to create images.

AWS ECR: Repository to store Docker images.

AWS EKS: Container management platform.

ArgoCD: Continuous deployment tool.

Prometheus & Grafana: Monitoring and alerting tools.

🚀 Setup Guide

Prerequisites

Before getting started, ensure you have:

  • AWS Account
  • Terraform
  • AWS CLI
  • Git
  • Docker
  • Jenkins
  • kubectl
  • Helm
  • Visual Studio Code

1️⃣ AWS Configuration

Create IAM User

  • Create an IAM user with programmatic access.
  • Save:
    • Access Key
    • Secret Access Key

Create EC2 Key Pair

Create a key pair named:

key

This will be used to access your EC2 instance.


2️⃣ Clone Repository

git clone 

(Optional) Simplify the VS Code terminal prompt:

code $PROFILE

function prompt {"$PWD > "}
function prompt {$(Get-Location -Leaf) + " > "}

3️⃣ Deploy Infrastructure using Terraform

Open:

terraform_code/ec2_server/main.tf

Configure AWS credentials:

aws configure

Initialize Terraform:

terraform init

Deploy infrastructure:

terraform apply --auto-approve

Terraform will automatically provision:

  • EC2 Instance
  • Security Groups
  • Jenkins
  • Docker
  • SonarQube
  • Required dependencies

4️⃣ Configure SonarQube

Default Login

Username: admin
Password: admin

Generate a token:

Administration
    → Security
        → Users
            → Tokens

Save the generated token.


5️⃣ Configure Jenkins

Add Credentials

Navigate to:

Manage Jenkins
    → Credentials
        → System
            → Global Credentials

Add:

  • SonarQube Token
  • AWS Access Key
  • AWS Secret Key

Install Plugins

Install the following plugins:

  • SonarQube Scanner
  • NodeJS
  • Docker
  • Prometheus Metrics

Global Tool Configuration

Configure:

  • JDK 17
  • SonarQube Scanner
  • NodeJS
  • Docker

6️⃣ CI Pipeline

Create a Jenkins Pipeline using the provided Jenkinsfile.

The pipeline performs:

  1. Git Checkout
  2. SonarQube Analysis
  3. Quality Gate
  4. Install NPM Dependencies
  5. Trivy Security Scan
  6. Docker Build
  7. Create ECR Repository
  8. Login to AWS ECR
  9. Push Docker Image
  10. Cleanup Docker Images

7️⃣ Continuous Deployment (CD)

Create EKS Cluster

Deploy your Kubernetes infrastructure using Terraform.


Configure ArgoCD

The deployment pipeline automatically:

  • Installs ArgoCD
  • Exposes ArgoCD Server
  • Connects to EKS

Configure Monitoring

The pipeline installs:

  • Prometheus
  • Grafana

using Helm Charts.


8️⃣ Deploy Application

Use ArgoCD to deploy the Kubernetes manifests.

Deployment flow:

GitHub
      │
      ▼
Jenkins CI
      │
      ▼
Docker Image
      │
      ▼
AWS ECR
      │
      ▼
ArgoCD
      │
      ▼
Amazon EKS

9️⃣ Cleanup

Run the Cleanup Pipeline to remove:

  • Kubernetes Services
  • Deployments
  • ArgoCD
  • Prometheus
  • Grafana
  • Helm Releases
  • ECR Repository
  • KMS Keys

Finally destroy the infrastructure:

terraform destroy

📌 Jenkins Pipelines Included

  • CI Pipeline
  • CD Pipeline
  • Cleanup Pipeline

Simply copy the Jenkinsfiles provided in this repository into your Jenkins Pipeline jobs.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages