Jenkins, GitHub and Docker Integration
Naman Jain

Jenkins, GitHub and Docker Integration

MLOPS & DEVOPS Task - 1

Technologies used in this Task :

1) Jenkins

2) Git and GitHub

3) Docker

Jenkins

Jenkins is a free and open source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat


Git & GitHub

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

Projects on GitHub can be accessed and manipulated using the standard Git command-line interface and all of the standard Git commands work with it. GitHub also allows registered and unregistered users to browse public repositories on the site. Multiple desktop clients and Git plugins have also been created by GitHub and other third parties that integrate with the platform.


Docker

Docker is a set of platform as a service product that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels

---------------------------------------------------------------------------------------------------------------

Objective of Task

We have to Create these 3 given Jobs:

JOB 1:

If Developer pushes to developer branch, then Jenkins will fetch from developer branch and deploy the website on the developer-docker environment (Testing environment)

JOB 2:

If Developer pushes to master branch, then Jenkins will fetch from the master branch and deploy on the master-docker environment (Production environment) and use ngrok (tunnel) to connect to the world.

JOB 3:

This is the job managed by the Quality Assurance team. If the site is correct and meets the requirements, this job would be executed. It will go to GitHub, merge the developer branch with the master branch, and trigger JOB 2.

---------------------------------------------------------------------------------------------------------------

Procedure to Complete the Jobs:


Step - 1: Firstly, we have to create a Local Repository in our Windows PC using Git having 2 branches with names (a) Master and (b) Developer and we will add the website content on it, while this Local Repository is being Connected to Github Repository Online.

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

Step - 2 : Now, we will install Jenkins on our Redhat OS, which will be used for Automation of the Task. To start the services of Jenikins we will use the command " Systemctl Start Jenkins " in Redhat OS Command line.

No alt text provided for this image

--> Jenkins provide us a Beautiful WEBUI, which can be acces using chrome by typing the IP of RH OS and Port number 8080 (on this port nubmer we use Jenkins).

No alt text provided for this image

Step - 3 : In this step we will download and copy webpage file from GitHhub and paste it in redhat OS to the specified folder for Webpage Hosting, and after it we will launch the Docker OS which is used for Containerisation.

No alt text provided for this image

Step - 4 : Now, in Github Job - 1 we will write the code to launch the docker OS.

No alt text provided for this image

Step - 5 : Now, The QAT(Quality Assurance Team) will check the code and if it doesn't pass the requirements of the user then this will not be merged with the master branch. Otherwise, it will be Merged and trigger job_2.

No alt text provided for this image

Step - 5 : If Developer pushes to master branch then Jenkins will fetch from the master branch and deploy on the Production environment.  (Both the testing and production environment is an indifferent docker container)

No alt text provided for this image

Step - 6 : We will write this ode in Jenkins for Focker Enviorment.

No alt text provided for this image

Step - 6 : Finally, we create a tunnel using ./ngrok and visit our deployed web page.

No alt text provided for this image

--> Now the Webpage will look like this:

No alt text provided for this image


We have Successfully Completed the Task -1 by Integrating Jenkins, Docker and Git.


Link to Github:


To view or add a comment, sign in

More articles by Naman Jain

Others also viewed

Explore content categories