This topic uses two sample JAR packages to deploy applications for the provider and consumer of a microservice. The microservice is an Echo service of the provider, and the service returns messages that are sent by the consumer. This topic describes how to deploy a microservices application in the SAE console and how to verify the result.

Prerequisites

  • A namespace is created. For more information, see Create a namespace.
  • A virtual private cloud (VPC) is created. For more information, see Create a VPC.

Procedure

Deploy the microservices application for the provider

Perform the following steps to deploy the sample microservices application for the provider in SAE.

  1. Log on to the SAE console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. Then, click Create Application.
  3. In the Basic Information step, configure the parameters and click Next: Application Deployment Configurations.
    ParameterDescription
    Application Name

    Enter a custom application name.

    VPC

    Select a configuration method for the VPC. Valid values:

    • Custom Configuration: If you select this option, you must manually specify the namespace, VPC, vSwitch, and security group for the application that you want to create.
    • Automatic Configuration: If you select this option, SAE automatically specifies the namespace, VPC, vSwitch, and security group for the application.
    Namespace

    This parameter is required only if the VPC parameter is set to Custom Configuration. Select an existing namespace from the drop-down list.

    Note Namespaces and VPCs are in one-to-one mapping relationships. For information about how to modify a VPC, see Create and manage a VPC.
    vSwitch

    This parameter is required only if the VPC parameter is set to Custom Configuration. Click Select vSwitch. In the Select vSwitch dialog box, configure the parameters.

    You must specify at least one vSwitch. We recommend that you specify no more than three vSwitches. Each vSwitch must match at least one application instance.

    Security Group

    This parameter is required only if the VPC parameter is set to Custom Configuration. Select a security group from the drop-down list.

    Note If you have not created a security group in your VPC, click Create Security Group to create a security group as prompted. For more information, see Create a security group.
    Application InstancesSelect the number of instances that you want to create.
    VCPUSelect the CPU specification for the instances that you want to create.
    MemorySelect the memory specification for the instances that you want to create.
    Application DescriptionEnter the basic information about the application.
  4. In the Deployment Configurations step, configure the parameters.
    1. Configure the parameters that are used to deploy an application.
      ParameterDescription
      Technology Stack Programming LanguageSelect Java.
      Application Deployment MethodSelect Deployment with JAR Packages.
      Application Runtime Environment
      • Standard Java Application Runtime Environment: This option is suitable for Spring Boot or Dubbo applications.
      • EDAS-Container-XXX: This option is suitable for high-speed service framework (HSF) applications.

      In this example, a Dubbo application is used. Select Standard Java Application Runtime Environment.

      Java Environment
      • Dragonwell X (recommended): supports OpenJDK. If you select this option, the startup and runtime of the application are accelerated and garbage collection (GC) efficiency is improved. For more information, see Configure startup commands.
      • Open JDK X: This environment is based on the CentOS operating system and the size of the base image is large.
      • openjdk-XXXXX-jdk-alpine3.9: This environment is based on the Alphine operating system and the size of the base image is small.
      Note Compared with the CentOS operating system, the Java environment that is based on the Alphine operating system supports fewer tools or commands. If you select openjdk-XXXXX-jdk-alpine3.9, some commands in the webshell may fail to be run. Select an environment based on your business scenario.
      File Upload MethodSelect Upload JAR Package or JAR Package Path.
      • Upload JAR Package: Click Select File and select the JAR package that you want to use.
      • JAR Package Path: Enter the directory in which the JAR package is stored.

        In this example, the following directory of the JAR package is used:

        https://aliware-images.oss-cn-hangzhou.aliyuncs.com/demo/sae/spring-boot-provider-1.0-SNAPSHOT.jar
      Note The name of the package that is used to deploy an application can contain only letters, digits, hyphens (-), and underscores (_).
      VersionThe version number of the application. Enter a version number or click Use Timestamp as Version Number.
      Time Zone SettingsSelect the time zone of the application. Example: UTC+8.
    2. Optional:Configure the advanced settings based on your business requirements.
      Advanced settingDocumentation
      Service Registration and DiscoveryN/A
      Startup Command SettingsConfigure startup commands
      Java Tomcat SettingsConfigure Java Tomcat parameters
      Note You can configure Tomcat settings only if the Application Deployment Method parameter is set to Deployment with JAR Packages.
      Environment Variable SettingsConfigure environment variables
      Hosts Binding SettingsConfigure host bindings
      Application Health CheckConfigure application health checks
      Application Outbound/Inbound Internet AccessConfigure EIPs
      Application Lifecycle ManagementConfigure application lifecycle management
      Log Collection Service
      Persistent StorageConfigure NAS storage
      Configuration ManagementInject configurations
      Graceful Release and Shutdown of MicroservicesN/A
  5. Click Next: Confirm Specifications.
  6. In the Specification Confirmation step, view the details of the application and the fee for the selected specifications. Then, click Confirm.
    The Creation Completed step appears. You can click Application Details to go to the Basic Information page of the application.

Deploy the microservices application for the consumer

The procedure for deploying the application for the consumer is similar to the procedure for deploying the application for the provider. However, you must specify the directory in which the JAR package of the consumer is stored for the JAR Package Path parameter in Step4.
https://aliware-images.oss-cn-hangzhou.aliyuncs.com/demo/sae/spring-boot-consumer-1.0-SNAPSHOT.jar

Check whether the applications are deployed

You can check whether the applications are deployed on the Services page of the provider and consumer.

  1. Log on to the SAE console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region and click the name of an application.
  3. In the left-side navigation pane, choose Microservices Governance > Services to view the service information.
    • If the Echo microservice is displayed on the Published services tab, the application is deployed for the provider.
    • If the Echo microservice is displayed on the Consumed services tab, the application is deployed for the consumer.

Check whether the microservice can be called

You can configure a Server Load Balancer (SLB) instance for the consumer application to access the Internet, and then send a request from the browser to call the microservice. This way, you can check whether the microservice can be called.

  1. Log on to the SAE console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select the region where the consumer application is deployed, and click the name of the consumer application.
  3. In the Application Access Settings section of the Basic Information tab, click Add Internet-facing SLB Instance on the Based on SLB access tab.
  4. In the Add Internet-facing SLB Instance dialog box, configure the following parameters and click OK.
    • Select SLB Instance: Select Create.
    • Network Protocol: Select TCP.
    • SLB Port: Enter 80.
    • Container Port: Enter 9091. You must enter the backend port of the application. In this example, the backend port of the consumer application is 9091. For more information, see Bind an SLB instance to an application.
    Important You are charged when you use the SLB service. For more information about the billing of SLB, see Billing overview.
    After 2 to 3 minutes, the SLB instance is bound to the instance. The IP address and port of the Internet-facing SLB instance are displayed in the Public Endpoint field.
  5. In the address bar of a browser, enter the following URL.
    <Endpoint of the Internet-facing SLB instance>:<Port>/sayHello/<Custom string>
    Example: http://*.***. 169.144/sayHello/HelloSAE.
    If the browser returns the following result, the microservice is called:
    Hello, HelloSAE (from Spring Boot)

View application metrics

After an application is deployed, you can view the key performance metrics of the application in the Application Monitoring module.

  1. Log on to the SAE console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. Then, click the name of the application that you want to manage.
  3. In the left-side navigation pane, view application monitoring data as needed.
    • Application Overview: Choose Application Monitoring > Application Overview. The Application Overview page displays the key performance metrics of the application, such as the total number of requests and the average response time.
    • Application Details: Choose Application Monitoring > Application Details. The Application Details page displays more comprehensive application monitoring data, such as the data for JVM monitoring and exception analysis.
    • API Operation Calls: Choose Application Monitoring > API Operation Calls. The API Operation Calls page displays the monitoring data by API operation, such as the call topology, upstream and downstream links.
    • Advanced Monitoring: Choose Application Monitoring > Advanced Monitoring. The Advanced Monitoring page displays higher-performance monitoring and management data, such as global application topology, data of SQL exception analysis, and local call stack.

References