Updated on 2024-07-01 GMT+08:00

Creating a Component

A maximum of 50 application components can be created in an environment.

Prerequisites

  1. You have created an environment. For details, see Creating an Environment.
  2. You have created an application. For details, see Creating an Application.

Procedure

  1. Log in to CAE.
  2. Choose Components.
  3. Select the created application and environment from the drop-down lists in the upper part of the page, and click Create Component.
  4. Configure the component by referring to Table 1.

    Table 1 Basic component information

    Parameter

    Item

    Description

    Component

    -

    Component name.

    Version

    -

    Component version.

    The format is A.B.C or A.B.C.D. A. B, C, and D are natural numbers, for example, 1.0.0 or 1.0.0.0.

    Specifications

    -

    Select the instance specifications, for example, 0.5 Core, 1 GiB; 1 Core, 1 GiB; 1 Core, 2 GiB; 2 Core, 4 GiB.

    Instances

    -

    Value range: 1 to 99. Default value: 2.

    Code Source

    Source code repository

    1. Select a code source. GitHub, GitCode, GitLab, and Bitbucket code can be identified.
    2. Complete the code information.
      • Authorization: Select the corresponding source code authorization from the drop-down list. If you use this function for the first time, click Create Authorization and set Authorization and Mode, and click OK. Click Authorization List to view the created authorization. Select the check box on the left to Re-authorize or Delete the authorized source code.
      • Username/Organization: Select a user or organization to manage code in the current project.
      • Repository: Select a repository to manage code of each module in the current project.
      • Branch: Select a branch to manage code.
    3. Language/Runtime System: Select a language of the source code from the drop-down list. For details, see Component Description.
    4. Custom Build: Select Default or Custom.
      NOTE:

      The authorization mode varies depending on the code source.

      • Default command or script: preferentially executes build.sh in the root directory. If build.sh does not exist, the code will be built using the common method of the selected language. Example: mvn clean package for Java.
      • Custom command: Commands are customized using the selected language. Alternatively, the default command or script is used after build.sh is modified.
    5. Dockerfile: Set this parameter if the component source is Source code repository. You can select Custom or Default.
      NOTE:

      You can select Default to change the name of the Maven artifact file specified in the default Dockerfile only when Language/Runtime System is set to Java.

    6. Dockerfile Address: Set this parameter if Dockerfile is set to Custom.
      • Dockerfile Address is the directory where the Dockerfile is located relative to the root directory (./) of the project. The Dockerfile is used to build an image.
      • The Docker program reads the Dockerfile file to generate a custom image.
      • The Dockerfile address contains 1 to 255 characters, including letters, digits, periods (.), hyphens (-), underscores (_), and slashes (/).
      • If the file name is Dockerfile, you can only enter a directory address and this address must end with a slash (/).
    7. Artifact File: Set this parameter if Dockerfile is set to Default.

      Select and run the specified JAR package from multiple JAR packages generated during Maven build. The JAR package ends with .jar. Fuzzy match is supported. Examples: demo-1.0.jar and demo*.jar.

    Image

    1. Upload the image package by Upload Through Client or Upload Through Page.
    2. On the My Images, Open Source Images, or Shared Images page, select an image package for deployment. You can search for an image by name.
      • My Images: image packages uploaded by users.
      • Open Source Images: images provided by SWR.
      • Shared Images: image packages shared by different accounts.
    3. (Optional) You can also click the link next to Code Source to go to the SWR console and perform more image management operations.
      NOTE:

      When you select Upload Through Page, only one image package can be added at a time. The file size cannot exceed 2 GB (after decompression). The image package can be in .tar or .tar.gz format. Only the image package created by the container engine client of version 1.11.2 or later can be uploaded. For details, see Creating an Image Package. To upload a file larger than 2 GB, select Upload Through Client.

    Software package

    1. Select CodeArts Release Repo or OBS where the software packages are located.
      • If you select CodeArts Release Repo, upload the software package to the software release repository in advance. For details, see Uploading a Software Package.
      • If you select OBS, upload the software package to the OBS bucket in advance. For details, see Uploading an Object.
    2. Language/Runtime System: Select a language of the software package from the drop-down list. For details, see Component Description.
    3. Build Type: Select System default or Custom Dockerfile.
      • System default: Use the default Dockerfile based on the selected language or runtime system.
      • Custom Dockerfile: Customize the Dockerfile based on the selected language.

  5. Create a component.

    • Click Configure Component. For details, see Component Configurations.
    • Click Create and Deploy Component. In the displayed dialog box, click Deploy Now.
    • After the component is created or deployed, you can view the environment ID, application ID, component ID, component name, code source, status, number of instances, and creation time on the Components page.
      Figure 1 Component list
      • If a component is in the Not deployed state, click Configure in the Status column to configure and deploy it.
      • If a component is in the Running state, click in the Quick Access column to reconfigure it and make the configurations take effect.