DevOps Project -2 Web-APP Deploying using Jenkins Declarative Syntax

DevOps Project -2 Web-APP Deploying using Jenkins Declarative Syntax

Dear Learners, In my Previous learning I have used Various DevOps Tools,In today's article we will explain the Project 2 Web-APP with the help of Jenkins Declarative Pipeline.

Table of Contents

Project Description

Pre-requisites

Project-Steps

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.

Pre-requisites

1 Create an EC2 instance in the AWS management console with the required storage.

2 Install jenkins and Docker in the EC2 instance.

Please go-through my last Project-1 Day 80 to find the more details here is the Link:-

https://lnkd.in/duH5hukR

Project Steps:

1 Navigate to the Jenkins dashboard and go to new item. Then select Pipeline and create the project.

No alt text provided for this image
Navigate to the Jenkins dashboard and go to new item. Then select Pipeline and create the project Diagram.
No alt text provided for this image
Navigate to the Jenkins dashboard and go to new item. Then select Pipeline and create the project Diagram

2 In the genereal section provide the project description and also the GitHub project URL.

No alt text provided for this image
In the genereal section provide the project description and also the GitHub project URL Diagram.

3 In the build trigger section select the GitHub webhook trigger option.

Ensure the Webhook is configures in GitHub.

No alt text provided for this image
In the build trigger section select the GitHub webhook trigger option Diagram.

4 Ensure the project has a Docker file in GitHub.

No alt text provided for this image
Ensure the project has a Docker file in GitHub Diagram.

5 Write the declarative pipeline code which is a groovy syntax code to set up the project pipeline.

Agent:- Agents is a different servers that are linked to the master Jenkins server. An agent can be set up in the pipeline to run the pipelines in different agents. In this project, we are with the default agent.

Stages:- Stages contain different steps to be executed as part of the project pipeline.

In this project we have the 3 stages:

Code:- The code stage pulls the code from GitHub to build and execute the Pipeline in further steps.

Build and Test:- The stage builds the image of the app code from the docker file.

Run:- This stage runs the Container in the server and makes the application up.

    pipeline {
        agent any
        stages{
            stage('Code'){
                steps{
                    git url: 'https://github.com/Maninderit/node-todo-cicd1.git', branch: 'master' 
                }
            }
            stage('Build and Test'){
                steps{
                    echo "$USER"
                    sh 'docker build -t webapp .'
                    echo "build and ttest completed"
                }
            }
            stage('Run'){
                steps{
                    sh "docker run -d -p 8000:8000 webapp"
                }
            }
        }       
        }
        

1 After writing the detailed pipeline groovy script in the project configuration apply and save the Project.

No alt text provided for this image
After writing the detailed pipeline groovy script in the project configuration apply and save the Project Diagram.
No alt text provided for this image
Navigate to the project and click on Build Now to execute the project Diagram.

2 Navigate to the project and click on Build Now to execute the project.

No alt text provided for this image
Navigate to the project and click on Build Now to execute the project Diagram.

3 We can see the successful console output and the stages that are completed in its stage executions as shown in the above and below screenshots.

No alt text provided for this image
We can see the successful console output and the stages that are completed in its stage executions as shown in the above and below screenshots Diagram
No alt text provided for this image
We can see the successful console output and the stages that are completed in its stage executions as shown in the above and below screenshots Diagram
No alt text provided for this image
We can see the successful console output and the stages that are completed in its stage executions as shown in the above and below screenshots Diagram
No alt text provided for this image
We can see the successful console output and the stages that are completed in its stage executions as shown in the above and below screenshots Diagram

4 Ensure to open the port 8000 in the security group associated with the EC2 instance.

No alt text provided for this image
Ensure to open the port 8000 in the security group associated with the EC2 instance Diagram.

5 Finally, navigate to the web-app URL and we can see the application is up and Running.

No alt text provided for this image
Finally, navigate to the web-app URL and we can see the application is up and Running Diagram.


Hope I helped you in understanding the concept in a better way!!

Happy Learning


Next Topic:

Day 82: we will explore and one step forward hosting a static website using an AWS S3 bucket.

To view or add a comment, sign in

More articles by Maninder Singh

  • Artificial Intelligence for DevOps Engineer

    Dear learners, In today article we will explain the Artificial Intelligence for the DevOps Engineers. Important Aspects…

    12 Comments
  • Bash Shell Scripting:- Lesson 7,8 &9 for DevOps Engineers.

    Dear Learners, In Today Topic, We will learn the Shell Scripting form Basics to Advanced for DevOps Engineers. Course…

    3 Comments
  • Bash Shell Scripting:- Lesson 4,5 &6 for DevOps Engineers.

    Dear Learners, In Today Topic, We will learn the Shell Scripting form Basics to Advanced for DevOps Engineers. Course…

    3 Comments
  • Bash Shell Scripting:- Lesson 1,2 &3 for DevOps Engineers.

    Dear Learners, In Today Topic, We will learn the Shell Scripting form Basics to Advanced for DevOps Engineers. Course…

    3 Comments
  • EP 2 DevOps:- 2 Tier Application Deployment

    2-Tier Application Deployment Diagram (Architecture) Dear Learners in today topic we will deploy a 2 Tier Application…

    8 Comments
  • DevOps Engineers:- Docker Cheat Sheet

    Dear learner, presented below is a concise yet comprehensive Docker cheat sheet, complete with detailed commands and…

    7 Comments
  • DevOps (Day-90): Ending the challengs

    Table of Contents: Flashback Self-Impact of Learning Today, We have completed the 90days of DevOps challenge where we…

    16 Comments
  • DevOps (Day-88): Kubernetes Architecture

    Dear Learner's in today topic we will discuss the Kubernetes Architecture in detail. Table of Contents Kubernetes…

    1 Comment
  • DevOps (Day-87): Argo CD

    Dear Learners in today topic we will the discuss the Argo CD in Kubernetes. Table of Contents Challenges with CD into…

    13 Comments
  • DevOps (Day-86): Project-7 Portfolio App

    Dear Learners in Today's article we will deploying a Portfolio app on AWS S3 Bucket using GitHub. Table of Contents:…

    10 Comments

Others also viewed

Explore content categories