- Maven - Build tool
- Git Hub - SCM
- Jenkins - CICD TOOL
- Docker _ container
- Nginx - Webserver
- SSL - cerbot
- Create Ubuntu VM using AWS EC2 (t2.medium)
- Enable 8080 Port Number in Security Group Inbound Rules
- Connect to VM using MobaXterm
- Install Java
sudo apt update
sudo apt install fontconfig openjdk-17-jre
java -version
- Install Jenkins
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
- Start Jenkins
sudo systemctl enable jenkins
sudo systemctl start jenkins
- Verify Jenkins
sudo systemctl status jenkins
- Access jenkins server in browser using VM public ip
http://public-ip:8080/
- Copy jenkins admin pwd
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
-
Create Admin Account & Install Required Plugins in Jenkins aseem pipline two ways Declarative pipeline- simplified way Scripted Pipeline - Groovy
Declarative Pipeline: Structured and simplified way to define pipelines in Jenkins. Uses predefined syntax with specific keywords. Great for standardizing pipeline definitions and simpler requirements. Offers less flexibility compared to Scripted Pipeline.
Scripted Pipeline: Allows writing pipelines as Groovy scripts. Provides more flexibility and control with Groovy scripting. Suitable for complex scenarios and advanced control flow. Can be verbose and complex compared to Declarative Pipeline.
- Manage Jenkins -> Tools -> Maven Installation -> Add maven
curl -fsSL get.docker.com | /bin/bash
sudo usermod -aG docker jenkins
sudo usermod -aG docker ubuntu
sudo systemctl restart jenkins
sudo docker version
-
Stage-1 : Clone Git Repo
-
Stage-2 : Maven Build
-
Stage-3 : Create Docker Image
-
Stage-4 : Create Docker Container
- We should be able to access our application
URL : http://public-ip:port/