Automation using power of Devops -Jenkins-Docker-Github

Automation using power of Devops -Jenkins-Docker-Github

Problem Statement:-

  1. Create docker file which will install Jenkins.
  2. As soon we run this docker image or docker file it should install Jenkins.
  3. With the help of job chaining,now we have to create jobs in jenkins.

Job1:- pull the github repo automatically when some developers push repo 

 to github.

Job2:-By looking at the code or programme file,jenkins should automatic

 start the respective language inerpreter install image container to deploy

 code eg. if code is of PHP ,then jenkins should start the container that has 

 PHP already installed.

JOb3:- Test your webpage if it is working or not.

JOb4:- If app is not working,then send email to developer with error message.

JOb 5:- if container where app is running. fails due to any reason then this 

Job should automatically start the container.

Dockerfile:-

It is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build users can create an automated build that executes several command-line instructions in succession. This page describes the commands you can use in a Dockerfile.

Step 1:- Docker file which will install jenkins for us.

No alt text provided for this image

After docker file created,now we have to build it using command,

Step 2:-docker build -t image name:version

Step 3:- we have to run jenkins with the docker image that we have created,

docker run -it --privileged -p 9060:8080 -v /:/base_os --name jenkinserver jenkins:j1

No alt text provided for this image

Different type of job implement in jenkins are:-

No alt text provided for this image

Job 1:

It can automatically pull the repo from github,as soon as code updated it push by applying some Trigger.


No alt text provided for this image

Using github

No alt text provided for this image

Deploying this code in workspace

No alt text provided for this image

I have used Poll SCM for triggering it.

No alt text provided for this image

Job 2

The role of this job is that by looking at the code of program file,jenkins should automatically start interpreter install image container to deploy code( eg if code is of PHP then jenkins should start the container that has  PHP already installed).

This job trigger after job1 build successfully.

No alt text provided for this image

Launch the environment according to it.

No alt text provided for this image

Here using HTML code hence it should launch a container using httpd_server

No alt text provided for this image

Job 3

Testing and sending mail,job3 will trigger if job2 build successfully.

No alt text provided for this image

Here using curl command to fetch http_code,if it is fail than it show error in jenkins.

If code is not working send the mail to developer with error message

No alt text provided for this image

Job 4

Monitoring and if falls then relaunch the container

No alt text provided for this image

And the site is also woking perfect

No alt text provided for this image





Chelsi Mundra

Assistant System Engineer

4 年
回复
Krishna Sharma

Apigee API Developer|API Management|Kong API Gateway|Kubernetes Certified|Microsoft Azure|DevOps

4 年
Yash Dwivedi

RHCA | Quantum Computing | OpenShift | DevSecOps | DevOps | MLOps | Big Data | Hybrid Multi Cloud | AWS | GCP | Python | Terraform | Ansible | Kubernetes | MongoDB | GIT & GitHub

4 年

Keep going ??

回复
Komal Kumawat

3x Certified || Salesforce Developer at Raptbot Technologies Pvt. Ltd

4 年

Vry well done Krishna Sharma ??

Kapil Mundra

Automation & Manual Testing

4 年

Great

要查看或添加评论,请登录

Krishna Sharma的更多文章

  • Automation of Kubernetes with Jenkins and docker using jenkins image

    Automation of Kubernetes with Jenkins and docker using jenkins image

    what is Kubernetes? Kubernetes (also known as k8s ) is an open source container orchestration platform that automates…

    3 条评论
  • Integration of ML and devops

    Integration of ML and devops

    Tweak of mlops model of cnn by using transfer learning and integrate with the DevOps automation Knowlege of tools…

    4 条评论
  • Automation project using pipelines,jenkins,github,gitbash,docker

    Automation project using pipelines,jenkins,github,gitbash,docker

    This is my first mini project of DevOps under the guidance of Mr. Vimal Dada sir and Linux World Information Pvt Ltd.

    5 条评论
  • Cloud server

    Cloud server

    Docker Docker is a tool designed to make it easier to create, deploy, and run applications by using containers…

    7 条评论

社区洞察

其他会员也浏览了