22 Deploying Serverless Applications Through ID Emaven Practices

22 Deploying Serverless Applications through IDEMaven Practices #

SAE Application Deployment Methods #

1. Overview of SAE #

img

Firstly, let’s introduce SAE briefly. SAE is a Serverless PaaS platform designed for applications. It supports mainstream development frameworks such as Spring Cloud, Dubbo, and HSF. Users can deploy applications to SAE without any code modifications. SAE provides on-demand usage, pay-per-use billing, and sub-second elasticity. By fully leveraging the advantages of Serverless, SAE helps users save costs on idle resources. In terms of user experience, SAE adopts a fully-managed and maintenance-free approach. Users only need to focus on core business development, while SAE handles application lifecycle management, microservice management, logging, monitoring, and other functionalities.

2. SAE Application Deployment Methods #

image.gif2.jpg

When using SAE, you can see that there are three deployment methods supported: deployment using WAR packages, JAR packages, or images. If you are using applications such as Spring Cloud, Dubbo, or HSF, you can directly package and upload them, or enter the package address to deploy them on SAE. For non-Java language scenarios, you can also use images for deployment. In the future, we will also support direct package uploads for other languages.

In addition to the deployment methods provided in the console, SAE also supports deployment via Maven plugins or IDE plugins. With this approach, you can automate the deployment process without having to log in to the console. You can also integrate with tools such as Alibaba Cloud DevOps Platform (Cloud Efficiency) or Jenkins to implement CI/CD workflows.

Deploying with Maven Plugin #

3.jpg

How to deploy using the Maven plugin? First, you need to add the Maven dependency toolkit-maven-plugin to your application. Then, you need to write a configuration file to configure the plugin’s specific behaviors. Here, three configuration files are defined:

  • toolkit_profile.yaml (Account Configuration File): Used to configure your Alibaba Cloud AccessKey (AK) and SecretKey (SK) to identify your Alibaba Cloud account. It is recommended to use sub-account AK and SK to reduce security risks.
  • toolkit_package.yaml (Packaging Configuration File): Used to declare the type of application deployment. You can choose to deploy using WAR, JAR, URL, or image. If you choose the WAR or JAR method, the current application will be packaged and uploaded. For the URL or image method, you need to specify the corresponding package address or image address for deployment.
  • toolkit_deploy.yaml (Deployment Configuration File): Used to configure environment variables, startup parameters, health checks, and other settings for the application. These settings are consistent with the configuration options in the console.

Templates are available for these three files, and you can view specific template options in the product documentation. You can then deploy to SAE automatically by running the Maven command mvn clean package toolkit:deploy.

Deploying with IDE Plugin #

img

Next, let’s take a look at how to deploy directly from your IDE. This method leverages the capabilities of the Alibaba Cloud Toolkit IDE plugin, which can be installed on popular Java IDEs such as IntelliJ IDEA and Eclipse. In this example, we’ll use IntelliJ IDEA. You can search for and install the Cloud Toolkit plugin from the IDEA plugin marketplace. After restarting IDEA, you will see the Cloud Toolkit options. The configuration required for deployment is similar to the Maven plugin deployment. First, you need to configure your Alibaba Cloud account information, including your AK and SK. Then, select the option to deploy to SAE, where you can choose from various deployment methods: Maven packaging, uploading files, or using images. In the advanced options, you can configure environment variables, startup parameters, health checks, and other settings for the application.

Summary #

By now, you should have an understanding of the different deployment methods and basic usage of SAE. We recommend using SAE, as it allows you to enjoy the benefits of Serverless technology without changing your current development and operation practices.

Related Documentation:

Auto-deploy Applications with Maven Plugin Deploy Applications with IntelliJ IDEA Plugin One-Click Deploy Applications with Eclipse Plugin

To allow more developers to enjoy the benefits of Serverless computing, we have gathered over 10 Alibaba Cloud Serverless experts to create a beginner-friendly Serverless open course. This course allows you to learn and apply Serverless computing easily and embrace the new paradigm of cloud computing.

Click to watch the course for free: https://developer.aliyun.com/learning/roadmap/serverless