Updated on 2025-08-05 GMT+08:00

Configuring VM Settings

  • Adding an Environment Variable of a Component

    Environment variables are configured in the component running environment and can be modified during Upgrading a Component in Rolling Release Mode after component deployment, providing great flexibility. Environment variables set for a component are local environment variables and take effect only for this component.

    If you add an application environment variable to the application where the component is located and the name of the application environment variable is the same as that of the component environment variable in the application, the application environment variable is shielded by the component environment variable and does not take effect for the component. For details about how to add application environment variables, see Managing Environment Variables of an Application.

    Priority of environment variables of the component, application, and environment levels: component > application > environment.

    For details about environment variables of an environment, see Managing Environment Variables of an Environment.

  • Adding a Configuration Item

    If the package type is package during Creating a Component Based on a VM, you can set the component configuration items by referring to this section.

  • Configuring Directory Settings

    Manage the startup users, running directories, and log directories of VM-deployed components. You can set the component startup user, select the default directory rule, or customize directory rules as required.

  • Configuring the Lifecycle of a Component

    If the component package type is JAR or WAR, you can configure specific commands as required to execute tasks after the component is started and before the component is stopped.

Adding an Environment Variable of a Component

  1. Choose VM Settings > Environment Variable.
  2. Click Add Environment Variable.
  3. Enter a key and value.

    The key must be unique in a component. Enter 1 to 64 characters. Do not start with a digit or period (.). Only use letters, digits, underscores (_), hyphens (-), and periods (.).

Adding a Configuration Item

  1. Choose VM Settings > Environment Variable.
  2. Click Adding a Configuration Item.
  3. Enter a key and value.

    The key must be unique in a component. Enter 1 to 64 characters. Do not start with a digit or period (.). Only use letters, digits, underscores (_), hyphens (-), and periods (.).

Configuring Directory Settings

  1. Choose VM Settings > Directory Settings.
  2. Set parameters based on the Directory Configuration Mode.

    • Use default system directory
      The component deployment and log directories are the default system paths. The default component startup user and the user who can access the component deployment and log directories are www, and the default user group is www. For details about the default system directory configuration, see Table 1.
      Table 1 Default system directory configuration

      Parameter

      Description

      Deployment Directory

      • Path: parent directory of the component deployment path. The default value is /opt/application, and the absolute deployment path of the component is /opt/application/${Component instance name excluding the five random characters generated by the system}}/${Component version}/${Component instance ID}.

        For example, if the component instance name is comp-ecs-env-cce_8DGO1, the component version number is 2025.0520.19070, and the component instance ID is 41a71313-46a4-411e-9eb5-388b16c9de3a, the absolute deployment path is /opt/application/comp-ecs-env-cce/2025.0520.19070/41a71313-46a4-411e-9eb5-388b16c9de3a. For details about the component instance name, see Context.

      • User:User Group: owner and group of the files in the component deployment directory. The default values are www and www, indicating that the file owner is the www user and the group to which the file belongs is the www group.
      • Permissions: access permissions on the files in the component deployment directory. The default value is 751, indicating that the file owner (www) has the read, write, and execute permissions (rwx), the group to which the file belongs (www) has the read and execute permissions (rx), and other users have the execute permission (x).

      Log Directory

      • Path: parent directory for storing component running logs. The default value is /var/log/application, and the absolute path is /var/log/application/${Component instance name excluding the five random characters generated by the system}/${Component instance ID}.

        For example, if the component instance name is comp-ecs-env-cce_8DGO1, and the component instance ID is 41a71313-46a4-411e-9eb5-388b16c9de3a, the absolute storage path is /opt/application/comp-ecs-env-cce/41a71313-46a4-411e-9eb5-388b16c9de3a. For details about the component instance name, see Context.

      • User:User Group: owner and group of the files in the component log directory. The default values are www and www, indicating that the file owner is the www user and the group to which the file belongs is the www group.
      • Permissions: access permissions on the files in the component log directory. The default value is 751, indicating that the file owner (www) has the read, write, and execute permissions (rwx), the group to which the file belongs (www) has the read and execute permissions (rx), and other users have the execute permission (x).

      Running User

      Component startup user. The default value is www.

    • Use custom system directory

      The component deployment and log directories are the custom system paths. For details about how to customize a system directory, see Customizing a System Directory.

      • Click Sync to synchronize the latest directory configuration after Customizing a System Directory to the component.
      • Click Roll Back to roll back the directory configuration to the source configuration.

Configuring the Lifecycle of a Component

  1. Choose VM Settings > Lifecycle.
  2. Click the Post-start Processing or Pre-stop Processing tab and set the parameters by referring to Table 2.

    Table 2 Lifecycle parameters

    Processing Mode

    Command

    CLI mode

    Command to be executed in the component instance.

    The command format is Command Args[1] Args[2]..... Command is a system command (Bash mode) or a user-defined executable program (Binary mode). If no path is specified, the system searches for an executable program in the default path.

    To run multiple commands, write them in different lines or into a script.

    Commands that are executed in the background or asynchronously are not supported.

    HTTP request mode

    HTTP call request.

    • Protocol: request protocol. HTTP and HTTPS are supported.
    • Host Address: (optional) IP address of the request. The default value is the IP address of the node where the application is located. Example: 127.0.0.1.
    • Port: (mandatory) request port. Example: 80.
    • Path: (optional) URL of a request. Example: /nginx.