DevOps Concept
What is DevOps
DevOps is a methodology aimed at eliminating barriers between operational and development teams. By leveraging processes and technologies, it enables the fastest possible delivery of applications to customers. The key is to adapt the operational cycle, incorporate feedback, and ensure continuous improvement from a technological perspective. Technology stack here.
Concepts
Here are some important basic concepts.
- Plan : Defining goals, features, and priorities for the product ;
- Code: Develop the application or feature ;
- Build : Compile the code and prepare it for testing ;
- Test : Run automated tests to ensure quality and functionality ;
- Release : Prepare the code for deployment to production ;
- Deploy : Deploy the code to production or staging environments ;
- Operate : Manage and maintain the deployed application in the production environment ;
- Monitor : Continuously track performance, errors, and user feedback to improve the system.
Imagine you have a company with several developers, all of whom are working on their own environments but on the same codebase. To avoid problems like when two people are working on the same file, we can use Git.
Git helps all developers to work on the same application simultaneously and collaborate efficiently. You can configure project organizations and define different access levels for each group and user.
There are other similar platforms like GitLab or Bitbucket that serve the same function.
To summarise, Git is the command-line tool used to facilitate collaboration among multiple developers, and GitHub is the Git-based publicly accessible repository where you push and find your code. With GitHub, you can share your project with others along with documentation, and people can contribute to your project as well.
Three-step process (CI/CD Pipeline)
The production deployment is divided into three stages :
- First, the development phase. Here, you must develop your application ;
- Next, the build phase. In this stage, you build your application to execute it ;
- Finally, the production deployment phase. This is where you can deploy your application into production.
In fact, the common workflow is as follows:
- Developers work on their development environment and push their changes to the Git server ;
- Next, they build the code into an executable and manually copy the executable to the test server to check if everything is okay (no bugs, works well, etc.).
- Once everything is verified, they move it to the production environment.
To automate these tasks and save time, there are applications such as Jenkins or GitLab CI/CD. These tools handle tasks such as building the executable, pushing it to the test server for verification, and deploying it to the production server.
The important thing is that all of these parts need to be configured in the same way using the same tools, for example, if all of them are using Python, Java, and Ruby for example.
Containers and orchestration
To save time and avoid problems about installing and configuring various libraries and dependencies, we can use containers. By using containers, we can create a template and apply it to each server. Docker, for instance, enables this capability with creating a Dockerfile and build this image on every server.
Another benefit of using containers is the ability to run multiple instances of the application on the same server. This allows us to perform multiple tasks simultaneously.
To ensure consistent deployment and management of containers, we can use an orchestration platform like Kubernetes. With Kubernetes, we gain visibility into the entire infrastructure and can effectively manage resources.
Deployment and post-configuration (Infrastructure-as-Code)
When provisioning a new server, it's essential to set it up exactly like the other servers in the cluster, with the correct resources allocated, the appropriate operating system, and the same storage, kernel, or pre-configured software. To automate this process, tools like Terraform can be used. Other utility, when we deployed a server and we have to do a post-configuration to install the software and configuring them on those servers, we can use tools like Ansible.
This methodology is called Infrastructure-as-Code (IaC), and its main purpose is to enable the deployment of infrastructure through a configuration file, anywhere and anytime.
Monitoring
To monitor these servers and track metrics such as CPU utilisation, memory consumption, and identify processes causing high resource consumption, tools like Prometheus are hopeful.
Prometheus collects metrics from various servers and stores them. For effective visualisation of the data collected by Prometheus in graphical form, applications like Grafana are used.
Notions
There are other notions that are important to understand in relation to the DevOps methodology.
GitOps
The term GitOps refers to the practice of deploying a pipeline that connects your repository (GitLab) to your Kubernetes cluster in order to do Infrastructure as Code (or Policy as Code, Network as Code, etc.). Whenever a change is made in the repository, it is then sent to a pipeline like ArgoCD, which applies the change to the Kubernetes cluster. In the CI/CD concept, GitOps is concerned only with CD (Continuous Delivery), but it remains distinct from traditional CI/CD and should not be confused with it.
Yet Another Markup Language
Yet Another Markup Language (YAML) is one of the most popular file formats used in Kubernetes, Infrastructure as Code (IaC) tools such as Ansible and Terraform, Docker Compose, and various CI/CD pipelines. It is widely preferred for its human-readable syntax, ease of use, and ability to represent complex data structures efficiently.
The data is defined using the simplest Key-Value pair format, where the key and value are separated by a colon (:). The number of spaces is very important in YAML. If you add an extra space, it could change the structure by nesting a key under a value, potentially leading to a syntax error.
Here is an example unrelated to IT/DevOps to help understand the structure of Key-Value pairs, Lists, and Dictionaries in YAML:
person: name: John Doe # Key-Value pair age: 20 address: # Dictionary (nested key-value pairs) street: Av. Lavaux 101 city: 1009 Pully country: Switzerland hobbies: # List (sequence of values) - Reading - Traveling - Cooking pets: # List of dictionaries - type: Dog name: Buddy - type: Cat name: Whiskers
- Key-Value Pair : A key directly attached to a value ;
- Dictionary : A key that contains multiple Key-Value pairs nested within it ;
- List : A key that contains multiple values in a sequence ;
- List of Dictionaries : A key that contains multiple objects, each with its own Key-Value pairs ;