DevOps (Day-80): Project-1Deploy a Project Webapp Application with help of Jenkins Pipeline, GitHub and Docker

DevOps (Day-80): Project-1Deploy a Project Webapp Application with help of Jenkins Pipeline, GitHub and Docker

Day 80:#90DaysOfDevOpsChallenge

ยท

6 min read

Dear DevOps Engineers, In today's topic we will Deploy a Project Webapp Application with help of Jenkins Pipeline, GitHub and Docker.

Table of Contents

Project Description

Creating AWS Instance

Configure Docker and Jenkins on the Server

Project Steps: Automating pipeline of a Webapp

Project Description

The Project aims to automate the building, testing and deployment process of a web application using Jenkins and GitHub. The Jenkins pipeline will be triggered automatically by GitHub webhook integration when changes are made to the code repository. The pipeline will include stages such as building, testing and deploying the application,with notifications and alerts for failed builds or deployments.

Pre-requisties

Creating AWS instance

1 Navigate to the AWS Management console and provide the server name and choose the OS.

No alt text provided for this image

AWS Management console and provide the server name and choose the OS Diagram

No alt text provided for this image

AWS Management console and provide the server name and choose the OS Diagram

2 Select the instance type to configure the CPU and memory of the instance.

No alt text provided for this image

Select the instance type to configure the CPU and memory of the instance Diagram

3 Choose the existing or create a VPC for the server.

No alt text provided for this image

4 Select the disk size for the server to be attached.

No alt text provided for this image

Select the disk size for the server to be attached. Diagram.

Configure Docker and Jenkins on the Server

1 Write all the commands to pre-install Docker and Jenkins on the server after its spin-up.

No alt text provided for this image

Write all the commands to pre-install Docker and Jenkins on the server after its spin-up Diagram.

2 Now create the instance.

No alt text provided for this image

Now create the instance Diagram.

3 Log to the server and use systemctl command to check if docker is running.

No alt text provided for this image

Log to the server and use systemctl command to check if docker is running Diagram.

4 Now,use systemctl command to check if Jenkins is running.

No alt text provided for this image

Now,use systemctl command to check if Jenkins is running Diagram.

5 Open the port 8080 which is the default port to run Jenkins on the server.

No alt text provided for this image

Open the port 8080 which is the default port to run Jenkins on the server Diagram.

6 Navigate to the URL http://<publicIP>:8080

Navigate to the path and paste the admin password for first-time login to the Jenkins server.

No alt text provided for this image

Navigate to the path and paste the admin password for first-time login to the Jenkins server Diagram.

7 Install the Suggested plugin on the server.

No alt text provided for this image

Install the Suggested plugin on the server Diagram.

No alt text provided for this image

You can change the UserID and Password Diagram.

8 You can change the UserID and Password.

No alt text provided for this image

You can change the UserID and Password Diagram.

9 Now,Jenkins is ready to use. We are finally landed on the dashboard of Jenkins.

No alt text provided for this image

Now,Jenkins is ready to use. We are finally landed on the dashboard of Jenkins Diagram.

No alt text provided for this image

Now,Jenkins is ready to use. We are finally landed on the dashboard of Jenkins Diagram.

Project steps: Automating pipeline of a Webapp

1 On the Jenkins home page select the New Item.

No alt text provided for this image

On the Jenkins home page select the New Item Diagram.

2 Write the Project name and select the free-style Project.

No alt text provided for this image

Write the Project name and select the free-style Project Diagram.

3 Navigate to GitHub and take the Project URL and provides in the Jenkins Configuration.

No alt text provided for this image

Navigate to GitHub and take the Project URL and provides in the Jenkins Configuration Diagram.

No alt text provided for this image

Navigate to GitHub and take the Project URL and provides in the Jenkins Configuration Diagram.

4 To configure automation of deployment we need to install the plugin on Jenkins.

5 Navigate to Manage Jenkins and go to plugin and the available plugins. Install the plugin now.

No alt text provided for this image

Navigate to Manage Jenkins and go to plugin and the available plugins. Install the plugin now. Diagram.

No alt text provided for this image

Navigate to Manage Jenkins and go to plugin and the available plugins. Install the plugin now Diagram.

No alt text provided for this image

Navigate to Manage Jenkins and go to plugin and the available plugins. Install the plugin now Diagram

6 Navigate to GitHub and select Webhook. Use the below payload URL

http://<public-IP>:8080/github-webhook/

No alt text provided for this image

Navigate to GitHub and select Webhook. Use the below payload URL Diagram.

7 Generate the public key of the server.

No alt text provided for this image

Generate the public key of the server Diagram

8 Create the SSH Key in the GitHub and provide the public key of the server.

No alt text provided for this image

Create the SSH Key in the GitHub and provide the public key of the server Diagram.

9 Now Generate the Personal access token of GitHub to connect GitHub to Jenkins.

10 Navigate to GitHub settings and create the token.

No alt text provided for this image

Now Generate the Personal access token of GitHub to connect GitHub to Jenkins Diagram.

No alt text provided for this image

Now Generate the Personal access token of GitHub to connect GitHub to Jenkins Diagram.

11 Add the Credentials to Jenkins to create the Key.

No alt text provided for this image

Add the Credentials to Jenkins to create the Key Diagram

No alt text provided for this image

Add the Credentials to Jenkins to create the Key Diagram

12 In the Branches to build provide the main branch. Make sure to check the branch where the project currently needs to be deployed.

No alt text provided for this image

In the Branches to build provide the main branch. Make sure to check the branch where the project currently needs to be deployed Diagram.

13 As we have setup webhook previously,now select the webhook settings in the project configuration section in the Jenkins dashboard.

No alt text provided for this image

As we have setup webhook previously,now select the webhook settings in the project configuration section in the Jenkins dashboard Diagram.

14 Select the execute shell in the build steps.

15 Build the image and create the container through docker on the Jenkins pipeline.

No alt text provided for this image

Build the image and create the container through docker on the Jenkins pipeline Diagram.

16 Now,build the project. Check the console output to view the status.

No alt text provided for this image

Now,build the project. Check the console output to view the status Diagram

No alt text provided for this image

Now,build the project. Check the console output to view the status Diagram

17 Navigate to the URL and check for the web-application.

No alt text provided for this image

Navigate to the URL and check for the web-application Diagram.

Thank you for reading!! Hope you find this helpful.

#day80challenge#90daysofdevops

Always open to suggestions..!!

~ Manoj Bhamidipati ๐Ÿ™‚

ย