DevOps Automation
Now in today's world automation is one of the most efficient and sought after way of deployment . So as to learn this technology I am undergoing DevOps Assembly line training under Vimal Daga sir .Here I have created my first project which is based on integration of Github over Jenkins using docker image httpd for automation . This project is aimed at solving the developer , operation and quality assurance team and a scenario is shown by three jobs .
OBJECTIVES
We have created three jobs on Jenkins
job_1 : If the developer push to master branch then Jenkins will fetch from master and deploy on the master httpd docker .
tester : If the developer push to dev branch then Jenkins will fetch from dev and deploy on the dev - docker .
quality : In this job the quality assurance team will check for the webserver in dev docker . I f its working fine it will merge with the dev branch to the master branch and trigger job_1
Tools used : 1. RHEL8
2 . Docker
3. Git
4. Jenkins
5. Github
- OS : The base OS used is Windows 10 and the server OS used is RHEL8 in virtual box .
- We need to start the jenkins and the docker httpd . We also need to download ngrok for tunnelling purpose . Also on Jenkins the github plugins need to bed downloaded
systemctl start jenkins systemctl status jenkins docker pull httpd
3. In Windows install the git bash and on RHEL8 stop the firewall .
Now for the automation
1 .Commands to run inside git bash
Make a repository on Github with a README file then make a new directory in git bash .Clone the repo to the locally git .
Create a post-commit file to create a hook trigger and then put this command .
#!/bin/bash echo "welcome" git push
Now we will create a branch master and create a master html file. Then create another feature branch called dev html file .
2. Now in jenkins we create the developer job called tester. For this job we need to enter the github repo url inside the SCM
Now in the build we will use execute shell to write the code in which if the webserver is already running then show a message or else create a new docker httpd and copy it. Also we are using Poll SCM for scheduling which will check per minute .
NOTE : Now to use sudo for Jenkins we need to give full power to it there in the RHEL8 terminal implement these commands and change the following :
gedit /etc/sudoers
3 . Create the job_1 for the master branch and do the following steps :
4. Now comes the important part the quality assurance for this we will create the job quality and in the SCM add credentials then select add before merge .
For build trigger no need to add any trigger as it will only work if tester job works . Add build another project and git publisher:
5 . After successful implementation you will be able to see the result :
I will make further upgrades as soon as I learn new concepts . In the near future I hope to implement pipeline and make a proper website
github link:https://github.com/SamirSanyal312/devops1.git