DevOps Project -2 ????
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.
Steps:
Create an EC2 instance by going to the EC2 console.
Connect to the EC2 instance using SSH client
Step 2: Install Jenkins and Docker on the AWS EC2 Ubuntu instance
Install Jenkins and Docker using the instructions in my DevOps Project 1 article:
Link: https://www.dhirubhai.net/posts/vinaykumar04_90daysofdevops-devops-pipeline-activity-7077533672366575616-y0RK?utm_source=share&utm_medium=member_desktop
Install Jenkins:
Jenkins requires the Java Runtime Environment (JRE).
To install OpenJDK 11, run:
sudo apt install openjdk-11-jdk -y
Follow the below steps to install Jenkins:
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:
Install docker using the below command:
sudo apt-get install docker.io
?Check the version of Jenkins and Docker using the command:
jenkins --version
docker --version
Check at instance-public-IP:8080. It will launch the Jenkins dashboard.
Navigate to Jenkins Dashboard and click the "New Item" button.
Give your project a name and choose the "Pipeline" project type.
Go to the project configuration page
领英推荐
Now navigate to the pipeline section and pick Pipeline script in the definition.
Write a pipeline script
Pipeline: The pipeline block is required at the beginning of the Declarative pipeline.
Agent: The agent specifies where the Jenkins build job should be executed. In this situation, we choose an agent.
Stages: The stages block is made up of many executable stage blocks.
Within the stages block, at least one stage block is required.
This pipeline is divided into four stages:
Checkout: This stage downloads the code from GitHub's develop branch.
Build: During this stage, a Docker image for the Django application is created.
This step performs unit tests on the Django application.
Deploy: The Docker container for the Django application is deployed during this stage.
Steps: Steps blocks contain the actual operation that must be executed within Jenkins.
Create the project. You can build the project manually by clicking the "Build Now" option on the project's home page.
The build is successfully completed.
After a build is completed, you can view the console output by clicking on the “Console Output” link on the build page.
Each stage view can be viewed by clicking on the "Full Stage View" button on the project's home page.
Docker image and container is created using the Jenkins pipeline
Browse public IP address with port no.8000
ThankYou ??