How to deploy to a host using Apsara DevOps

Updated at:

Modern businesses require sustainable software development and rapid iterations to quickly convert requirements into delivered products. This process demands a fast response capability, which drives the adoption of continuous integration, continuous delivery, and continuous deployment.

1. User needs and problems

  • Deployment challenges: Deployments can be labor-intensive. Many upgrades are performed at night, which requires employees to work overnight. Even with this effort, error-free upgrades are not guaranteed. Businesses often lack the capability for rapid, large-scale deployments.

  • Version tracking: All historical versions must be saved for traceability. This practice enables quick rollbacks when errors occur.

  • Quality assurance: Businesses often lack a unified development platform, have low levels of automation, and lack an effective quality assurance system. Infrastructure development often fails to keep up with rapid business growth.

2. Apsara DevOps + Host Deployment solution

The Apsara DevOps continuous delivery pipeline, combined with host deployment, provides a solid foundation for continuous application delivery. The following figure illustrates this process.

ECS01

A developer commits code changes to a repository. Apsara DevOps monitors the repository for changes. When a code change is detected, a pipeline build task is automatically triggered. This process includes code scanning, building, test deployment, test validation, and production deployment. After the build is complete, an artifact package is generated and automatically uploaded to a repository. During the deployment phase, which includes deploying to testing and production environments, the latest version is retrieved from the artifact repository. The artifact is then deployed to different environments using host resources according to the specified deployment policies. These host resources can be on Alibaba Cloud or self-managed.

The following steps describe how to quickly configure this continuous deployment pipeline.

3. Apsara DevOps + Host Deployment user guide

Follow these steps to quickly create a pipeline for host deployment using Apsara DevOps.

Note

Try it now: Apsara DevOps Flow

Create a pipeline

Navigate to the pipeline application. In the upper-right corner, click New Pipeline. Select your development language. Select the "Test, Build, and Deploy to Alibaba Cloud ECS/Self-managed Host" template to quickly enable host deployment.

Click Create to initialize the pipeline. Click Add Pipeline Source, select the code source to add, and then click Save.

Edit the pipeline

Build artifact: You can specify a name for the artifact or use the default name. Subsequent tasks in the pipeline can use the artifact that is configured here.

Host deployment: Select the artifact from the previous step. Then, select or create a host group. A host group is a set of machine resources that run in a specific environment, such as an integration testing environment (also known as a daily environment), a staging environment, or a production environment that serves external users.

Apsara DevOps supports two types of host groups: Alibaba Cloud ECS instances and non-Alibaba Cloud hosts that can access the public network.

For more information about deploying to Alibaba Cloud ECS, see Deploy to Alibaba Cloud ECS.

For more information about deploying to a host on the public network, see Deploy to a public host.

Deployment configuration: In the host deployment task, you can configure the deployment settings to install the build artifact on the deployment machine. For more information about deployment configuration, see Deployment configuration.

Deployment policy: During host deployment, you must specify a deployment policy. Apsara DevOps provides phased release and canary release capabilities.

Run the pipeline

On the pipeline editing page, click Save and Run in the upper-right corner. The pipeline is automatically saved and starts running.

Deployment details: On the pipeline run page, click Deployment Details in the host deployment task to view the deployment process. In this example, a phased release is configured. The deployment pauses after the first batch is successfully deployed and requires your confirmation to continue.

Rollback: The deployment history is recorded for all pipeline runs. You can select any historical record to perform a rollback. After a new pipeline completes its first deployment, the deployment history and the rollback button may not be displayed. If this occurs, you can refresh the page.

View test reports

On the pipeline page, you can click the test reports and logs for each stage to view detailed test results and execution statuses.

4. Advanced Apsara DevOps + Host Deployment pipelines

The previous section described basic pipeline operations. For a real-world deployment, you can enhance the pipeline by adding more validation steps and checkpoints as needed. For example:

  • Pipeline 1: Continuous validation pipeline (Host deployment to a testing environment)

  • Pipeline 2: Continuous release pipeline (Host deployment to a production environment)

A pipeline defines the steps and checkpoints of the continuous delivery process. By running Pipeline 1 and Pipeline 2, you can complete the entire continuous delivery process, from the initial code commit to the final production release.