Only one application can be deployed to an Elastic Compute Service (ECS) instance. To publish an ECS application is to install Enterprise Distributed Application Service (EDAS) Container on your ECS instance and then use a WAR or JAR package to deploy the application in EDAS Container.

Prerequisites

Before performing the steps in this tutorial, you must have completed the following steps:
  1. Activate EDAS
  2. Create a VPC network
  3. Create a namespace
  4. Create an ECS cluster
  5. Synchronize an SLB instance to EDAS(If you need to configure load balancing).

Create ECS applications

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Application Management > Applicationsat the top of the Applications page, select a namespace.
  3. On the Applications page, click Create Application in the upper-right corner.
  4. In the Create Application dialog box, enter the application information. After you set the parameters, click Create an Empty Instance. An application that contains no instance is created. Click Next. The Application Configuration page appears.
    • Namespace: Select a region from the drop-down list on the left and select a namespace from the drop-down list on the right. If you do not select a namespace, the default namespace is used.
    • Cluster Type: Select ECS Cluster from the drop-down list on the left, and select a specific ECS cluster from the drop-down list on the right.
    • Application Name: Enter the name of the application.
    • Deployment Method: After you select an ECS cluster, deploy the application through a WAR package or a JAR package.
    • Application Runtime Environment:
      • WAR: If you want to create a native application, select Apache Tomcat. If you want to create an HSF application, select EDAS-Container.
      • JAR : If you want to create a native application, select Standard Java Application Runtime Environment. If you want to create an HSF application, select EDAS-Container.
    • Java Environment: Select Open JDK 8 or Open JDK 7.
    • Application Description: Enter the basic information of the application. The description must be up to 128 characters in length.
  5. On the Application Configuration page, click + New to add an instance, and configure the instance as instructed. After specifying the configurations, click Create.
    • Application Source: In an ECS cluster, you can add an instance in any of the following three methods: If you do not select any instance, click Create an Empty Application to create an application that contains no instances. Then, add instances to the application through Perform auto scaling on applications in ECS clusters and deploy the application.
      • From cluster select: Click + New next to Selected Applications. On the Instances page, select an idle instance from the cluster of the application, click > to add the instance to the section on the right, and then click Confirm.
      • Purchase Based on Existing Example Instances:
        1. Click Host Selection next to Template Host.
        2. In the Select Template Host dialog box, select any instance in the cluster and use it as the template. Select a recycling mode, and then click Confirm in the lower-right corner.
        3. On the Application Configuration tab, configure Password and Purchase Quantity. Then, select ECS Service Terms | Image Service Terms.
      • Purchase Based on Instance Startup Template:

        1. Click Select Template next to Launch Template.
        2. In the Select Start Template dialog box, select the template based on which the instance is created and the template version, select a recycling mode, and then click Confirm in the lower-right corner.
        3. On the Application Configuration tab, configure Purchase Quantity of the instance, and select **ECS Service Terms | Image Service Terms**.
    • Deploy Now: This option is available only after you have selected an instance. Enable Deploy Now and configure the instance as instructed.

    • File Uploading Method: Select Upload WAR Package or **WAR Location**.

      • Upload WAR Package: Click Select File and select the target WAR package.
      • WAR Location: Copy the storage path of the WAR package and paste the path to the WAR Location field.
      Note The name of the application deployment package can contain only letters, numbers, hyphens (-), and underscores (_). A JAR package can be uploaded only when the JAR package deployment method is selected. Otherwise, you can only deploy the application by using a WAR package.
    • Version: Specify the version, for example, 1.1.0. We recommend that you do not use the timestamp as the version number.
    • Application Health Check (optional): Specify a URL for performing health check on the application. The system checks the health of the application after the container is started or is running. Then, the system routes services based on the health check result. A sample URL is http://127.0.0.1:8080/_etc.html.
    • Batch: Specify the number of batches. You can specify the number of batches and publish the application to the selected instances in batches only when two or more instances are selected.
    • Batch Mode: Select Automatic or Manual. When you select Automatic, you need to specify Batch Wait Time, which is the interval between different application deployment batches.
  6. Wait several minutes until the application is created. After the application is created, you can view the application information on the Application Details page. On the Application Details page, click the Instance Information tab. Check the running status of the instance. If Running Status is Running, the application is published.

Deploy and update application

If you have created an empty application, you can deploy the application by clicking Deploy Application on the Application Details page. If you have deployed an application when creating the application, you can update the application by clicking Deploy Application.

  1. Log on to the EDAS console. In the left-side navigation pane, choose Application Management > ApplicationsOn the Applications page, click the application you want to deploy.
  2. On the Instance Information tab, check whether the application has any available instance. If not, click Scale Out to add at least one instance for the application.
  3. Click Deploy Application, specify the deployment parameters as instructed, and click Confirm to publish the application.
    • Deployment Method:
      • For a new application: Select WAR, JAR, or Historical Version to deploy the application.
      • To upgrade a deployed application, you can select the method you used to deploy the application the first time or select Historical Version.
    • File Upload Method: If you want to deploy the application by using a WAR package, select Upload WAR Package or **WAR Location** to upload the package.
      • Upload WAR Package: Click Select File and select the target WAR package.
      • WAR Location: Copy the storage path of the WAR package and paste the path to the WAR Package Location field.
    • Version: Specify the version, for example, 1.2.0. We recommend that you do not use the timestamp as the version number.
    • Group: Select a group for the application.
    • Batch: Specify the number of deployment batches. If you select two or more batches, you must specify Batch Wait Time.
    • Batch Mode: Select Automatic.
    • Java Environment (optional): Select JRE 8 or JRE 7.
    • Application Description (optional): You can describe the purpose of deploying this application or leave it blank. The description must be up to 128 characters in length.
    • Generate Maven Plug-in Configuration: You can generate Maven plug-in configurations and then deploy the application according to Automatically deploy an application to an ECS cluster through toolkit-maven-plugin.
  4. After you redeploy an application, the Change Details page appears. You can view the deployment process and execution logs on this page. After the deployment process is complete, if the status changes to Execution Successful, the deployment is successful.
  5. Verify the application publishing results

    After publishing an application, you can view the instance running status or log on to the SLB configuration page to verify whether the application has been published.

    View the running status of the application instance On the Instance Information tab, view the running status of the ECS instance. If Status is Normal, the application has been published.

Add a public SLB instance to the application

The application is created and published in a VPC. Therefore, the application does not have any public IP address unless otherwise specified. If your application is deployed on multiple ECS instances and you want to expose your application externally, we recommend that you configure a public Server Load Balancer (SLB) instance. In this way, application access traffic can be distributed to ECS instances based on forwarding policies, which can enhance the service capability and application availability.

  1. In the Application Settings section of the Basic Information tab, click Add next to SLB (Internet).
  2. In the Bind SLB to Application dialog box, set the SLB parameters and then click Save.
    • SLB (Internet): Select the address of a public or private SLB instance as needed from the drop-down list.
    • Use VServer Group: A VServer group contains a group of ECS instances for processing frontend requests distributed by the SLB instance. Listeners can be associated with different VServer groups to monitor request forwarding. If you have selected Use VServer Group, you must specify VServer group parameters.
    • VServer Group Name: If you have selected New Virtual Server Group, you must enter a name for the new VServer group. The system creates a VServer group with the specified name.
    • Listener (Internet): A listener defines how to forward inbound requests to a backend server. At least one listener must be created for each SLB instance. You can select a listener port from the Listener (Internet) drop-down list. If no listener is available, click Create New Listener to create a listener. Do not delete the listener in the SLB console. Otherwise, the application cannot be accessed normally.
    • SLB Frontend Protocol: The value is TCP by default and cannot be configured manually.
    • SLB Frontend Port: Enter the port number of the frontend port of the SLB instance.
    • Application Port: The value is 8080 by default and cannot be configured manually.
  3. Copy the configured IP address and port number of the SLB instance such as 118.31.159.169:81, paste it in your browser address bar, and press Enter to go to the welcome page of the application.

Manage ECS applications

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications. On the Applications page, click the target application. The Application Details page appears.
  3. On this page, you can perform basic management operations, including browsing, setting, stopping, starting, scaling out, rolling back, and deleting the application.