Updated on 2023-06-25 GMT+08:00

Getting Started

Overview

This section describes the environments, applications, and components of ServiceStage.

An environment consists of basic resources (such as CCE clusters and ECS) and optional resources (such as ELB and DCS) in the same VPC. When deploying applications or components, you need to select an environment. After you select an environment, the resources in the environment are automatically loaded.

An application is a service system with functions and consists of one or more components. For example, a typical Enterprise Resource Planning (ERP) system is an application, which generally consists of modules such as accounting, finance, production control, logistics, procurement, distribution, and inventory. These modules are closely related to each other, and each module is a component.

A component is an implementation of a service feature of an application, for example, a module of the preceding ERP system. In microservice application scenarios, each component has an independent software package and can be deployed and run independently. The deployed component is called a component instance. A component can have multiple component instances to form a cluster to ensure high reliability of applications and components. O&M operations are supported, such as starting, stopping, upgrading, rolling back, and scaling application component instances, viewing logs, viewing events, setting access modes, and setting threshold alarms.

The following describes how to set up an environment and create microservice applications and components in ServiceStage.

Prerequisites

  • Create a VPC. For details, see Creating a VPC.
  • Create a CCE cluster. For details, see Creating a CCE Cluster.

    The cluster must contain at least one ECS node with 8 vCPUs and 16 GB memory or two ECS nodes with 4 vCPUs and 8 GB memory and be bound to an EIP.

  • Create a bucket for storing JAR packages. For details, see
  • Create an exclusive microservice engine. For details, see Creating an Exclusive Microservice Engine.
  • This example provides a microservice demo, which is compiled, built, and packaged locally. You must install the Java JDK and Maven on the local host and the local host can access the Maven central library.

    After the installation, open the Command Prompt, and run the mvn -v command to query the versions of Java JDK and Maven. If their versions are displayed, the installation is successful. In this example, Maven 3.6.3 and JDK 1.8.0 are used.

    Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
    ......
    Java version: 1.8.0_201,……

Preparing Software Packages

  1. Download the microservice demo source code package to the local host and decompress it.
  2. In the root directory of the project (for example, D:\servicecomb-samples-master\servicecomb-samples-master\ServiceComb-SpringMVC), run the cmd and mvn clean package commands to compile and package the Java project.

    D:\servicecomb-samples-master\servicecomb-samples-master\ServiceComb-SpringMVC>mvn clean package
    ......
    [INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ servicecomb ---
    [INFO] Building jar: D:\servicecomb-samples-master\servicecomb-samples-master\ServiceComb-SpringMVC\target\servicecomb-0.0.1-SNAPSHOT.jar
    [INFO]
    [INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) @ servicecomb ---
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    ......

    After compilation, the servicecomb-0.0.1-SNAPSHOT.jar software package is generated in the target subdirectory in the root directory of the project (for example, D:\servicecomb-samples-master\servicecomb-samples-master\ServiceComb-SpringMVC\target), and the message "BUILD SUCCESS" is displayed.

  3. Upload the generated servicecomb-0.0.1-SNAPSHOT.jar software package to the created OBS bucket.

    Upload an object. For details, see Uploading a File.

Creating an Organization

  1. Log in to ServiceStage and choose Software Center > Organization.
  2. Click Create Organization. On the displayed page, set Organization Name.
  3. Click OK.

Creating an Environment

  1. Log in to ServiceStage, choose Environment Management, and click Create Environment.
  2. Configure the environment parameters by referring to the following table.

    Parameter

    Description

    Environment

    Enter an environment name, for example, test-env.

    VPC

    Select the VPC prepared in Prerequisites.

    NOTE:

    After a VPC is selected, basic resources and optional resources in the VPC are loaded. Resources that are not in the VPC cannot be selected.

    Basic Resources

    Select the basic resources in the VPC. In this example, the CCE created in Prerequisites is used.

    Optional Resources

    Select optional resources in the VPC. In this example, the exclusive microservice engine created in Prerequisites is used.

  3. Click Create Now.

Creating an Application

  1. Log in to ServiceStage, choose Application Management > Application List, and click Create Application.
  2. Set basic application information.

    1. Name: Enter an application name, for example, test-servicestage.
    2. Description: (Optional) Enter an application description.

  3. Click OK.

Creating a Component

  1. Log in to ServiceStage and choose Application Management > Application List.
  2. Select application test-servicestage and click Create Component in the Operation column.
  3. Select Template for Configuration Method and select the ServiceComb template. Click Next.
  4. Set basic component information.

    1. Name: Enter a component name, for example, test-cse.
    2. Upload Method: Click Software Package and select the servicecomb-0.0.1-SNAPSHOT.jar software package that has been uploaded to the OBS bucket in Preparing Software Packages.

  5. Set Build parameters.

    1. Select the organization created in Creating an Organization.
    2. Select the CCE cluster used in Creating an Environment.
    3. Retain the default values for other parameters.

  6. Click Create Now to create a static component.

Deploying a Component

  1. Log in to ServiceStage and choose Application Management > Application List.
  2. Click the created application test-servicestage. The Overview page is displayed.
  3. On the Component List page, select the created component test-cse and click Deploy in the Operation column.
  4. Configure basic information according to the following table. Parameters marked with an asterisk (*) are mandatory.

    Parameter

    Description

    *Environment

    Select the created environment test-env.

    *Version

    The default version is 1.0.0.

    *Deployment System

    Select Cloud Container Engine.

    *Basic Resources

    Use CCE resources (automatically loaded) in the test-env environment.

    *Instances

    Set this parameter to 1.

    Resource Quota

    Retain the default value.

  5. Click Next to configure the component.

    1. Select Cloud Service Engine. The exclusive microservice engine in the test-env environment is used by default.
      • After an application component is deployed, the microservice is registered with the selected microservice engine.
      • All application components must be registered with the same microservice engine so that they can discover each other.
    2. Retain the default values for other parameters.

  6. Click Next to confirm the specifications.
  7. Click Deploy to deploy the component.

Confirming the Deployment Result

  1. Log in to ServiceStage and choose Infrastructure > Cloud Service Engines.
  2. Select the exclusive microservice engine used in Deploying a Component and click Console to access the microservice console.
  3. Choose Service Catalog > Microservice List and select springmvc from the All applications drop-down list.

    If the microservice servicecombspringmvc is displayed and the number of microservice instances is the same as that set in Deploying a Component, the deployment is successful.

Accessing an Application

  1. Log in to ServiceStage and choose Application Management > Application List.
  2. Click the created application test-servicestage. The Overview page is displayed.
  3. On the Environment View tab, select test-env for Environment to view the deployed application components.
  4. Click the component test-cse. The Overview page is displayed.
  5. Click Access Mode.
  6. Click Add Service in the TCP/UDP Route Configuration area and set parameters by referring to the following table.

    Parameter

    Description

    Service Name

    Retain the default value.

    Access Mode

    Select Public network access.

    Access Type

    Select Elastic IP address.

    Service Affinity

    Retain the default value.

    Port Mapping

    1. Protocol: Select TCP.
    2. Container Port: Enter 8080.
    3. Access Port: Select Automatically generated.

  7. Click OK.

    Figure 1 Access address

  8. Click the access address in the Access Address column to access the application, as shown in Figure 1.

    The following information is displayed:
    {"message":"Not Found"}

  9. Enter http://Access address generated in 7/rest/helloworld?name=ServiceStage in the address box of the browser to access the application again.

    The following information is displayed:

    "ServiceStage"

Application O&M

  1. Log in to ServiceStage, choose Application Management > Application List, and click application test-servicestage. The Overview page is displayed.
  2. On the Component List page, click component test-cse. The Overview page is displayed. You can view the component version in the Environment area.
  3. Click View Details of an environment. On the component details page that is displayed, you can perform O&M operations, such as starting, stopping, upgrading, rolling back, and scaling application component instances, viewing logs, viewing events, setting the access mode, and setting threshold alarms.