On December 9th, Qin Xiaojia, a senior R & D engineer of Alibaba Cloud Container Service team, shared the exploration of DevOps based on container technology at the off-line salon of Yunqi computing tour. This paper first introduces DevOps and CD, then analyzes how Docker breaks the traditional CD barriers, and finally explains how to build a continuous delivery system from scratch.
DevOps and Continuous Delivery
in a mature software and service delivery team, the technical level is mainly divided into three components: development, testing and operation and maintenance. The development and testing team focuses on whether the code can run, while the operation and maintenance team focuses on whether the system can run stably after it goes online. As a result, barriers arise. DevOps came into being to solve this problem. The role of DevOps is to connect these three parts closely, provide an automated pipeline from software development to quality assurance to technical operation, and strengthen communication and cooperation between different roles, so as to reduce resource waste, improve quality, and quickly push products to the market, quickly and effectively turn an idea into value and deliver it to customers.
how to implement DevOps? We defined CD (continuous integration), which is a method. CD has three important points: automation, continuous and effective feedback. In the figure, the process from code to delivery is shown from left to right.
Several problems may be encountered during the CD process, which can be summarized in three aspects: environment consistency, environment inconsistency between developers, version management, and quick response (release and rollback). Question.
So, what is the root of the problem? Developer deliver only the code and the dependencies of the code, while keep site running requires the runtime environment and dependencies between the runtime environments in addition to the code.
Docker how to break the traditional CD barrier?
Docker is one of the most suitable tools for implementing DevOps. It has even changed the software delivery method to effectively solve problems encountered during continuous delivery.
Alibaba Cloud Container Service
alibaba Cloud container service has clusters and nodes at the resource level, Compose templates and images at the content level, and applications, services, and containers at the application level.
Complete containerized continuous delivery process
in the traditional development process, developers have logic, applications, and code dependency packages in their code. However, Docker File and Docker Compose are added to our code to make containers and carry containers, after the code is submitted, the code server notifies the CI server,CI server pulls the code to package the code, and then performs a unit test. If the unit test fails, a valid feedback is immediately sent to the developer. If the application is approved, we will create an image based on the Docker file given by the code. The server will have the configured permission to use the image and push it to the Alibaba Cloud container, code deliverables have been generated.
During the deployment phase, if the integration test or regression test is performed in the Test environment, the template Compose during deployment is used to describe how to deploy and enrich functions through Jenkins, you can use various plug-ins to pull images and deploy them in the application environment. This allows you to submit code changes to the entire deployment process.
Jenkins 2.0 includes a new pipline build delivery system. The design concept of the pipeline is based on Groovy DSL to implement a flexible and scalable continuous release (CD) workflow, connect tasks that run independently on one or more nodes to implement a complex publishing process. In addition, Jenkins can directly read scripts from the code library.
Build a continuous delivery system from scratch
Stage is a clear definition of the entire continuous delivery process. It is written by yourself. Unit test results can also be perfectly displayed. The time consumed in each Stage can be directly read from logs for viewing, you can also store the results of software packaging locally.
Continuous Delivery Process Design
the plug-in is used to dynamically generate slave nodes and execute the final job destruction process. We also support shared storage of OSS, uploading war packages, and storing things to be delivered in the form of images, the deployment is a plug-in developed by Alibaba Cloud and calls the API of container service.
Jenkins Master and Agent
Docker in docker means that the Agent uses Docker to package images. If ten projects are executed on the Jenkins, the installation of the agent in all projects consumes a lot of resources, therefore, we adopt the parent-child structure. Through the passthrough method, we can use the agent server of Docker on the host to build and package images to isolate images within the automated process.
container Service now supports two publishing methods:
one is rolling update, which stops old containers and starts new containers in sequence. The whole process is automated without manual operation. It is suitable for testing scenarios and multi-Copy application Publishing; first, blue-green release (hot deployment): The old container is not stopped, and new containers are started for the new service. You need to set the routing weight to implement the online and offline of different versions of applications, it is suitable for quick release of versions without affecting users.
Canary release (phased release) will be supported in the future: the old containers will not be stopped and new containers will be started for new services. You need to set routing weights to implement the coexistence of different versions of applications. A/B test is supported, select multiple solutions.
About Cloud Computing tour
the Yunqi technology Tour is hosted by the Alibaba Cloud Yunqi community. It integrates top technical experts and technical resources in various fields within the Alibaba Group. Through offline technical training, it provides a platform for friends who love technology to exchange and share technical views and collide with wonderful sparks.
Wonderful review of Phase 1: https://yq.aliyun.com/articles/62414
phase 3 forecast (front-end special session on December 23):https://yq.aliyun.com/promotion/140
About Alibaba Cloud Container Service
alibaba Cloud Container Service (Container Service) provides a high-performance and scalable Container application management Service that supports application lifecycle management through Docker containers on a group of cloud servers. Container Service greatly simplifies the construction of container management clusters, seamlessly integrates Alibaba Cloud's virtualization, storage, network, and security capabilities, and creates an optimal runtime environment for Docker Cloud. Container Service provides multiple application publishing methods and pipeline-like continuous delivery capabilities. The native microservice architecture supports seamless cloud migration and cross-cloud management.
Alibaba Cloud Container Service: https://www.aliyun.com/product/containerservice
Start Building Today with a Free Trial to 50+ Products
Learn and experience the power of Alibaba Cloud.Sign Up Now