DevOps Automation Homework

Currently pursuing a summer training on DevOps Assembly Lines, the monotony of lockdown has been possibly wiped out for me. Just completed the 8th day of the training and I have already started understanding the concepts of Git, GitHub, Jenkins which are the basic tools of DevOps along with a bit of docker. To strengthen the concepts more using hands-on practical, my mentor Mr. Vimal Daga Sir given us a task a deploy an automation environment that would open a self-made webpage. This blog has been written to visualise the task carried out by me.

The jobs carried out are:-

JOB#1 : If Developer push to dev1 branch then Jenkins will fetch from dev1 and deploy on dev1-docker environment.

JOB#2 : If Developer push to master branch then Jenkins will fetch from master and deploy on master-docker environment , given that both dev1-docker and master-docker environment are on different docker containers.

JOB#3 : Jenkins will check (test) for the website running in dev1-docker environment. If it is running fine then Jenkins will merge the dev1 branch to master branch and trigger JOB#2.

The pre-requisites to the task are:- i) OS RHEL8 in virtual machine ii)GitHub iii)Git Bash iv)Jenkins installed with GitHub plugins v)Docker in vm.

In order to carry out the jobs, the following steps were carried out:-

  1. A GitHub repository was created named DevOps_project and a basic HTML file was pushed into the repository.
No alt text provided for this image

2. The repository was cloned onto Git Bash and another branch of the repository was created and named dev1 branch while original was master branch.

No alt text provided for this image

3. A post-commit git hook is created that will automatically push any command onto GitHub as soon as it is committed to dev1 branch. This is done by shell scripting in .git/hooks folder.

No alt text provided for this image

4. Some further commits on dev1 branch were made to check proper functioning of the commands made till now.

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

5. Now comes the use of Jenkins - an open source CI tool. For creation of JOB#1, the following configuration of Jenkins were made after creating an item named job1. After all the configurations were made, the changes were applied and saved.

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

6. Next we build the JOB#2 (named job2 in my case). For this all the configuration in Source Code Management tab and Build tab remains the same ( although make the branch specifier in SCM tab */master). The only change in Build triggers tab is that it is made to build after the JOB#3 (I have named it mergejob) triggers it to do so. After the configurations

No alt text provided for this image


No alt text provided for this image

7. Next comes JOB#3 named mergejob. This will be done by the QA team. After they test the proper deployment of the dev1-docker environment (job1), if the run is successful then Jenkins will merge the dev1 branch to master branch and trigger JOB#2. The configurations are given.

Firstly we need to give our GitHub credentials in SCM tab.

No alt text provided for this image

Under additional behaviour, we need to chose "merge before build" and give the proper branch names and repository.

No alt text provided for this image

Under Post-build Actions tab, the following configurations.

No alt text provided for this image

When saved and applied, our JOB#3 is ready to build!!!

8. Thus all the jobs are successfully build and are working accordingly.

No alt text provided for this image

9. So finally, this is my webpage in just initial stage.

No alt text provided for this image

And this is after some changes were made. All the updates in the webpage would be automatic as the jobs were made to automate the process.

No alt text provided for this image

This was all about the task that was assigned to us.

Now, I bear a private IP which is not accessible to the public. In order to make an IP public so that anyone can access my webpage, we use a software called ngrok that gives us a url to the webpage which when opened from any system leads to the webpage without an issue.

That's all....Thank you guys :)


Pralay Mondal

Block Chain Enthusiast || CSE'24 @NIT Durgapur || Web Developer @InternPE || Finalist @JumpStart || General Secretary @ISTE NITDGP

4 年

Good

Raktim Midya

RHCA-III ★ Aspiring Freelancer & DevOps Consultant ★ Taught Hundreds of Students & Still Teaching ★ 1x AWS, 9x RedHat, 4x Microsoft Certified ★ AWS Community Builder ★ Technical Content Creator @Medium @YouTube

4 年

Good work ??

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

Saranya Chattopadhyay的更多文章

社区洞察

其他会员也浏览了