Automation using power of Devops -Jenkins-Docker-Github
Krishna Sharma
Apigee API Developer|API Management|Kong API Gateway|Kubernetes Certified|Microsoft Azure|DevOps
Problem Statement:-
- Create docker file which will install Jenkins.
- As soon we run this docker image or docker file it should install Jenkins.
- 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.
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
Different type of job implement in jenkins are:-
Job 1:
It can automatically pull the repo from github,as soon as code updated it push by applying some Trigger.
Using github
Deploying this code in workspace
I have used Poll SCM for triggering it.
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.
Launch the environment according to it.
Here using HTML code hence it should launch a container using httpd_server
Job 3
Testing and sending mail,job3 will trigger if job2 build successfully.
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
Job 4
Monitoring and if falls then relaunch the container
And the site is also woking perfect
Assistant System Engineer
4 年Nice Krishna Sharma
Apigee API Developer|API Management|Kong API Gateway|Kubernetes Certified|Microsoft Azure|DevOps
4 年Thnx 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 ??
3x Certified || Salesforce Developer at Raptbot Technologies Pvt. Ltd
4 年Vry well done Krishna Sharma ??
Automation & Manual Testing
4 年Great