CICD Pipeline using Jenkins & ArgoCD
  • About the project
  • Overview of the application
  • Dockerizing the application
  • Configure EC2 instance to setup the CI pipeline
  • Configure Jenkins on EC2 instance
  • Create Jenkins CI pipeline
  • Setting up SonarQube server
  • Configure DockerHub and GitHub access tokens inside Jenkins
  • Add GitHub Webhook trigger
  • Execute the Jenkins Build
  • Configure EC2 instance to setup the CD pipeline
  • Install MiniKube and Kubectl
  • Install ArgoCD
  • Deploy the app to Kubernetes using ArgoCD
Powered by GitBook
On this page

Configure EC2 instance to setup the CI pipeline

To setup Docker, Jenkins and SonarQube (in next section) server, create a t2.large Ubuntu EC2 instance on AWS and use the below startup shell script to install the pre-requisites:

#!/bin/bash

sudo apt update

#Install JDK
sudo apt install openjdk-17-jre -y

#Install Jenkins
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins -y

# Install Docker
sudo apt install docker.io -y

# Grant Jenkins and Ubuntu user permission to access Docker daemon
sudo usermod -aG docker jenkins
sudo usermod -aG docker ubuntu
sudo systemctl restart docker

Create a Security Group and allow the below ports under Inbound rules

Type
Port
Used For

SSH

22

SSH to the instance

TCP

8010

Application port

TCP

8080

Jenkins port

TCP

9000

SonarQube port

After connecting to the EC2 instance verify whether JDK, Docker and Jenkins is properly installed using the following commands:

# Check java version
java --version

# Check Docker version
docker --version

# Check whether Jenkins is running
ps -ef | grep jenkins

PreviousDockerizing the applicationNextConfigure Jenkins on EC2 instance

Last updated 1 year ago

EC2 instance configuration to setup the CI server
Adding the startup script to install the prerequisites
Setting inbound rules for the instance