We see the term DevOps a lot, but what exactly is DevOps? DevOps is a software development methodology. It involves continuous development, continuous testing, continuous integration, continuous deployment, and continuous monitoring throughout the software development lifecycle. This approach is now adopted by almost all top companies to improve the quality of software development and shorten the software development life cycle. In order to meet the expectations of each company software products, to deliver the most satisfactory products to customers.
What is a waterfall model
Before we get to DevOps, let’s look at what a waterfall model is. A waterfall model defines the activities of the software life cycle as a series of connected phases that work in a fixed sequence, like a waterfall, resulting in a software product. The process is to take the output of the previous activity as the input of the activity, use this input to implement the content that the activity should be completed, and then verify the work result of the current activity, if the verification is passed, the result as the input of the next activity, continue to carry out the next activity, otherwise return modification.
The traditional waterfall model is too idealistic, and the early mistakes can only be found in the later stage of development, resulting in serious consequences. To catch errors early, incorporate an iterative process into the waterfall model. When the later stage finds the mistakes of the previous stage, it needs to return to the previous stage along the feedback line on the left side of the figure, and then come back to finish the tasks of the later stage after correcting the products of the previous stage.
Thus, the disadvantages of the traditional waterfall model are very obvious, and the overall progress of the waterfall model project is relatively slow, so most companies are now adopting DevOps.
What is Agile development
Agile development is a set of values and principles that guide us to develop more effectively.
Agile development takes user demand as the core and develops software in the way of iteration (time cycle) and increment (step by step, function module), aiming at quickly covering and responding to market demand. Large projects are divided into small projects, which are completed separately and run independently. For example, the development process of micro-services is to develop the system independently. Traditional development mode focuses on document constraints, while the implementation of agile development principle requires convenient communication within the team and relative development of culture. Removing necessary document constraints, such as Api interface documents, the most important thing is efficient communication among team members, so as to improve the development efficiency and quality of products and projects.
Agile development advocates user participation in the entire process of product or project development, and makes the product more responsive to users’ changing needs through user feedback.
Continuous integration/continuous delivery/continuous deployment
In the current DevOps trend, continuous integration (CI) and continuous deployment (CD) are pillars, and continuous integration is about trying things together. Being able to successfully build a CI/CD pipeline is critical. To bridge the gap between the development and operations teams, the CI/CD pipeline enables automatic build, test, and deployment of applications. Let’s take a look at what the CI/CD pipeline is and how it works.
CI stands for Continuous Integration, CD for Continuous Delivery and Continuous Deployment. You can also think of them as processes similar to the software development life cycle.
The pipeline shows how a piece of software moves through the phases of its life cycle before it is finally delivered to a customer or put online. It is a process of version control -> Build -> test -> deploy -> Automate test -> Deploy live -> validate test. Suppose we want to build a Web application and deploy it on a live Web server. Assume that the development team has now committed the code to the version control system (assuming the version control tool is Git).
The construction phase
Prior to this, developers had already tagged their code appropriately and submitted it to version control. If we were using the Java language, we would need to compile the code first. Therefore, after the code passes through the version control phase, it is first compiled during the build phase. This phase takes all the functional code from each branch of the code base, merges it, and eventually compiles it through a compiler. This whole process is called the construction phase.
Testing phase
After the construction phase is over, the code will continue to be tested. During this phase, we conduct a variety of tests, including unit tests. In this phase, relationships between multiple components in the code or the functionality of individual components are tested, as well as software usability tests.
Deployment phase
Once the testing phase is complete, it’s time to move on to the deployment phase. In this phase, the code will be deployed to either a quasi-production server or a test server. In this phase, you can either view the program code or run the application in the emulator.
Automatic test phase
As soon as our code is successfully deployed, we can run another set of usability tests. At the end of this phase, if all the tests pass, you can deploy it to production.
Deployment phase
Errors may be encountered during each stage of execution. In this case, the error email can be sent back to the development team so that they can fix it in a timely manner. When the team is done with the fixes, it can resubmit the code to version control and start the pipeline again from scratch. If any errors are encountered during the execution of the test, these errors are reported back to the development team, and when they are fixed, the pipeline is triggered again for another round of continuous iterations.
Validation phase
The entire lifecycle will continue iterating until we have code or products that can be deployed directly into production. In addition, we need to measure and validate our code in production to monitor the online health of our applications in real time. So far, we have looked at the CI/CD pipeline and how it works.
The process to summarize
Why do you need a unified repository Git for code management? It’s for code integration.
Why do we need to build? The logic of the code needs to be integrated and compiled error-free.
Why unit tests? The integration of a module’s functions works correctly.
Why is it necessary to align a pre-launch (pre-production) environment? You need to integrate different modules and test them in a class-production environment.
Ultimately, it’s when you deploy to production that the work that everyone does separately really comes together.
What is the conversation
Agile development, as I mentioned above, is a development process, a rapid iterative development process, each development process is very short, as long as a month, as short as two weeks, is a cycle, in this cycle, there are meetings every day synchronization, integration every day. It is because the period is short, just need to continue to do it, if a development cycle for a few months, you don’t need to continuous integration, and last for a few weeks of integration time also can do it together, but it will not be able to achieve rapid iteration of Internet companies, and we often see the traditional practices of the company.
DevOps is not just CI/CD, but also culture in addition to technology and process. For example, a huge change brought by containerization is that originally only operation and maintenance care about the deployment of the environment, whether the test environment, or the production environment, are all handled by operation and maintenance, but after containerization, you need to develop and write your own Dockerfile, you care about the deployment of the environment. Micro after service, because too many modules, let a few operations can very good manage all service, pressure big, error-prone, development is often divided into a lot of teams, however, each module is concerned with their own deployment, less error-prone, which requires operational part of the work for research and development to do, need to research and development and operations of get through, if companies don’t have the culture, DevOps cannot be implemented without writing a Dockerfile.
How to Build CI/CD Pipeline from Scratch