Deploy a Java job template to SAE

Updated at:

Use Apsara DevOps Flow for continuous integration and deployment of job templates. This topic shows how to deploy a Java job template to Serverless App Engine (SAE) as a JAR or WAR package.

Prerequisites

Background

If this is your first time using Apsara DevOps, review the Apsara DevOps deployment process and the deployment methods that SAE supports.

For more information, see Overview of deploying SAE applications and job templates with Apsara DevOps 2020.

Step 1: Create a job template in SAE

If this is your first time using SAE to host jobs, you must first create a job template in the SAE console. SAE supports package deployment and image deployment. The deployment method for the job template must be consistent with the pipeline configuration.

Step 2: Create an organization in Apsara DevOps

The first time you use Apsara DevOps Flow, you must create an organization. If you already have an organization, you can skip this step.

  1. Log on to Apsara DevOps Flow.

  2. Enter an organization name, select the size of your development team, and then click Create Now.

Step 3: Create a pipeline in Apsara DevOps

  1. Log on to Apsara DevOps Flow.

  2. On the Flow page, click New Pipeline in the upper-right corner.

  3. In the Select a Pipeline Template dialog box, select Blank Template and click Create.

  4. On the pipeline editing page, click Add Pipeline Source. In the Add Pipeline Source panel, select Code Source from the left navigation pane. Configure the code source information on the right, and then click Add.

    Parameter

    Description

    Select a code source

    Select the source of your application code.

    Note

    Parameters vary by code source. Follow the instructions on the user interface (UI).

    Code Repository

    Select the code repository.

    Default Branch

    Select the code branch.

Step 4: Deploy the job template to SAE

  1. In the Stage 1 area, click Empty Job. In the Edit panel, enter a Job Name and configure the Build Cluster, Specify Build Node, Build Environment, and Download Pipeline Source settings.

  2. Click Add Step, select Build > Java Build from the drop-down list, and configure the Java settings.

    Parameter

    Description

    Java Version

    Select the required version from the drop-down list.

    Maven Version

    Select the required version from the drop-down list. Ignore this setting if you use Gradle for your build.

    Build Command

    Enter a build command. Maven 3.5.2 and Gradle 4.1 are supported.

  3. Click Add Step, select Upload > Upload Build Artifacts (for EDAS/SAE) from the drop-down list, and then click the close icon in the upper-right corner of the Edit panel.

    Parameter

    Description

    Upload Method

    Select an upload method as needed. By default, Archive to Apsara DevOps Public Storage (for subsequent jobs to pull and deploy) is selected.

    Artifact Name

    Enter a name for the artifact.

    Upload File

    Specify the path to the JAR or WAR package.

  4. In the New Stage area, click New Job and select Update Serverless (SAE) Job Template.

  5. In the Edit panel, configure the job settings and click Save and Run.

    Parameter

    Description

    Job Name

    Enter a name for the job, up to 20 characters long.

    Build Cluster

    You can select a different build cluster for the job.

    Download Pipeline Source

    When enabled, this option downloads the source files from the configured pipeline source to the working directory.

    Service Connection

    Select a service connection to authorize Apsara DevOps to deploy job templates to SAE.

    If you do not have a service connection, click Add Service Connection and follow the prompts to complete Alibaba Cloud RAM authorization before you continue.

    Region

    Select the region of the job template created in Step 1.

    Namespace

    Select the namespace of the job template created in Step 1.

    SAE Job Template

    Select the job template created in Step 1.

    Build Artifact

    Select the tag name that you created in Step 3.

    Use Alibaba Cloud Container Registry Enterprise Edition

    Required only for image-based deployments.

    Job Plugin

    Optional. Configure job plugins to send pipeline notifications.

    • DingTalk Robot Notification Plugin: For more information, see Send group messages by using a DingTalk chatbot.

    • Email Notification: Enter email addresses. Separate multiple addresses with semicolons (;).

    • Webhook Notification Plugin: For more information, see Use the Webhook plugin to send notifications.

    • WeCom Group Notification: For more information, see Send group messages by using a WeCom bot.

    • Lark Group Notification: For more information, see Send group messages by using a Lark bot.

  6. In the Run Configurations dialog box, confirm the settings and click Run.

Verify the results

After the deployment starts, the Recent Runs tab opens, showing the pipeline execution status. If a run fails, check the logs to troubleshoot the issue, then edit, save, and run the pipeline again.

More information

Once deployed to SAE, you can perform the following operations on your application.

Actions

References

Manage the application lifecycle (for example, update, scale, start, stop, or delete).

Manage the lifecycle of an application

Improve application performance with features such as auto scaling, Server Load Balancer (SLB) binding, and batch start/stop.

Monitor the application's runtime status using log management, application monitoring, and event and change record viewers.