To help you experience how to deploy microservice applications in EDAS, EDAS provides microservice application demos of Spring Cloud, Dubbo, and HSF. You can deploy application demos to a custom ECS environment (specified ECS cluster). This topic uses an example to describe how to deploy microservice applications in a custom ECS environment.

Prerequisites

  • The EDAS service is activated. For more information, see Activate EDAS.
  • The Auto Scaling service is activated and granted permissions.
  • Custom environments are the namespaces, virtual private clouds (VPCs), ECS clusters, and ECS instances that you create. You can create namespaces and ECS clusters when you deploy applications. VPCs and ECS instances must be created before you deploy applications. For more information, see Create an IPv4 VPC network and Manage an ECS instance in the console (express version)Quick start.
    Note When you create a VPC, select the region where you want to deploy the application. When you create an ECS instance, select the created VPC. For only the experience purpose, we recommend that you create only two pay-as-you-go ECS instances whose specifications are 1 core and 2 GB. Release the created instances in time after the experience.

Background information

  • Custom ECS environment: a specified namespace in a region and an ECS cluster in a VPC.
  • Application demos: You can use the microservices-based application demos in the EDAS console to deploy and call simple services. The microservices-based application demos use the Spring Cloud, Dubbo, and HSF frameworks. Each demo contains two applications. The procedures to deploy application demos that use different frameworks are similar. This topic describes how to deploy an application demo that uses the Spring Cloud framework.

    For more information about the microservices-based application demos, see alibabacloud-microservice-demo.

  • For more information about how to implement the features that are related to microservice applications, see Application development overview.

Deploy an application demo

Each microservices-based application demo contains a server-side application (service provider) and a client-side application (service consumer). The following example shows how to deploy the server-side application. After you deploy the server-side application, repeat the same steps in this section to deploy the client-side application.

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Applications.
  3. In the top navigation bar of the Applications page, select the region where you want to deploy the application. On the page that appears, select the namespace that you want to manage and click Create Application.
  4. In the Basic Information step of the Create Application wizard, enter basic application information and click Next.
    1. In the Cluster Type section, click ECS Clusters.
    2. In the Application Runtime Environment section, click Java and select Open JDK 8 from the Java Environment drop-down list.
      The Spring Cloud application demo to be deployed in the ECS cluster is a JAR package. Therefore, Java is selected as Application Runtime Environment in this example. When you deploy an application for production purposes, you can follow the instructions on this page to select a proper application runtime and Java environment.
    3. Enter the name of the application in the Application Name field.
    4. Optional:Enter the description of the application in the Application Description field.
  5. On the Application Configuration tab, configure the deployment package and the environment for the application and click Next.
    Deploy an application in a custom environment
    1. Select Official Demo as Source of Deployment Package.
    2. Select Spring Cloud Server Application from the Demo Type drop-down list.
    3. Below the Environment parameter, select Custom Environment.
    4. Select the namespace where the created cluster is located from the drop-down list below the Namespace parameter.
      If you create a cluster in the default namespace, select the default namespace.
    5. Select the cluster that you create from the drop-down list below the Cluster parameter.
    6. Select ECS instances that are added to the cluster from the instances below the Select Instance parameter.
  6. On the Advanced Settings tab, specify the Version, Application Health Check, Batch, and Wait Time Before Next Batch parameters and click Create Application.
    • Version: By default, EDAS uses the current configured timestamp as the version. The version is in the format of yyyymmdd:hhmmss.
    • In this example, the application demo is deployed to only an ECS instance. Therefore, set the Batch and Wait Time Before Next Batch parameters to 1 Batches and Automatic.
  7. In the Creation Completed page, confirm Basic Information, Configurations, and Advanced Settings, and then click Create Application.

    After the system starts to deploy the application, the message A change process is ongoing for this application. The application is in Executing state. is prompted on the top of the Basic Information page. It requires about 2 minutes to deploy the application.

    You can also click View Details next to the prompted message to navigate to the Change Details page of the application. On this page, you can check the deployment progress and log data.

  8. Repeat the preceding steps to deploy the client-side application.

Verify the result

The client-side application contains web services. After both the server-side and client-side applications are deployed, check whether you can log on to the web interface of the client-side application.

  1. In the top navigation bar of the Applications page, select the region where the client-side application is deployed. Then, click the name of the client-side application.
  2. On the Basic Information page of the client-side application, click Instance Information.
  3. On the Instance Information tab, copy the public IP address of the ECS instance where the client-side application is deployed.
  4. Open a web browser and enter the connect string of the client-side application into the address bar. The connect string must be in the http://<Public IP address of the ECS instance>:8080 format. Then, check whether you can log on to the web interface of the client-side application.
  5. Enter a string into the Echo this string field, for example, Hello EDAS. After you enter a string, click Click here to check whether a successful response is displayed at the bottom of the page.

    The Data Return After Call section displays the procedure how the client-side application (service consumer) calls the server-side application (service provider). If the string that you entered is returned, this indicates that service call is successful and the microservices-based application is deployed.

    2020-08-25T10:00:01.866Z :  Consumer received.    
        2020-08-25T10:00:01.878Z :  Provider received.
            Provider processed after sleep 1 second! Echo String: "Hello EDAS"
        2020-08-25T10:00:02.878Z :  Provider Return
    2020-08-25T10:00:02.882Z :  Consumer Return