Deploy Resources to Alibaba Cloud using Azure DevOps- Rahi
Cloud Services

Seamlessly Deploy Resources to Alibaba Cloud using Azure DevOps

By Muktar SayedSaleh

June 19, 2023 - 5 min

Seamlessly Deploy Resources to Alibaba Cloud using Azure DevOps

As organizations look to expand their operations in the Chinese market, adopting a hybrid cloud environment that combines a global cloud platform like Microsoft Azure and Alibaba Cloud becomes an increasingly popular choice. If you’re already using Azure DevOps and want to continue leveraging its capabilities while integrating Alibaba Cloud services such as Elastic Compute Service (ECS), Container Service for Kubernetes (ACK), and FunctionCompute, this guide is for you.

We’ll discuss how to effectively utilize both cloud platforms to extend your infrastructure into the Chinese market. It’s important to note that the concepts discussed in this blog apply to all kinds of resources in Alibaba Cloud, and are not limited to ECS, ACK, and FC.

Azure DevOps and Alibaba Cloud Overview

Azure DevOps, a product of Microsoft, is a suite of tools that enables efficient collaboration between developers, automates the software development process, and ensures continuous integration and continuous delivery (CI/CD). Alibaba Cloud, on the other hand, is a leading cloud computing platform that provides a wide range of services and infrastructure to meet global businesses’ needs.

Deploying a Web Application to an Existing ECS Instance with Docker and SSH using Azure DevOps

In this scenario, we will focus on deploying a web application to an existing Alibaba Cloud Elastic Compute Service (ECS) instance using Docker and SSH. This approach enables seamless deployment and management of your web applications while leveraging Azure DevOps as your CI/CD tool.
Here’s how to deploy a web application using Docker and SSH to an existing ECS instance:

  • Prepare your Dockerfile: Set up a repository within your Azure DevOps project containing the Dockerfile that defines the web application and its dependencies. The Dockerfile should include instructions to create a Docker image of your application.
  • Configure the Build Stage: Create a build stage in your pipeline that includes steps for building the Docker image of your web application. Configure the build stage to push the Docker image to a container registry, such as Docker Hub or Alibaba Cloud Container Registry.
  • Configure the Deployment Stage: Add a deployment stage to your pipeline that performs the following tasks:

    • Retrieve the SSH credentials (private key and username) for the existing ECS instance from Azure DevOps secure files or Azure Key Vault.
    • Install the SSH extension from the Azure DevOps marketplace to integrate SSH commands into your pipeline.
    • Add SSH tasks to connect to the ECS instance, pull the Docker image from the container registry, and deploy the web application using Docker.

  • Deploy the Web Application: Run the pipeline, and it will automatically build the Docker image, push it to the container registry, and deploy the web application to the existing ECS instance using Docker and SSH.
  • Seamlessly Deploy Resources to Alibaba Cloud using Azure DevOps_1
    Azure DevOps Pipeline That Deploys Container To An ECS Instance

    Following these steps, you can efficiently deploy a web application to an existing Alibaba Cloud ECS instance using Docker and SSH with Azure DevOps, ensuring a smooth and consistent deployment process across cloud platforms.

    Deploying Alibaba Cloud ACK Clusters using Azure DevOps

    In this scenario, we will focus on deploying a web application to Alibaba Cloud Container Service for Kubernetes (ACK) using a Kompose configuration with Azure DevOps. Kompose is a tool that helps you easily convert a Docker Compose file to Kubernetes resources.
    Here’s how to deploy a Kompose configuration to an ACK cluster using Azure DevOps:

  • Prepare your Docker Compose file: Set up a repository within your Azure DevOps project containing the Docker Compose file that defines the web application and its dependencies.
  • Configure the Build Stage: Create a build stage in your pipeline that includes steps for building the Docker images of your web application and its dependencies. Configure the build stage to push the Docker images to a container registry, such as Docker Hub or Alibaba Cloud Container Registry.
  • Configure the Deployment Stage: Add a deployment stage to your pipeline that performs the following tasks:

    • Authenticate with Alibaba Cloud using the AccessKey created earlier.
    • Retrieve the Kubernetes configuration file for your ACK cluster from Azure DevOps secure files or Azure Key Vault.
    • Add a Kompose task to convert the Docker Compose file to Kubernetes resources.
    • Add Kubernetes tasks to apply the generated Kubernetes resources to the ACK cluster.

  • Deploy the Web Application: Run the pipeline, and it will automatically build the Docker images, push them to the container registry, convert the Docker Compose file to Kubernetes resources using Kompose, and deploy the web application to the ACK cluster using Kubernetes commands.
  • Seamlessly Deploy Resources to Alibaba Cloud using Azure DevOps_2
    Azure DevOps Pipeline That Deploys To An ACK Cluster

    By following these steps, you can efficiently deploy a web application to an Alibaba Cloud ACK cluster using Kompose and Azure DevOps, ensuring a smooth and consistent deployment process across cloud platforms.

    Deploying Function Compute with Aliyun CLI using Azure DevOps

    In this scenario, we will focus on updating an Alibaba Cloud FunctionCompute service using the Aliyun CLI with Azure DevOps. FunctionCompute is a serverless computing service that allows you to run your code without provisioning or managing servers.
    Here’s how to update a FunctionCompute service using Aliyun CLI and Azure DevOps:

  • Prepare your Function Code: Set up a repository within your Azure DevOps project containing the source code for your FunctionCompute service and its dependencies.
  • Configure the Build Stage: Create a build stage in your pipeline that includes steps for packaging your FunctionCompute service code and its dependencies into a deployable format, such as a ZIP archive.
  • Configure the Deployment Stage: Add a deployment stage to your pipeline that performs the following tasks:

    • Authenticate with Alibaba Cloud using the AccessKey created earlier.
    • Install the Aliyun CLI and configure it with your Alibaba Cloud credentials.
    • Add a script task to update the FunctionCompute service using the Aliyun CLI. This script should perform the following steps:

      • Update the service configuration, if necessary.
      • Update the function code by uploading the packaged code archive.
      • Publish a new version of the function or create an alias pointing to the new version, if needed.

  • Update the FunctionCompute Service: Run the pipeline, and it will automatically package the FunctionCompute service code, update the service configuration, and deploy the new version of the function using the Aliyun CLI.
  • By following these steps, you can efficiently update an Alibaba Cloud FunctionCompute service using Aliyun CLI and Azure DevOps, ensuring a smooth and consistent deployment process across cloud platforms.

    Seamlessly Deploy Resources to Alibaba Cloud using Azure DevOps_3
    Azure DevOps Pipeline That Updates A FunctionCompute Function

    Conclusion

    Azure DevOps offers a powerful, flexible solution for deploying resources to Alibaba Cloud, streamlining the management of both Elastic Compute Service instances and Alibaba Cloud Container Service for Kubernetes clusters. By leveraging Azure DevOps, you can automate the deployment process, improve collaboration among team members, and ensure a consistent, reliable experience across cloud platforms. This guide helps organizations using Azure DevOps continue benefiting from its features while migrating their workloads to Alibaba Cloud.

    Author

    • Muktar is a full-stack engineer with a wealth of experience—over 19 years—and a passion for software development, which started at the age of 12 when he pondered if he could make a computer program. That passion grew into a career. Today Muktar is a Cloud Solutions Architect at Rahi Systems. He also has a master’s degree in web technologies and certifications in AWS, GCP, and Alibaba Cloud.

    , Cloud Solutions Architect

    Cloud Services
    Jun 23,2023
    Building an Enterprise Cloud-based File Sharing Platform between the US and Mainland China

    In today’s fast-changing world, businesses are no longer limited by borders. Thanks to advanced technology and...

    Cloud Services
    Jun 13,2023
    Building a Landing Zone in Azure China with Terraform

    As businesses increasingly move their operations to the cloud, it becomes essential to have a well-designed and secure...

    Cloud Services
    Mar 15,2023
    Building an AI Powered Call-Center with AWS

    The rise of artificial intelligence technologies enables organizations to adopt and improve self-service capabilities...

    Get in touch with our experts for a free 30-minute strategy
    consultation

    Let our experts design, develop, deploy and manage your requirements while you focus on what's important for your business

    Book a Consultation
    error: Content is protected !!