Publishing a Function Application


The application development supports event-driven Serverless function computing services that flexibly and reliably run function codes, and provide computing resources and log querying, among others, allowing you to focus on the business logic of the functional application without the need to spend time and resources on sever configuration, maintenance, updates, expansions, and capacity planning.


This section describes how project owners can create function-type applications, and the end user can call the function service through HTTP after the application developer uploads and publishes the function code to the container.

Prerequisites

  • Before creating a function-type application, you need to create a Serveless-type product. For more information, see Managing Products.

  • Prepare the application code in .zip format or upload the application code to the Git repository.

Creating a Function Application

The application development/deployment project owner can create new function applications by adding functions after creating Serverless products, or by following the steps below.

  1. Log in to the EnOS Management Console and select Enterprise Container Platform in the left navigation menu.

  2. Select your organization from the Organization menu.

  3. Select the created project from the Project menu.

  4. Select Application from the left navigation, click New Application, and select Function from the drop-down.

  5. Select the created Severless-type product and the language to use for the application development (Java, Python, or R).

  6. The available templates corresponding to the chosen language above will be displayed in card layout. Select a template and click Next Step. If you wish to view the details of a template, click More at the top right of each card.

    ../../_images/create_function_app_1.png


  7. Enter the basic information for the application such as its name, function entry, port number (applicable only for HTTP projects), and the description, and click Complete.

    ../../_images/create_function_app_2.png


After the function application is created, the application developer can submit the function application code.

Submitting the Function Application Code

The application developer can, according to business requirements, choose to submit the function application code by editing the code online, uploading the code from a local zip file, or synchronizing the code from the Git repository.

Editing the Code Online

  1. Click the name of the function application at the Application page to enter its details page.

  2. Click the Function Code tab, and select Online Edit from the Submission Method drop-down.

  3. Click + and select either New File or New Folder.

  4. Enter a new for the file or folder in the pop-up and click OK.

  5. Enter and edit the function application code in the editing area and click the Submit code icon at the top right to submit the code after you are done.

    ../../_images/edit_app_code.png

Uploading the Code from a Local Zip File

  1. Click the name of the function application at the Application page to enter its details page.

  2. Click the Function Code tab, and select Upload a Local Zip File from the Submission Method drop-down.

  3. Click Select File to browse for and upload the Zip file.

  4. Click Upload to submit the function application code.

    ../../_images/upload_app_code.png

Sychronizing the Code from the Git Repositry

  1. Click the name of the function application at the Application page to enter its details page.

  2. Click the Function Code tab, and select Git Synchronize from the Submission Method drop-down.

  3. If the Git repository address has not been configured, click Add and follow the steps in the pop-up. After entering the Git Address and Function Path To Be Tracked, click OK.

  4. After submitting the code by synchronizing with the Git repository, you can check the records of the code submissions under Submission Records.

    ../../_images/clone_app_code.png


After submitting the function application code, you can build and publish the application.

Building and Publishing the Function Application

  1. Click the Build/Publish tab, click New Build, check the checkbox to Build ppe and production image, and click confirm to start building the application.

    ../../_images/build_function_app.png


  2. After the application is built, click Publish on the Publish Information section to publish the production image of the successful application build to the specified cluster.

    ../../_images/publish_function_app.png


  3. In the New Publish window, configure the details for the publication.

    • Select the Environment and Cluster.

      ../../_images/publish_function_app_config_1.png


    • Allocate the running resources for the application, including the CPU and memory limits.

      ../../_images/publish_function_app_config_2.png


    • Select the automatic scaling configuration type and complete the corresponding configuration.

      ../../_images/publish_function_app_config_3.png


  4. Click OK to publish the function application, and verify whether the application is successfully published. After the function application is published successfully, you can view the invoke address of the function service in the publish log.

    ../../_images/published_function_app.png

Testing the Function

After the function application is published and successfully launched, you can test the function service.

  1. Click the Function Test tab and select the Environment and Cluster.

  2. Select the calling method at Request URL and the calling address of the function service will be automatically filled.

  3. Enter the parameters for calling the function service in the Request body textbox.

  4. Click Send Request to call the test function and review the test results.

    ../../_images/test_function_app.png