DevOps Project-2

DevOps Project-2

·

2 min read

Project Description

The project is about automating the deployment process of a web application using Jenkins and its declarative syntax. The pipeline includes stages like building, testing, and deploying to a staging environment. It also includes running acceptance tests and deploying to production if all tests pass.

Procedure: Setting Up Jenkins and Docker on AWS EC2 Ubuntu Instance

Step 1: Launch an EC2 Instance

  • Access the EC2 console and create a new EC2 instance.

Step 2: Connect to the EC2 Instance

  • Utilize an SSH client to connect to the newly created EC2 instance.

Step 3: Install Jenkins and Docker

  • Refer to the Devops Project 1 article for detailed instructions on installing Jenkins and Docker.(Click here)

Install Jenkins:

sudo apt install openjdk-11-jdk -y
curl -fsSL https://pkg.jenkins.io/debian-stable/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-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins

Install Docker:

sudo apt-get install docker.io
jenkins --version
docker --version

Step 4: Access Jenkins Dashboard

  • Open your browser and go to the Jenkins dashboard using the instance's public IP followed by port 8080.

Step 5: Create a New Pipeline Project

  • Navigate to the Jenkins dashboard, click on "New Item," provide a project name, and choose "Pipeline" as the project type.

Step 6: Configure Pipeline Script

  • In the project configuration page, go to the pipeline section, select "Pipeline script," and write the pipeline script.

Pipeline Script Overview:

  • Agent: Specifies where the Jenkins build job should run.

  • Stages: Consists of executable stage blocks, including Checkout, Build, Test, and Deploy.

  • Steps: Contains the operations to be performed within Jenkins.

Step 7: Build and View Results

  • Manually build the project by clicking on "Build Now" in the project’s main page.

  • View the build results, console output, and stage view for each step.

Step 8: Docker Image and Container Creation

  • Docker image and container are created using the Jenkins pipeline.

Step 9: Access the Deployed Application

  • Browse the public IP address with port number 8000 to access the deployed application.


Thanks for following the project. See you in the next one.