All Products
Search
Document Center

Serverless App Engine:Use the Alibaba Cloud Toolkit for IntelliJ IDEA plug-in to deploy an application

Last Updated:Sep 03, 2024

To deploy applications in Serverless App Engine (SAE), you can use the SAE console or the Alibaba Cloud Toolkit for IntelliJ IDEA (Alibaba Cloud Toolkit in short) plug-in. This topic describes how to use the Alibaba Cloud Toolkit plug-in to deploy an application.

Prerequisites

  1. Java Development Kit (JDK) 1.8 or later is downloaded and installed.
  2. IntelliJ IDEA 2018.3 or later is downloaded and installed.
    Note The servers of JetBrains plug-ins are deployed outside China. If you cannot download or install IntelliJ IDEA due to slow network responses, Contact us.
  3. Alibaba Cloud Toolkit is installed and configured in IntelliJ IDEA.

Background information

Alibaba Cloud Toolkit is a free integrated development environment (IDE) plug-in provided by Alibaba Cloud. You can create an Alibaba Cloud account or use an existing Alibaba Cloud account to download and install Alibaba Cloud Toolkit in IntelliJ IDEA for free.

After you develop, debug, and test your application in your data center, you can use the Alibaba Cloud Toolkit plug-in to deploy the application in SAE.

Deploy an application in SAE

Alibaba Cloud Toolkit allows you to deploy applications in SAE only by using WAR packages, JAR packages, or images.

  1. In the Project section on the left side of IntelliJ IDEA, right-click the name of the project that you want to deploy and choose Alibaba Cloud > Deploy to SAE... from the shortcut menu.
  2. In the Deploy to SAE dialog box, configure the application deployment parameters and click Apply to save the settings.
    The following table describes the parameters.
    ParameterDescription
    RegionThe region where the application resides.
    NamespaceThe namespace of the application
    ApplicationThe application name.
    Build
    • Maven Build: If you select this option to build the application, the system adds a Maven job to build the deployment package.
    • Upload File: If you select this option to build the application, you must upload a WAR or JAR package.
    • Image: If you select this option to build the application, you must configure an image address.
    • Gradle Build: Not supported.
  3. Optional:In the Deploy to SAE dialog box, click Advanced. In the Advanced section, configure advanced application parameters.
    Note If you do not configure advanced application parameters, the settings in the SAE console are used by default.

    The following table describes the parameters.

    TypeParameterExampleDescription
    Deployment with JAR PackagesPackage Version1.0.1The version number of the application.
    JDKOpen JDK 8The version of the JDK on which the deployment package of the application depends.
    Web Containerapache-tomcat-7.0.91The version of the Tomcat container on which the deployment package depends.
    Startup Command SettingsJar Start Optionscustom-optionThe option settings that are used to deploy the JAR package. The following default startup command is used:
    $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgs
    Jar Start Argscustom-argsThe parameters that are used to deploy the JAR package. The following default startup command is used:
    $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgs
    Release Policy SettingsUpdate Strategy{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}The deployment policy. Examples:
    • Example 1: Perform canary release for one instance and automatically release the remaining instances in two batches with a one-minute interval between the deployment of each instance.
      {"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}
    • Example 2: Automatically release the instances in two batches with no interval between the deployment of each instance.
      {"type":"BatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":0}}
    Hosts Binding SettingsCustom Host Alias[{"hostName":"samplehost","ip":"127.0.0.1"}]The custom mappings between hostnames and IP addresses.
    Application Health CheckLiveness{"exec":{"command":["sleep","5s"]},"initialDelaySeconds":10,"timeoutSeconds":11}The details of the availability check that was performed on the container. If the container fails this health check multiple times, the system disables and restarts the container. The health check can be performed only by sending commands in a container.
    {"exec":{"command":["sleep","5s"]},"initialDelaySeconds":10,"timeoutSeconds":11}
    Readiness{"exec":{"command":["sleep","6s"]},"initialDelaySeconds":15,"timeoutSeconds":12}The readiness check of the container. If a container fails this health check multiple times, the system disables and restarts the container. Containers that fail this health check cannot receive traffic from Server Load Balancer (SLB) instances.
    Deployment SettingsMin Ready Instances1The minimum number of available instances of the application.
    Batch Wait Time10The wait time between batches. Unit: seconds.
    Environment Variable SettingsEnvs[{"name":"envtmp","value":"0"}]The environment variables.
  4. Click Run.
    You can use one of the following methods to verify that the application has been deployed:
    • BUILD SUCCESS is displayed in the logs printed in the Console section of IntelliJ IDEA.
    • The application change record in the SAE console displays Success.

Manage Maven jobs

In the Before launch section of the Deploy to SAE page, you can add, delete, modify, or move Maven jobs.

  1. In the Project section on the left side of IntelliJ IDEA, right-click the name of the project that you want to deploy and choose Alibaba Cloud > Deploy to SAE... from the shortcut menu.
  2. In the Before launch section of the Deploy to SAE page, manage Maven jobs.
    • Add a job
      1. Click the Add Job icon on the right side of the Before launch section and select Run Maven Goal from the drop-down list.
      2. In the Select Maven Goal dialog box, select the modules available for the current project and enter the build command in the Command line field.
      3. Click OK.
    • Delete a job: Select the job that you want to delete and click the Delete Job icon on the right side of the Before launch section.
    • Modify a job: Select the job that you want to modify and click the Modify Job icon on the right side of the Before launch section. In the Select Maven Goal dialog box, modify the job information and click OK.
    • Move a job: Select the job that you want to move and click the Move Job 1 or Move Job 2 icon on the right side of the Before launch section.

Deploy a multi-module project

A multi-module project is a project in which each module is independently developed and with call relationships among the modules. Alibaba Cloud Toolkit can be used to deploy a submodule in a multi-module project.

To deploy a submodule for a multi-module Maven project, you must execute the job of the submodule in the end in the Before launch section of the Deploy to SAE page.

Multi-module projects are common when you create and deploy projects. The toolkit-maven-plugin plug-in supports the following two methods for deploying a multi-module project:
  • Method 1: Run the packaging and deployment commands in your parent project.

    To use this method, you must use toolkit-maven-plugin V1.0.3 or later.

    When you run the toolkit:deploy command in your parent project, add the -Ddeploy_artifacts parameter to specify the artifact ID of the submodule that you want to deploy. If you want to deploy multiple submodules, separate them with commas (,).

    The following example shows the submodules of the CarShop project:

    carshop
       itemcenter-api
       itemcenter
    
       detail

    To deploy the itemcenter and detail submodules, run the following command in the carshop directory:

    mvn clean package toolkit:deploy -Ddeploy_artifacts=itemcenter,detail

    By default, the plug-in separately deploys the corresponding applications based on the .edas_config.yaml files of the itemcenter and detail submodules. You can also add the -Dedas_config parameter to specify the configuration file.

  • Method 2: Run the packaging and deployment commands in your submodule. All the toolkit-maven-plugin versions support this method.

    Run the install command in your parent project to install the dependencies of the submodule to your Maven local repository. Then, go to the directory of the submodule that you want to deploy and run the toolkit:deploy command.

References

The following table describes the operations that you can perform on an application after you deploy the application on SAE.

Operation

References

Lifecycle management operations, such as updating, starting, stopping, and deleting an application, and scaling in or scaling out the instances for an application

Manage the lifecycle of an application

Performance optimization operations, such as configuring auto scaling policies for an application, binding Server Load Balancer (SLB) instances to an application, and starting or stopping applications in batches

Application status-based operations, such as managing logs, configuring monitoring settings, viewing application events, and viewing change records