All Products
Search
Document Center

Deploy Java Web applications in ECS clusters

Last Updated: Aug 06, 2019

An ECS instance can deploy only one ECS application.To publish an ECS application is to install an EDAS container on your ECS instance and then use a WAR or JAR package to deploy the application in the EDAS container.

This topic describes how to create a Java Web application with only a welcome page in the EDAS console, and how to deploy, update, view, and manage the application with a WAR package.

After reading this document, you will be able to:

  • Create ECS applications in the EDAS console.
  • Deploy an ECS application to the web.
  • Update a deployed ECS application.
  • Verify a deployed application
  • Manage applications

Prerequisites

To perform the steps in this tutorial, you must have completed the following steps:

  1. Activate EDAS.
  2. [Create VPCs].(https://www.alibabacloud.com/help/doc-detail/87742.html#creatVPCInEDAS)
  3. [Create ECS instances].(https://www.alibabacloud.com/help/doc-detail/87742.html#creatECSInEDAS)
  4. Create namespaces.
  5. Create ECS clusters.
  6. Synchronize SLB instances to the EDAS console (only if you need to configure SLB).

Create ECS applications

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications. At the top of the Applications page, select a namespace. All applications in the namespace are displayed.

  3. Click Create Application in the upper-right corner of the Applications page.

  4. In the Create Application dialog box, enter application information and click Next Step: Application Configurations.

    Create app in ECS cluster

    • Namespace: Select Region and Namespace from the drop-down list.If you do not select a namespace, the default namespace is automatically selected.
    • Cluster Type: Select ECS Cluster from the drop-down list and then select a specific cluster.
    • Application Name: Enter the application name.
    • Deployment Method: Select WAR or JAR.(The configuration procedure for WAR and JAR deployment methods are similar. The following describes how to deploy an application with a WAR package.))
    • Application Runtime Environment: Select the latest EDAS Container version.For example, EDAS container V3.5.1 [supports FatJar deployment].

    • Java Environment: Select JRE 8 or JRE 7.

    • Application Description: Enter up to 100 characters of basic application information.
  5. On the Application Configuration page, add an instance and configure the instance as instructed.Then click Create.

    • Selected Instances: Click Add. On the displayed Instances page, select an instance and click > to add the instance to the right area, and then click OK.

      • For no instance selected: Click Create Empty Application to create an empty application.Then, click Scale Out, Add Instance, or Deploy Application to publish the application.

      • For an instance selected: Click Create to create an empty application containing instances.Then, click Deploy Application to publish the application.

    • Deploy Now: This option is available only after you select an instance.Enable Deploy Now and configure the parameters as instructed on the page.

      Create app in ECS clus deploy now

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

      • Upload WAR Package: Click Download Sample WAR Package. After the sample package is downloaded, click Select File and select a WAR package.
      • WAR Package Location: Right-click Download Sample WAR Package and copy the link address. Paste the link address to the WAR package address bar.

        Note: The name of an application development package can contain letters, digits, hyphens (-), and underscores (_). A JAR package can be uploaded only if the selected version supports JAR deployment. Otherwise, the application must be deployed through a WAR package.

    • Version: Set a version (for example, 1.1.0) for the application. We recommend that you do not use a timestamp as the version number.

    • Application Health Check (optional): Set a URL for application health checking.The system checks the health of the application after the container is started or is running to see whether the application is working normally. Then, it performs a service routing task based on the results of the health check.A sample URL is as follows: http://127.0.0.1:8080/healthCheck.html

    • Batch: Specify the number of batches. If you select two or more batches, you need to set the Interval.Batch Mode: Select Automatic.

  6. Wait several minutes until the application is created.After creating an application, go to the Application Details page to view the application.On the Instance Information tab page of the Application Details page, view the running status of the application instance.If the running status/time is Running, the application is published successfully.

Deploy and update applications

If only an empty application is created, on the Application Details page, click Deploy Application to deploy the application. If the created application has been deployed, click Deploy Application to update the application.

  1. Log on to the EDAS console. In the left-side navigation pane, choose Application Management > Applications. On the Applications page, click the name of the application to be deployed.

  2. On the Application Details page, click the Instance Information tab. On the tab page that is displayed, check whether an instance is available for the application. If not, click Scale Out to add at least one instance for the application.

  3. Click Deploy Application, follow the instructions on the interface to set the deployment parameters, and click Publish.

    Deploy app

    • Deployment Method
      • For a new application: Select WAR, JAR, or Historical Version to deploy the application.
      • For an upgraded application: Select the method used for the first deployment or Historical Version to deploy the application.
    • File Uploading Method: Select Upload WAR Package or WAR Package Location (in the example, a WAR package is used).
      • Upload WAR Package: Click Select File and select the WAR package used to deploy the application.
      • WAR Package Location: Copy the WAR package storage address and paste it into the WAR package address bar.
    • Version: Set a version (for example, 1.2.0) for the application. We recommend that you do not use a timestamp as the version number.
    • Group: Select a group.
    • Batch: Specify the number of batches. If you select two or more batches, you need to set the Interval.Batch Mode: Select Automatic.
    • Java Environment (optional): Select JRE 8 or JRE 7.
    • Application Description (optional): The description can be blank. The description content should describe the purpose of deploying this application.The maximum length of the content is 128 characters.
    • Generate Maven Plugin Configuration: Generate the Maven plugin configuration and deploy an application based on the procedure in Use toolkit-maven-plugin to automatically deploy applications.
  4. After you redeploy an application, the Change Details page is displayed and you can view the deployment procedure and operation logs on the page.After you complete the deployment, the execution status becomes Execution Successful.

Verify the results of application publishing

After publishing an application, you can view the instance running status or log on to the SLB instance for address configuration to verify that the application is published successfully.

View the running status of the application instance

On the Instance Information tab page of the Application Details page, view the running status of the ECS instance.If the running status/time is Running, the application is published successfully.

Configure Internet SLB and access the application

Because the application is created and published in the VPC, it has no public IP address unless configured specially.If you deploy your application on multiple ECS instances and want to allow external access, we recommend that you configure Internet SLB instances to distribute application access traffic to ECS instances based on a forwarding policy. This enhances the service capabilities and application availability.

  1. In the Application Settings area on the Basic Information page, click Add to the right of SLB (Internet).

  2. In the Bind SLB to Application dialog box that appears, set the SLB parameters and click Configure SLB.

    Binding SLB

    • SLB (Internet): Select the intranet or Internet address of the SLB instance as needed from the drop-down list.
    • Use VServer Group: A VServer group is a group of frontend ECS instances used to process requests distributed by SLB instances.Different listeners can be associated with different VServer groups to distribute different requests to different backend servers.If you select Use VServer Group, you must configure the VServer Group parameter.
    • VServer Group Name: Enter the name for the new VServer group if you select Create VServer Group.The system creates a VServer group with the specified name.
    • Listener (Internet): SLB listeners regulate how requests are forwarded to backend servers.At least one listener must be created for each SLB instance.You can select a listening port from the Listener drop-down list.If no listener has been created, click Create New Listener.- Do not delete the listener in the SLB console; otherwise, the application cannot be accessed normally.
    • SLB Frontend Protocol: The default setting is TCP, which cannot be configured manually.
    • SLB Frontend Port: Enter the frontend port of the SLB instance.
    • Application Port: The default setting is 8080, which cannot be configured manually.
  3. Copy the URL consisting of the IP address and port of the SLB instance, for example, 118.31.159.169:81. Then, paste it into the address box of the browser and press Enter. The welcome page of the application appears.

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 an application name.

  3. On the Application Details page, click the Basic Information tab. On the tab page that is displayed, you can perform basic management tasks, for example, viewing, setting, stopping, starting, scaling up/down, rolling back, and deleting an application.