Alibaba Cloud Toolkit for IntelliJ IDEA is a free integrated development environment (IDE) plug-in provided by Alibaba Cloud that lets you deploy applications to Serverless App Engine (SAE) directly from IntelliJ IDEA — no need to switch to the SAE console.
You can use a new or 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 plug-in to deploy the application in SAE.
Prerequisites
Before you begin, make sure you have:
Java Development Kit (JDK) 1.8 or later installed
IntelliJ IDEA 2018.3 or later installed
JetBrains plug-in servers are hosted outside China. If you experience slow downloads or installation failures, contact us.
Alibaba Cloud Toolkit installed and configured in IntelliJ IDEA
Deploy an application
The plug-in supports three deployment methods: WAR packages, JAR packages, and container images.
In the Project panel on the left side of IntelliJ IDEA, right-click the project name and choose Alibaba Cloud > Deploy to SAE....
In the Deploy to SAE dialog box, configure the basic deployment parameters and click Apply.
Parameter Description Region The region where the application is deployed Namespace The namespace of the application Application The application name Build The build method — see the options below Build options:
Maven Build — the plug-in adds a Maven job to build the deployment package automatically.
Upload File — upload a WAR or JAR package manually.
Image — provide a container image address.
Gradle Build — not supported.
(Optional) Click Advanced to configure additional deployment parameters.
If you skip this step, the plug-in uses the settings currently saved in the SAE console.
The following table describes the advanced parameters.
Category Parameter Example Description Deployment with JAR packages Package Version 1.0.1The version number of the deployment package JDK Open JDK 8The JDK version the application depends on Web Container apache-tomcat-7.0.91The Tomcat version the deployment package depends on Startup command settings Jar Start Options custom-optionOptions appended to the default startup command: $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgsJar Start Args custom-argsArguments appended to the default startup command: $JAVA_HOME/bin/java $JarStartOptions -jar $CATALINA_OPTS "$package_path" $JarStartArgsRelease policy settings Update Strategy See examples below The deployment rollout policy Hosts binding settings Custom Host Alias [{"hostName":"samplehost","ip":"127.0.0.1"}]Custom hostname-to-IP mappings Application health check Liveness {"exec":{"command":["sleep","5s"]},"initialDelaySeconds":10,"timeoutSeconds":11}The liveness check configuration. If a container fails this check multiple times, SAE disables and restarts it. Only command-based checks are supported. Readiness {"exec":{"command":["sleep","6s"]},"initialDelaySeconds":15,"timeoutSeconds":12}The readiness check configuration. If a container fails this check multiple times, SAE disables and restarts it. Containers that fail this check cannot receive traffic from Server Load Balancer (SLB) instances. Deployment settings Min Ready Instances 1The minimum number of instances that must be available during deployment Batch Wait Time 10The wait time between deployment batches, in seconds Environment variable settings Envs [{"name":"envtmp","value":"0"}]Environment variables to inject into the application Update Strategy examples:
Canary release for one instance, then automatically release the remaining instances in two batches with a one-minute interval: ``
json {"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}``Release all instances in two batches with no interval: ``
json {"type":"BatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":0}}``
Click Run.
Verify the deployment: The deployment succeeds when either of the following is true:
BUILD SUCCESSappears in the Console panel in IntelliJ IDEA.The change record in the SAE console shows Success.
After a successful deployment, open the SAE console to manage your application — view logs, configure auto scaling, bind an SLB instance, and more.
Manage Maven jobs
Use the Before launch section on the Deploy to SAE page to add, delete, modify, or reorder Maven jobs that run before deployment.
Right-click the project name in the Project panel and choose Alibaba Cloud > Deploy to SAE....
In the Before launch section, manage Maven jobs:
Add a job:
Click the
icon and select Run Maven Goal.In the Select Maven Goal dialog box, select a module and enter the build command in the Command line field.
Click OK.
Delete a job: Select the job and click the
icon.Modify a job: Select the job, click the
icon, update the job details in the Select Maven Goal dialog box, and click OK.Reorder a job: Select the job and click the
or
icon.
Deploy a multi-module project
In a multi-module project, modules are independently developed but share dependencies. Alibaba Cloud Toolkit deploys individual submodules rather than the entire project.
To deploy a submodule for a multi-module Maven project, you must execute the job of the submodule last in the Before launch section of the Deploy to SAE page.
Two methods are available:
Method 1: Deploy from the parent project (requires toolkit-maven-plugin V1.0.3 or later)
Run the packaging and deployment command from your parent project directory, using -Ddeploy_artifacts to specify which submodules to deploy. Separate multiple artifact IDs with commas.
For example, given this project structure:
carshop
├── itemcenter-api
├── itemcenter
└── detailTo deploy itemcenter and detail, run the following command in the carshop directory:
mvn clean package toolkit:deploy -Ddeploy_artifacts=itemcenter,detailBy default, each submodule is deployed using its own .edas_config.yaml file. To use a different config file, add the -Dedas_config parameter.
Method 2: Deploy from the submodule directory (all toolkit-maven-plugin versions)
In the parent project directory, run
installto install submodule dependencies into the local Maven repository.Go to the submodule directory and run
toolkit:deploy.
What's next
After deploying your application on SAE, you can perform the following operations:
| Operation | Reference |
|---|---|
| Update, start, stop, delete, or scale instances | Manage the lifecycle of an application |
| Configure auto scaling | Configure an auto scaling policy |
| Bind an SLB instance | Bind an SLB instance to an application |
| Start or stop applications in batches | Use the one-click start and stop feature to manage applications |
| Manage configurations | Configuration management |
| Change instance specifications | Change the instance specifications of an application |
| View real-time logs | Log management |
| Monitor application performance | Monitoring management |
| View application events | View application events |
| View change records | View change records |
| Diagnose applications with WebShell | Use webshells to diagnose applications |