DevOps Automation
End to End Automation is the need of the hour!
Introduction:
DevOps refers to automating the process between Development(Dev) and Operations(Ops) which proceeds towards Continuous Integration and Continuous Development (CICD). In a highly volatile and competitive business environment, the systems created to drive operations and development are must. Therefore the demand for the development of functional tools has soared in recent years.
Let us now begin this article to take a deep dive into what is DevOps, its features and architecture. Main Technology/Tools Used:
Jenkins:
As a CICD tool, Jenkins allows seamless, ongoing development, testing, and deployment of newly created code. Continuous Integration and Continuous Development is a process wherein developers commit changes to source code from a shared repository, and all the changes to the source code are built continuously and reflect towards the production workspace. This occurs numerous times daily and therefore each commit is continuously monitored by the CI Server, increasing the efficiency of code builds and verification.
Docker:
Docker is a set of platform as a service (PaaS) products that uses OS-level virtualization to deliver software in packages called containers. It is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage applications without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app.
Assumption:
Here we assume that Docker, Git, and Jenkins with the Git and Github Plugin are installed in the system.
The Architecture:
- The Developer & Local Workspace:
Each developer maintains a local workspace in personal system, and commits the changes/patches to Github through Git as and when necessary.
- Github:
Once the changes are pushed to Github, the challenge is to have an automated architecture or system in order to deploy these changes to the webserver (after testing) in order for the clients to avail the benefits.
- Jenkins:
This challenge is solved by Jenkins which serves as a middlemen to automate the deployment process.
Implementation and Understanding:
- Explanation and use case of Docker as a container based software to host programs such as any OS.
- Introduction to concept of an environment which consists of WebServer and Distros.
- Launching of OS in isolation (locally) from docker.
- Defining OS Image as a bootable i/o system or device.
- Also setup local webserver httpd from docker.
# docker pull httpd # docker run -d -t -i --name Redhat_WebServer httpd # docker cp new.html Redhat_WebServer
- Concept of mounting docker to remote developer's system explained.
# docker run -d -t -i /lwweb:/user/local/apache2/docs/ --name MyWebPage httpd
- Explanation of PAT networking to make local WebServer available to clients globally.
# docker run -d -t -i /lwweb:/user/local/apache2/docs/ -p 8001:80 --name ClientSideOpen httpd
- Integrating both Jenkins and Docker technologies along with the VCS such as Github with update data obtained from developers system.
- Explaining the necessity of two independent job creation for (1)obtaining code pushed to github by pull request by Jenkins, and (2)Deploying code to the environment.
- Explanation of the method of job chaining as build trigger , where one job depends on the others success, instead of simply being queued with it.
- Providing the root access to Jenkins using sudo command, after editing /etc/sudoers file, instead of the setfacl Access Control Listing command.
Procedure:
- Docker Setup:
- Jenkins setup:
Jenkins Job 1 and Job 2 Build commands are shown below.
- Output:
Respective output of Jenkins Job 1 and Job 2 shown below.
- You can visit the repository from below:
...
You can reach out on my Twitter, Instagram, or Facebook in case you need more help, I would be delighted to solve queries.
If you have come up to this, do drop an ?? if you liked this article.
Happy Coding!
#DevOps #Jenkins #Automation #Github #Git #Docker
Senior DevOps Engineer at To The New | AWS - SAA | RHCSA
4 年Good Job, Vedant ??
Strategic Transections Planner, Finance Head, Forensic Accountant, Community Developer & Spiritual Wealth Manager
4 年Very nice, Vedant.?