DevOps Project-2

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:

Go to EC2 console and Create an EC2 instance.

No alt text provided for this image

Connect to the EC2 instance using SSH client

No alt text provided for this image

Step 2: Install jenkins and Docker on AWS EC2 Ubuntu instance.

Install Jenkins and Docker from my Devops Project 1 article

Link: https://medium.com/@sayalishewale12/devops-project-1-e4a5c994e18a

Install Jenkins:

Jenkins requires the Java Runtime Environment (JRE).

To install OpenJDK 11, run:

sudo apt install openjdk-11-jdk -y        

Follow 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 below command:

sudo apt-get install docker.io        

 Check version of Jenkins and docker using command:

jenkins --version
docker --version        


Browse instance-public-IP:8080 it will open jenkins dashboard.

Go to Jenkins Dashboard and Click on “New Item”

No alt text provided for this image

Give your project a name and select “Pipeline” as the project type.

No alt text provided for this image


Go to project configuration page

No alt text provided for this image

Now go to the pipeline session, In definition select Pipeline script

No alt text provided for this image

Write a pipeline script

No alt text provided for this image

Pipeline:

The Declarative pipeline should start with the pipeline block and this is the mandatory block.

Agent:

Agent signifies where the Jenkins build job should run. In this case, we have selected agent as any.

Stages:

stages block consists of different executable stage blocks.

At least one stage block is mandatory inside the stages block.

This pipeline has four stages:

  1. Checkout: This stage checks out the code from the develop branch on GitHub.
  2. Build: This stage builds a Docker image for the Django application.
  3. Test: This stage runs unit tests for the Django application.
  4. Deploy: This stage deploys the Docker container for the Django application.

Steps:

Steps blocks consist of the actual operation which needs to be performed inside Jenkins.


Build the project. You can manually build the project by clicking on the “Build Now” link in the project’s main page

No alt text provided for this image


Build is successfully completed.

No alt text provided for this image


After a build is completed, you can view the console output by clicking on the “Console Output” link in the build page.

No alt text provided for this image
No alt text provided for this image


You can see the each stage view by clicking on the “Full Stage View” in the project main page.

No alt text provided for this image

Docker image and container is created using jenkins pipeline.

No alt text provided for this image

Browse public IP address with port no.8000

No alt text provided for this image

Thank you for reading!

Congratulations. Keep it up Shewale way to go.

Like
Reply

Thanks for sharing... It's really helpful....

To view or add a comment, sign in

More articles by Sayali Shewale

  • DevOps Project-3

    Project Description The project involves hosting a static website using an AWS S3 bucket. Amazon S3 is an object…

    7 Comments
  • Day 80: DevOps Project-1

    Project Description The project aims to automate the building, testing, and deployment process of a web application…

    4 Comments
  • Day 73 - Setup Grafana on AWS EC2 Instance

    Task: Setup grafana in your local environment on AWS EC2. Go to the AWS console and Launch an EC2 instance Open port…

    2 Comments
  • Day 72 - Grafana

    What is Grafana? Grafana is an open-source data visualization and monitoring tool that allows you to query, visualize…

    3 Comments
  • Day 70 - Terraform Modules

    Modules are containers for multiple resources that are used together. A module consists of a collection of .

    2 Comments
  • Day 69 - Meta-Arguments in Terraform

    When you define a resource block in Terraform, by default, this specifies one resource that will be created. To manage…

    1 Comment
  • Day 68 - Scaling with Terraform

    Understanding Scaling Scaling is the process of adding or removing resources to match the changing demands of your…

  • Day 67: AWS S3 Bucket Creation and Management using terraform

    AWS S3 Bucket Amazon S3 (Simple Storage Service) is an object storage service that offers industry-leading scalability,…

    1 Comment
  • Day 66 - Terraform Hands-on Project - Build Your Own AWS Infrastructure with Ease using Infrastructure as Code (IaC)

    Task: 1.Create a VPC (Virtual Private Cloud) with CIDR block 10.

    3 Comments
  • Day 65 - Working with Terraform Resources

    Understanding Terraform Resources A resource in Terraform represents a component of your infrastructure, such as a…

    3 Comments

Others also viewed

Explore content categories