Introduction: In this article, you can learn how to effectively bridge development and operation through cloud efficiency pipeline, break down the wall between them, and make development and operation efficient linkage. During software development and deployment, our software often needs to run in different operating environments, such as the developer’s local development environment, the test environment of the test team, and the class production environment and production environment. In the whole process of r&d, development and operation, the former is requirements and code oriented, the latter is resource and environment oriented, and deployment is the part of both.

The background,

During software development and deployment, our software often needs to run in different operating environments, such as the developer’s local development environment, the test environment of the test team, and the class production environment and production environment. In the whole process of r&d, development and operation, the former is requirements and code oriented, the latter is resource and environment oriented, and deployment is the part of both. Through this article, you can learn how to effectively pull through development and operation through cloud efficiency pipeline, break down the wall between them, and make development and operation efficient linkage.

2. User demands

Generally speaking, users have the following requirements for host deployment:

1. Developers do not need to pay attention to resource changes, just need to choose the environment to deploy on demand.

2. Developers can publish independently according to the established publishing strategy, without manual configuration and intervention.

3. Operation and maintenance personnel do not need to pay attention to the R&D platform, but only need to do a good job in resource planning and management.

Third, cloud effect solutions

The combination of cloud efficiency delivery pipeline release strategy and ECS label function provides a good foundation for MULTI-environment release of ECS, as shown in the figure:

This scenario mainly involves two roles, developer and operation and maintenance personnel. In the following article, we will mainly explain these two roles.

Four, cloud effect operation practice

precondition

Next, take a Java Spring Boot code base as an example to explain how to carry out ali Cloud ECS multi-environment release through the cloud effect pipeline.

1. The operation and maintenance personnel have purchased the ECS resources of Ali Cloud and configured the corresponding environment, such as the JDK environment required in this case.

2. The operation and maintenance personnel can label the corresponding ECS resources as required. Tags identify cloud resources. They help you classify, search, and aggregate cloud resources with the same characteristics from different dimensions, facilitating resource management. ECS resources and label Settings in this article are shown in the figure below:

Label key: environment Value: dev, sit, product

Create pipeline

1. Enter the cloud effect assembly line and click “New Assembly Line” in the upper right corner to enter the assembly line creation wizard page.

2. Select the logo template and click Create

Configuration code base

  1. After the pipeline is created, a window to add code sources will pop up automatically. Here, select the sample code sources provided by Flow and add them

Configure the build upload task

Modify the “Java Build Upload” task by adding a package path and filling in deploy.sh. This file exists in the code base and contains the script to start the application on the ECS. For subsequent host deployment, this file will also need to be put into the package. You can see how to use deploy.sh in subsequent host deployment tasks. The target/ and deploy.sh paths are specified in this configuration, so Flow packages these two files (folders) into a compressed package, which is called an artifact in Flow and will be used in subsequent host deployment tasks.

Configuring deployment Tasks

1. Next, configure the host deployment task and select “artifact name.default” from the artifact drop – down box, which is the artifact archived in the previous “Java Build Upload” step. To configure a host group, create one and click Create Host Group.

2. Select “Ali Cloud ECS”, click “New Service Authorization”, jump to Ali Cloud, complete RAM authorization, and then automatically jump back to Flow.

3. Select the label mode to add, select the region, ECS label key, AND ECS label value, and click Next.

4. On the displayed page, enter the host group name and host group environment, and click Save.

5. Next, configure the deployment script:

  • Download path: says it hopes to build “upload” task in the download package to what is the position of machine, in this case the value is: / home/admin/app/package. The TGZ
  • Execute user: The user who wants to execute the script. In this example, the value is root
  • Deployment script: Execute the details of the script on the machine. In this example, the value is:

mkdir -p/home/admin/application/tar zxvf /home/admin/app/package.tgz -C/home/admin/application/sh /home/admin/application/deploy.sh restart

6. Configure deployment policies

  • Pause mode: How machines in a host group are expected to be paused, such as first batch, each batch, or not paused. It is recommended to use the first batch pause to observe the online service after the first batch is published, and if there are no exceptions, you can continue publishing the rest of the batch
  • Batch quantity: You want the machines in the host group to be distributed in batches. For example, if there are four machines in two batches, two machines will be released at the same time in each batch.

The configuration in this article is as follows:

7. View the deployment result

  • Click the save and execute button in the upper right corner

  • After the deployment is complete, click deployment details to view deployment details.

  • Through IP:8080 access verification, as shown below:

Resource Change Scenario

1. For business needs, a machine needs to be added to the development environment. O&m students only need to prepare corresponding resources on the ECS side and label the corresponding environment, as shown in the figure below.

2. After the configuration of the operation and maintenance students is completed, the development students do not need to make any changes and can directly run the corresponding environmental assembly line. In the process of pipeline operation, due to the release strategy of batch suspension set before, the pipeline will be suspended and the following state will appear

Click the “4.” button to enter the deployment details page. After confirming that there is no problem, click the “Continue” button, as shown below

Five, the conclusion

Through the above operation process, we can make use of the label function through the cloud efficiency pipeline to facilitate development and operation. At the same time, we can separate the concerns of development and operation and focus on the core work content to achieve efficient ECS multi-environment deployment.

The original link

This article is the original content of Aliyun and shall not be reproduced without permission.