tencent cloud

Feedback

Multi-Function Application Deployment

Last updated: 2021-11-08 16:54:26

    You can quickly build and deploy a multi-function application based on the Tencent Cloud multi-scf component, which greatly reduces the development costs of complex applications.

    Prerequisites

    Development and deployment steps

    For details of sample projects, please see Case List.

    1. Develop your application project locally. This document takes a project with two functions as an example. The application directory structure is as follows:

        ./multi-scf-demo
      ├── index
      │   ├── index.js # Main function 1
      │   ├── package.json
      │   └── scf_bootstrap # Bootstrap file for HTTP-triggered functions, which can be ignored for event-triggered functions
      ├── user
      │   ├── index.js # Main function 2
      │   ├── package.json
      │   └── scf_bootstrap # Bootstrap file for HTTP-triggered functions, which can be ignored for event-triggered functions
      └── serverless.yml # YML configuration file
      
    2. In the root directory, create a serverless.yml file and configure relevant parameters for your project by referring to the following sample YML. For more configuration content, please see Full Configuration.

      app: multi-scf # Application name
      component: multi-scf # Component type, which is `multi-scf` here
      name: web_demo # Customizable instance name
      inputs:
      src:
      # The code directory must be specified here, and SCF will automatically split the function code according to the function configuration
      src: ./
      exclude:
        - .env
      region: ap-guangzhou # Region
      runtime: Nodejs12.16 # Function language version
      memorySize: 512
      timeout: 3
      type: web  # Function type, which is HTTP-triggered function here
      functions:
      index:
        src: ./index # Entry function of function 1
        handler: scf_bootstrap # Bootstrap file
      user:
        src: ./user # Entry function of function 2
        handler: scf_bootstrap # Bootstrap file
      triggers: # Trigger configuration
      - type: apigw
        parameters:
          name: serverless
          protocols:
            - https
            - http
          apis:
            - path: /
              method: ANY
              # The API function configuration has a higher priority than the outer function
              function: index
            - path: /user
              method: ANY
              # The API function configuration has a higher priority than the outer function
              function: user
      
    1. After completing the configuration, run sls deploy in the root directory to test whether the project is successfully deployed.

    Application launch in console

    Submit the application through a ticket. Note that your project must include the following:

    Parameter Description
    Basic configuration parameter list Basic configuration parameter list
    Advanced configuration parameter list Optional
    Application name, overview, documentation link, and tag For block display in the console
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support