DevOps Project
Ridham Dogra
Aspiring Data Science and Artificial Intelligence Enthusiast | Post Graduate Student in Artificial Intelligence and Data Science | Generative AI Extern
DevOps is Development and Operation's Collaboration, It's a Union of Process, People and Working Product that enable continuous integration and continuous delivery of value to clients. DevOps accelerate the process to deliver applications and software services at high speed and high velocity.
AIM:
The aim is simply to automate everything from pushing the code to the Source Code Management (SCM) system to deploying it to the Production server using automation tool Jenkins while using the containerization tool Docker for creating the testing and production servers.
Introduction:
In this setup I have created two branches in a single git repo which will be directly linked to the testing and production servers respectively. .As soon as the code is pushed to the centralized system GitHub through the Decentralized system Git by the developer it is automatically downloaded by Jenkins and saved in a directory. The Docker containers are used for testing and production servers which are mounted with these directories and hence after testing the branches are merged and the changes are deployed.This setup is an example of CI(Continuous Integration) using Jenkins
Tools Required:
- Git and Github(Source Code Management)
Git is a distributed version-control system for tracking changes in source code during software development.GitHub is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface.
- Docker
Docker is a containerization tool which helps us to create multiple containers/OS in just a second. The testing and Production server should be same so I used Docker for creating these servers using the same httpd docker image.
- Jenkins
Jenkins is a free and open source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery.
Explanation
In this setup I have created two branches on the same git repo named Master and dev. The dev branch is linked to the github remote branch dev which is directly connected to the testing server created using Docker container for testing done by the QAT(Quality Assurance Team) while the Master branch is linked with the github remote master branch which is connected to the Production Server. If the QAT passes the green signal after testing the changes in testing server the branches are merged and the changes are deployed to the production server.
In Jenkins I have created four jobs:
- Job1(deploying_testenv)-As soon as the code is committed by the developer in the dev branch it is automatically pushed to GitHub using hooks concept and side by side triggering Jenkins that there is some change in the repo. Jenkins automatically download the code and saves it in a directory and also simultaneously creating a docker container which is mounted with data of dev branch and will work as the testing server for testing this code
- Job2(testing_testenv)-This job is downstream of job1 which means that this job will run only if the first job is successful. If the job1 is successful then this job will go the testing server and will get the HTTP code of the server. This HTTP code will be saved in a variable. This HTTP code will tell us that if the website is working properly or not.
- Job3(Merging_Branches)-This job is downstream of job2. If the job2 is successful then this job will go to GitHub and merge both branches hence changing the data in master branch which is connected to our production server for deployment.
- Job4(production_environment)-This job is downstream of job3 and if job3 is successful this job will download the data from master branch and also creating a docker container for production server. The data of master branch is mounted with the production server and hence deployed.
- Also created different views using build and delivery pipeline plugins to visualize the whole process graphically.
Images for Reference: