Help Center/ ServiceStage/ User Guide/ Component Management/ Creating and Deploying a Component/ Creating and Deploying a Component Based on a VM
Updated on 2024-11-15 GMT+08:00

Creating and Deploying a Component Based on a VM

This section describes how to create and deploy a component based on a VM in ServiceStage.

Prerequisites

  1. An application has been created because components can only be added to applications. For details, see Creating an Application.
  2. An environment has been created and resources have been managed because components need to be deployed in an environment. For details, see Environment Management.
  3. You have uploaded the software package to the SWR software repository or OBS bucket.

    If the software package fails to be uploaded, see What If a Software Package Fails to Be Uploaded?

Creating and Deploying a Component Based on a VM

  1. Log in to ServiceStage.
  2. Use any of the following methods to go to the Create Component page:

    • Choose Component Management > Create Component.
    • On the Application Management page, select the application for which you want to create a component, and click Create Component in the Operation column.
    • On the Application Management page, click the application for which you want to create a component. On the displayed Overview page, click Create Component.

  3. In the Basic Information area, configure the component by referring to the following table. Parameters marked with an asterisk (*) are mandatory.

    Parameter

    Description

    *Component Name

    Name of a component, which cannot be changed after the component is created and deployed.

    Enter 2 to 64 characters. Start with a letter and end with a letter or digit. Only use letters, digits, underscores (_), and hyphens (-).

    • Components with the same name in different applications can be deployed in the same environment.
    • Components with the same name in the same application can be deployed in different environments.

    *Component Version

    Component version number, which can be automatically generated or customized.

    • Automatically-generated: Click Generate. By default, the version number is the time when you click Generate. The format is yyyy.mmdd.hhmms, where s is the ones place of the second in the timestamp. For example, if the timestamp is 2022.0803.104321, the version number is 2022.0803.10431.
    • Customized: Enter a value in the format of 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.

    *Environment

    Select VM or VM + Kubernetes.

    For details, see Environment Overview.

    NOTE:

    If CCE clusters and VMs are managed in an earlier version, the environment type is VM + Kubernetes after the upgrade to the current version.

    *Deployment Mode

    Select VM.

    This parameter is mandatory when Environment is set to VM + Kubernetes. For details, see Deploying a Component.

    *Application

    Application to which the component belongs.

    Description

    Component description.

    1. Click and enter up to 128 characters.
    2. Click to save the component description.
    Figure 1 Setting the basic component information

  4. In the Component Package area, configure the component package by referring to the following table. Parameters marked with an asterisk (*) are mandatory.

    Parameter

    Description

    *Stack

    1. Select a component technology stack type based on the component deployment mode. For details, see Table 1.
    2. Select a technology stack version from the Name drop-down list.
    3. Set JVM to configure the memory parameter size during Java code running. This parameter is available when a Java or Tomcat technology stack is selected.

      Click Stack Settings and set JVM, for example, -Xms256m -Xmx1024m. Multiple parameters are separated by spaces.

    4. Set Tomcat to configure the parameters such as Tomcat request path and port number. This parameter is available when a Tomcat technology stack is selected.
      1. Click Stack Settings and select Tomcat. The Tomcat dialog box is displayed.
      2. Click Use Sample Code and edit the template file based on service requirements.
        NOTE:

        In Tomcat configuration, the default server.xml configuration is used. The context path is /, and no application path is specified.

        If you need to customize an application path, customize the Tomcat context path by referring to How Do I Customize a Tomcat Context Path?

      3. Click OK.

    *Source Code/Software Package

    Select a software package (JAR, WAR, or compressed package).

    The software package type supported by the component source is determined by the selected technology stack type. For details, see Table 1.

    *Upload Method

    If the component source is software package, select an uploaded software package. For details about the upload method, see Component Source.

  5. Click Next.
  6. In the Resources area, set the resources required by the component.

    • If ECS is selected for Resource Type, select the ECS that has been managed in the component deployment environment.
    • If AS is selected for Resource Type, select the AS group to be used from Resources and then select the ECS in the AS group.

    The selected ECS must have the VM agent installed and be running properly.

  7. In the Access Mode area, enable Public Network Access.

    After public network access is enabled for a component, you can use a public network domain name to access the component through an ELB bound with an EIP to use services provided by the component.
    • After a component with public network access enabled is created and deployed, you can change the configured component access domain name by referring to Changing the Component Access Domain Name.
    • By default, public network access is disabled for a component. After a component is created and deployed, you can also configure the component access mode. For details, see Configuring the Component Access Mode.
    Click to enable public access and set the following parameters:
    1. Set Public Network Load Balancer.
      • Select a load balancer that has been bound to an EIP in the selected environment.
      • If no load balancer exists, click Add One. On the Edit Environment page that is displayed, click Add Optional Resource to add created load balancers to the environment.
      • To create ELB resources:
        • An EIP has been bound to the load balancer and must be in the same VPC and subnet as the compute resources managed in the current component deployment environment.
        • Components must be bound with different load balancers in different deployment environments to avoid route errors.
    2. Set Client Protocol.
      • HTTP has security risks. You are advised to select HTTPS.
      • If HTTPS is selected, click Use existing to select an existing certificate.

        If no certificate exists, click Create new to create a server certificate. For details, see Adding a Certificate.

    3. Set Domain Name.
      • If Automatically generated is selected, the automatically generated domain name is valid only for seven days.
      • If Bound is selected, enter a domain name.

  8. Set Advanced Settings.

    For details, see Managing Advanced Settings of a VM-Deployed Component.

  9. Click Create and Deploy.

    On the Deployment Records page, view the deployment logs and wait until the component deployment is complete.

    Figure 2 Viewing component deployment logs