Welcome to the exciting world of DevOps!
What you will Learn:
- SDLC evolution
- Before DevOps
- After DevOps
- DevOps Engineer role
- Benefits of DevOps
- Brief overview of DevOps Tools
- Typical DevOps Workflow
- DevOps as CI/CD
SDLC Evolution
The traditional SDLC waterfall model approach is suitable for products whose requirements do not change over the software development lifecycle. The challenge with this approach is that, if there are 10 product requirements (features), the end user will not have the product look and feel till the final product is built. Once all the 10 features are developed and tested, only then the application would be deployed to production. So the release lifecycle was quite long.
On the contrary, in the Agile world, the end user wants to have a look and feel of the features as and when they are developed. The challenge here is a) individual feature needs to be developed and tested and deployed to production b) requirements might change at any point of time c) operations team is not kept in sync of any changes that might come in between and hence some friction is expected.
Most of the above challenges and risks are mitigated in DevOps software development approach. One of the primary reason being, the entire code deployment process to development server -> to staging server -> to production server, is automated. Jenkins helps us automate the entire process.
Before DevOps
Before DevOps culture, there used to be a development and operations team. The developers used to write their code and pass it to the operations team. The operations team will add few configurations, make it production ready and deploy it to the servers. The operations team would also manage the infrastructure.
The challenge in pre-devops culture:
- Dev team & Ops team would be working independently. They do not know what the other team is doing. No collaboration between developer and operations personnel
- Developers always want to move their code to production as soon as possible. However operations team perform their due diligence before deploying anything new to production and hence the deployment process used to be slightly slow. This resulted in little bit of stress between the 2 teams.
After DevOps
DevOps is simply a way of doing activities/tasks that has automation in every aspect of it. DevOps was introduced to overcome the above challenges and accelerate the software delivery process.
Also read: Configure Selenium-Java Webdriver in Eclipse
The developers can now deploy the changes directly to servers and hence the process is much faster, see below
The whole DevOps system that we are going to build will be running on a linux machine. DevOps is not a tool, instead it is a culture comprising of many tools.
Before getting deployed to production, the source code moves through various stages inside the DevOps culture world. There are various tools available for each stage:
- Git (local source code version management tool),
- GitHub (remote source code version management tool),
- Maven (to build the project),
- Tomcat (app server to deploy apps),
- Docker (to create containers),
- Kubernetes (to manage deployment of containers),
- SonarQube (for code analysis),
- JFrog (to store the artefacts that are generated using Maven build process),
- Ansible, Chef, Puppet (configuration deployment automation tools),
- Jenkins, Bamboo (integrates all the above tools enabling automated deployments using Continuous Integration/Continuous Delivery pipeline code),
- Vagrant (to create local lab infrastructure by creating linux virtual machines),
- AWS, Azure, Google cloud (to create infrastructure on cloud)
The ultimate goal of all these tools is to help us accelerate the process of source code deployment to production.
DevOps Engineer role
As a DevOps engineer, we need to work with multiple technologies and should be able to integrate devops tools. The person has a dual role: developer & operations engineer. DevOps engineer will be responsible to move the source code to different DevOps stages and finally deploy it to production environment.
Also read: Working with Various Browsers
Benefits of DevOps
DevOps make our life easier since it automates application deployments by integrating various tools.
Brief overview of DevOps Tools
- Platform – All the DevOps tools are configured in Linux platform
- Source code management – Git maintains the version of your code, at any point of time you can see the code version history, you can also see who modified the code, when was it modified and so on;
- CI/CD – Jenkins is a continuous integration and continuous deployment tool. What this means is that, whenever the developer updates his/her code, Jenkins will automatically pull the updated code and deploy the changes to your website. The end users will now see the new changes;
- Containers – Docker containers are completely isolated environments. Each container can have their own processes or services. The main purpose of Docker is to containerize applications and to ship them and run them;
- Managing containers – Suppose the production environment is running thousands of containers. To manage the containers, we use Kubernetes;
- Automation tools in DevOps – Ansible can be used to automate any service in Windows/Linux/Server etc;
- Infrastructure as a Code (IAAC) – We can create our linux instances (infrastructure) in 2 ways: Vagrant can be used to create infrastructure in our local machine. AWS Cloud, Azure, Google cloud platform etc can be used to create infrastructure on cloud (for deploying a real application).
Typical DevOps Workflow
The different stages are numbered in the below diagram and are shown in brackets.
Below is a typical DevOps workflow:
- Developers develop their code
- Commit the code to local Git repository (Git keeps track of source code changes in developer’s local system)
- Once code is ready, developers push the code to remote GitHub repository. When multiple developers are working on a common project, GitHub distributed repository ensures code integrity and solves collaboration issues between developers
- We use Jenkins to integrate all the tools and it ensures that the code moves from one stage to another stage automatically. So, Jenkins clones the GitHub repository
- Jenkins will execute Maven command for build process. Maven compiles and packages the source code into an artefact
- Once build is success, Jenkins will ask Maven to push the source code to sonarqube for code quality analysis
- Once code quality is ‘Pass’, Maven publishes the artefact to JFrog artifactory
- Once artefacts are ready in JFrog artifactory, the artefacts can be deployed to application servers. The app server can be a standalone (apache tomcat) OR it can be a Docker container
- Jenkins calls Ansible scripts to run playbooks to create custom docker image (that includes our artefact). Ansible playbook will take care of publishing custom images to the docker hub
- Once customized image is available at docker hub, Jenkins will run the deployment manifest and service manifest on kubernetes cluster. The kubernetes master starts creating the application instances (viz deploy the application) on the worker nodes (pods)
- Once the application is running successfully, we can now access the application using a URL which is mapped to specific application endpoint. End users can now access the application.
We would be learning fundamentals of most of these tools as we move along this exciting DevOps journey.
DevOps as CI/CD
DevOps software development approach comprises of: Continuous development, Continuous Testing, Continuous Integration and Continuous deployment (all of these at the same time).
If you look at the above figure, the new features are continuously being developed and tested. Once thoroughly tested, the new features and the bug fixes are continuously deployed to end users. The entire process is automated using various tools at each stage.
So this was all about DevOps fundamentals.
We would next be starting with source code management: Git & GitHub tools.
Thank you for reading!