DEVOPS project
Project on DevOps with the Integration of Jenkins, Git, Github and Docker
Problem :
JOB#1
If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment.
JOB#2
If Developer push to master branch then Jenkins will fetch from master and deploy on master-docker environment. Both dev-docker and master-docker environment are on different docker containers.
JOB#3
Manually the QA team will check (test) for the website running in dev-docker environment. If it is running fine then Jenkins will merge the dev branch to master branch and trigger #job 2 If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment.
Solution:
Repository:
First i created a repository in my base-OS and git initialized it. then going to directory .git/hooks/ inside it I created a post-commit hook which would self push the repository whenever the developer committed something to git. I also added a remote trigger for my job1 after it so after the code was pushed onto GitHub it would automatically trigger job1.
Job.1:
Created a job named dev1 which would be auto triggered whenever the developer committed on his local repo through the remote trigger added in the post commit file. Also added the poll SCM method for triggering in-case some other developer pushed code onto the github repo. the job would copy the files on the test branch of the repository in another directory and then launch an docker container which would mount that directory and launch a server and host the repository files. But before launching it would check if an instance of a container was already running with the same name and if it were it would first remove the running instance and then launch a new env as it is good practise to always test on a fresh env.
Job.2:
now comes the task of the QAT team it would check the test env and look for errors or vulnerabilities in case none were found they will run an URL which would trigger job2 which would then merge the test branch to master branch
Job.3:
created a job named 1(master one) which would on successful completion of job 2 be triggered by chaining method as it is a downstream project of job 2. The job will first copy the master branch repository into a directory then run a docker container with that directory mounted on the web server which could be then accessed by the client.
Images below id the look of the created web page.
click here to see git repo
This project can be further changed and new look and feel can be created according the situation and information udpates.
I would like to thank Vimal Daga sir for this first project of Devops. He inbuilt the confidence and the way his idea of 'creator' inspired me to complete this project
Thank You sir!
DevOps Engineer || AWS Certified Solutions Architect - Associate
4 年Great work??
Software Engineer @ Microsoft
4 年Good work ??