Enterprise Distributed Application Service (EDAS) provides microservices application demos that use the following frameworks: Spring Cloud, Dubbo, and High-speed Service Framework (HSF). These demos show you how to quickly deploy microservices applications in specified Elastic Compute Service (ECS) environments in EDAS. This topic describes how to deploy microservices applications in a custom ECS environment.
EDAS is activated. For more information, see Activate EDAS.
Auto Scaling is activated and granted permissions on related Alibaba Cloud resources.
A virtual private cloud (VPC) and ECS instances are created.Note
Custom environments are environments where applications run in the microservices namespaces, VPCs, ECS instances, and ECS clusters that you create. You can create microservice namespaces and ECS clusters when you deploy applications. You must create VPCs and ECS instances before you deploy applications in custom environments.
For information about how to create VPCs that use IPv4 CIDR blocks, see VPC console (manual creation). When you deploy a microservices application in a custom ECS environment, VPCs that use IPv6 CIDR blocks are not supported. Make sure that the region of the selected VPC is the same as the region where you want to deploy your microservices applications.
For information about how to create ECS instances, see Create an instance. When you create ECS instances, you must use the VPC that you created in Step a. To reduce costs, we recommend that you create two pay-as-you-go ECS instances, each of which is configured with one vCPU and two GB of memory. If you no longer require the ECS instances, we recommend that you release the instances at the earliest opportunity.Important
The port that is configured in the application demo is port 8080. When you create the ECS instances, you must enable port 8080 in the security group settings. Otherwise, you cannot access the web page of the client-side application. If you want to enable specific ports after you deploy your microservices application, you must perform the following operations: On the application details page, click the Basic Information tab. In the Application Settings section, view the value of the Application Port parameter and specify the Port Range parameter in the security group rule based on the application port.
Custom ECS environment: A custom ECS environment refers to an ECS cluster that resides in a specified microservices namespace and in a specified VPC in a region.
Application demo: You can use application demos in the EDAS console to call simple services. An application demo uses the Spring Cloud, Dubbo, or HSF framework. Each demo contains two microservices applications. The procedure for deploying an application demo is the same for different frameworks. In this example, a Spring Cloud application demo is deployed. For more information about application demos, visit alibabacloud-microservice-demo.
For more information about how to implement the features of microservices applications, see Overview of application development.
Python microservices applications cannot be deployed in ECS environments. You can deploy Python microservices applications in Kubernetes environments by using images. For more information, see Deploy Spring Cloud and Dubbo applications in a Kubernetes cluster.
Create a server-side application
Each microservices 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 steps in this section to deploy the client-side application.
Log on to the EDAS console.
In the left-side navigation pane, choose .
- In the top navigation bar of the Applications page, select the region in which you want to deploy the application. On the page that appears, select the microservices namespace that you want to manage, and click Create Application.
In the Basic Information step of the Create Application wizard, configure the basic information of the application and click Next.
In the Cluster Type section, click ECS Cluster.
In the Application Runtime Environment section, click Java. In the Java Environment drop-down list, select Open JDK 8.
The Spring Cloud application demo to be deployed in the ECS cluster is a Java Archive (JAR) package. Therefore, Java is selected as the application runtime environment in this example. If you want to deploy Spring Cloud, Dubbo, or HSF applications in the ECS cluster by using WAR packages, follow the instructions on this page to select an appropriate application runtime environment and version.
Enter an application name in the Application Name field.
(Optional) Enter a description for the application in the Application Description field.
In the Configurations step, configure the deployment package and environment parameters for the application, and click Next. The following table describes the configurations used in this example.
Source of Deployment Package
Select Official Demo.
Select Spring Cloud Server Application from the drop-down list.
Select Use Existing Instance.
Select Custom Environment.
Select the microservices namespace where your cluster resides from the drop-down list.Note
If the cluster resides in the default microservices namespace, select Default.
If you want to use an existing cluster, select your cluster from the drop-down list. If you want to create a cluster, perform the following operations:
Click Create Cluster. In the Create Cluster dialog box, select VPC from the Network Type drop-down list and select the VPC that you created in Step a from the VPC Network drop-down list.
Instance Source Type
If you want to use an instance that is not imported to a cluster, select Instance not Imported to Any Cluster.
If you want to use an instance that is imported to the selected cluster, select Instances in Current Cluster. To import an instance to the cluster, perform the following operations:
In the left-side navigation pane of the EDAS console, choose Resource Management > ECS Clusters. Find the cluster to which you want to import the instance and click the cluster name to go to the Cluster Details page. In the ECS Instance section, click the icon and click Add Existing ECS.
In the Select Cluster and Existing ECS Instances step of the Add ECS Instance wizard, select Import ECS, select the created ECS instance, and then click Next.
In the Ready to Import step, confirm the information about the instance and click Confirm and Import.
In the Import step, check whether Directly imported. appears in the Status column. If Directly imported. appears, click Back to Cluster Details. You can view the imported instance in the ECS Instance section.
Select the created ECS instance.
In the Advanced Settings step, configure the Version, Application Health Check, Batch, Batch Mode, and Wait Time Before Next Batch parameters, and click Create Application.Note
The Wait Time Before Next Batch parameter is required only when you select more than one ECS instance. In this example, the application demo is deployed only on one ECS instance. Therefore, you do not need to specify this parameter.
By default, the current timestamp is specified as the version number. The format of the version number is yyyymmdd:hhmmss.
Batch: Select 1 Batches.
Batch Mode: Select Automatic.
- In the Creation Completed step, confirm Basic Information, Configurations, and Advanced Settings. Then, click Create Application.
After EDAS starts to deploy the application, the message Application change in progress... is displayed in the upper part of the Basic Information tab. The deployment takes about 2 minutes.
You can also click View Details next to the message to go to the Change Details page of the application. On this page, you can check the deployment progress and log data.
Create a client-side application
You can refer to the procedure for creating a server-side application to create a client-side application. For more information, see Create a server-side application. When you create a client-side application, you must select Spring Cloud Client Application from the Demo Type drop-down list.
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.