DevOps Assembly Lines Task #1

DevOps Assembly Lines Task #1

Task Description :

JOB 1

If Developer push to master branch then Jenkins will fetch from master and deploy on "Deploy" environment

JOB 2

If Developer push to dev branch then Jenkins will fetch from dev and deploy on "Test" environment.

JOB 3

Manually the QA team will check (test) for the website running in "Test" environment. If it is running fine then Jenkins will merge the dev branch to master branch and trigger Job 1.

Setup on Linux:

  • setenforce 0
  • systemctl stop firewall
  • systemctl start Docker
  • systemctl start httpd
  • systemctl start Jenkins

Creating repository on github:

  • cd DevOps_task1
  • git init
  • git add README.md
  • git commit -m "first commit"
  • notepad Index.html 
No alt text provided for this image


  • git commit -m "Create Index.html"
  • git remote add origin https://github.com/suchitrasaksena/task1.git
  • git push -u origin master
  • git checkout -m dev
  • notepad Index.html
No alt text provided for this image


  • git add .
  • git commit -m "first commit in dev"
  • git push -u origin dev
No alt text provided for this image

The repository is created successfully.

Jenkins Configuration:

Job 1

This job will work whenever changes are made in the master branch and will deploy the updated website on an httpd docker image container named "Deploy" and the updated website will be visible on port no. 8081.


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


EXECUTE SHELL code:

sudo cp * -v /root/task1/deploy

if sudo docker ps | grep deployenv

then

sudo docker rm -f deployenv

fi

sudo docker run -dit -p 8081:80 -v /root/task1/deploy:/usr/local/apache2/htdocs/ --name deployenv httpd

No alt text provided for this image


Job 2

This job will work whenever changes are made in the master branch and will deploy the updated website on an httpd docker image container named "Test" and the updated website will be visible on port no. 8082.

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

EXECUTE SHELL code:

sudo cp * -v /root/task1/test

if sudo docker ps | grep testenv

then

sudo docker rm -f testenv

fi

sudo docker run -dit -p 8082:80 -v /root/task1/test:/usr/local/apache2/htdocs/ --name testenv httpd

No alt text provided for this image

Job 3

This job will be triggered remotely when the qat team approves the changes and will merge the changes from dev branch to master branch.

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

Both the branches are merged.

No alt text provided for this image

All the jobs are executed properly.

Thanks for reading and feel free to your suggestions to improve this code:)

Devendra Singh Shekhawat

Battery management system || Hardware || AI&ML in EV || STM32 || Renesas || Automobile || BeagleBone || AUTOSAR || TEDx speaker

4 年

Nice work Suchitra!

Aditi Nirmal

Barclays Analyst 3 @ Barclays || HPAIR'21

4 年

So so well done!

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

Suchitra Saksena的更多文章

  • DevOps Assembly Lines Task #6

    DevOps Assembly Lines Task #6

    Task Description: Deploy your website on kubernetes with the help of Jenkins coding file as follows: 1. Create…

    2 条评论
  • DevOps Assembly Lines Task #5

    DevOps Assembly Lines Task #5

    Task Description: Integrate Prometheus and Grafana in following way: Deploy them as pods on top of Kubernetes using the…

    4 条评论
  • DevOps Assembly Lines Task #4

    DevOps Assembly Lines Task #4

    Task Description: Create A dynamic Jenkins cluster to achieve this setup: Create container image that’s has Linux and…

  • DevOps Assembly Lines Task #3

    DevOps Assembly Lines Task #3

    Task Description: Create container image that’s has Jenkins installed using docker file. When we launch this image, it…

  • DevOps Assesmbly Lines Task #2

    DevOps Assesmbly Lines Task #2

    Task Discription: Create container image that has Jenkins installed using dockerfile. When we launch this image, it…

社区洞察

其他会员也浏览了