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

Getting Started

Overview

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

  • An environment is a combination of compute resources (such as CCE clusters), network resources (such as load balancers and EIPs), and middleware (such as DCS instances, RDS instances, and CSE engines). When deploying applications and components, you need to select an environment. After the environment is selected, the resources contained 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, deploying (upgrading), rolling back, and scaling application component instances, viewing logs, viewing events, setting access modes, and setting threshold alarms.

This document describes how to set up an environment, create an application, create and deploy a component, confirm the deployment, access the application, and perform application O&M.

Prerequisites

  1. Create a VPC. For details, see Creating a VPC.
  2. 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.

  3. Create a bucket for storing software packages. For details, see Creating a Bucket.
  4. For details about how to create a microservice engine with security authentication disabled, see Creating a Microservice Engine.
  5. 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.

    For details about how to upload the software package, see Uploading a File.

Creating an Organization

  1. Log in to ServiceStage.
  2. Choose Deployment Source Management > Organization Management.
  3. Click Create Organization. On the displayed page, set Organization Name.
  4. Click OK.

Creating an Environment

  1. Log in to ServiceStage.
  2. Choose Environment Management > Create Environment and set the environment information by referring to the following table.

    Parameter

    Description

    Environment

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

    * Enterprise Project

    Enterprise project.

    Enterprise projects let you manage cloud resources and users by project.

    It is available after you create an enterprise project.

    VPC

    Select the VPC prepared in Prerequisites.

    NOTE:

    The VPC cannot be modified after the environment is created.

    Environment Type

    Select Kubernetes.

  3. Click Create Now.
  4. In the Resource Settings area, choose Cloud Container Engine from Compute and click Manage Resource.
  5. In the dialog box that is displayed, select the created CCE cluster and click OK.
  6. In the Resource Settings area, choose Cloud Service Engine from Middleware and click Manage Resource.
  7. In the dialog box that is displayed, select the created CSE engine and click OK.

Creating an Application

  1. Log in to ServiceStage.
  2. Choose Application Management > Create Application.
  3. Enter an application name, for example, test-servicestage. Select an enterprise project.
  4. Click OK.

Creating and Deploying a Component

  1. Log in to ServiceStage.
  2. Choose Application Management. The application list is displayed.
  3. Select the application (for example, test-servicestage) created in Creating an Application and click Create Component in the Operation column.
  4. In the Basic Information area, set the following mandatory parameters. Retain the default values for other parameters.

    Parameter

    Description

    Component Name

    Enter a component name, for example, test-cse.

    Environment

    Select the environment created in Creating an Environment, for example, test-env.

  5. In the Component Package area, set the following mandatory parameters. Retain the default values for other parameters.

    Parameter

    Description

    Stack

    Select Java.

    Upload Method

    Click Software Package and select servicecomb-0.0.1-SNAPSHOT.jar uploaded in Preparing Software Packages.

  6. In the Build area, set the following mandatory parameters. Retain the default values for other parameters.

    Parameter

    Description

    Organization

    An organization is used to manage images generated during component build.

    Select the organization created in Creating an Organization.

    Environment

    Select Use current environment to use the CCE cluster in the deployment environment to which the component belongs to build an image.

    In the current environment, masters and nodes in the CCE cluster must have the same CPU architecture. Otherwise, the component build fails.

  7. Click Next.
  8. In the Resources area, retain the default settings.
  9. In the Access Mode area, retain the default settings.
  10. In the Local Time area, retain the default settings.
  11. In the Advanced Settings area, choose Advanced Settings > Microservice Engine.

    1. Click Bind Microservice Engine.
    2. Select the managed microservice engine in the current environment.
    3. Click OK.

  12. Click Create and Deploy to deploy the component.

Confirming the Deployment Result

  1. Log in to ServiceStage.
  2. Choose Cloud Service Engine > Microservice Catalog.
  3. Select the microservice engine where the component is deployed from the microservice engine drop-down list.
  4. Select springmvc from the All applications drop-down list.

    If the microservice servicecombspringmvc is displayed and the number of microservice instances is 2, the deployment is successful.

Accessing an Application

  1. Log in to ServiceStage.
  2. Choose Application Management. The application list is displayed.
  3. Click the application created in Creating an Application (for example, test-servicestage). The Overview page is displayed.
  4. On the Component List tab, click the component created in Creating and Deploying a Component (for example, 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.
  8. Click the access address in the Access Address column to access the application.

    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.
  2. Click Application Management.
  3. Click the application created in Creating an Application (for example, test-servicestage). The Overview page is displayed.
  4. On the Component List tab, click the component created in Creating and Deploying a Component (for example, test-cse). The Overview page is displayed, where you can perform O&M operations.