El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Deploying a Microservice Using a Software Package

Updated on 2024-12-16 GMT+08:00

Scenarios

ServiceStage allows you to quickly deploy microservices in containers (such as CCE) or VMs (such as ECS), and supports source code deployment, JAR/WAR package deployment, and Docker image package deployment. In addition, ServiceStage allows you to deploy, upgrade, roll back, start, stop, and delete applications developed in different programming languages, such as Java, PHP, Node.js, and Python.

In this practice, backend components developed in Java and frontend components developed in Node.js are used.

User Story

In this practice, you can deploy an application in containers and register microservice instances with the ServiceComb engine. The following components need to be created and deployed for the weathermap application:
  1. Frontend component: weathermapweb, which is developed in Node.js.
  2. Backend components: weather, fusionweather, forecast, and edge-service, which are developed based on Java.

The procedures for deploying a microservice are as follows:

  1. Creating and Deploying a Backend Application Component
  2. Setting the Access Mode of the edge-service Component
  3. Creating and Deploying a Frontend Component
  4. Confirming the Deployment Result
  5. Setting the Access Mode
  6. Accessing an Application

Creating and Deploying a Backend Application Component

You need to create and deploy four application components (weather, forecast, fusionweather, and edge-service), which correspond to the four software packages generated by the backend build jobs.

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

    Parameter

    Description

    Component Name

    Enter the name of the corresponding backend component (for example, weather).

    Component Version

    Click Generate. By default, the version number is generated based on 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.

    Application

    Select the application created in Creating an Application, for example, weathermap.

    Environment

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

    Namespace

    Select default to isolate component instances.

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

    Parameter

    Description

    Stack

    Select Java.

    Source Code/Software Package

    Select JAR package.

    Upload Method

    1. Select OBS.
    2. Click Select Software Package and select the uploaded software package of the corresponding component by referring to Table 1.

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

    Parameter

    Description

    Organization

    Select the organization created in Creating an Organization.

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

    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.

    Namespace

    Select default to isolate build data.

  7. Click Next.
  8. In the Resources area, set Instances for each component and retain the default values for other parameters.

    Component Name

    Instances

    weather

    2

    forecast

    1

    fusionweather

    1

    edge-service

    1

  9. Bind the ServiceComb engine.

    NOTE:
    • After a component is deployed, the microservice will be registered with the ServiceComb engine.
    • All components must be registered with the same ServiceComb engine.
    1. Choose Cloud Service Settings > Microservice Engine.
    2. Click Bind Microservice Engine.
    3. Select the managed ServiceComb engine in the current environment.
    4. Click OK.

  10. (Optional) Choose Container Settings > Environment Variable > Add Environment Variable. Then add environment variables for the weather, forecast, and fusionweather components by referring to the following table.

    Type

    Name

    Variable/Variable Reference

    Add manually

    MOCK_ENABLED

    Set the parameter value to false.

    • true: If no EIP is bound to the ECS node in the CCE cluster created in Preparing Resources or the node cannot access the public network, set this parameter to true. The weather data used by the application is simulated data.
    • false: If an EIP has been bound to the ECS node in the CCE cluster created in Preparing Resources and the node can access the public network, set this parameter to false or do not set this parameter. The weather data used by the application is real-time data.

  11. Click Create and Deploy.

Setting the Access Mode of the edge-service Component

  1. Click in the upper left corner to return to the Application Management page.
  2. Click the application created in Creating an Application (for example, weathermap). The Overview page is displayed.
  3. In the Component List area, locate the row that contains edge-service and click View Access Mode in the External Access Address column.
  4. 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.

    Protocol

    Select TCP.

    Container Port

    Enter 3010.

    Access Port

    Select Automatically generated.

    Figure 1 Setting the access mode of the edge-service component

  5. Click OK.

Creating and Deploying a Frontend Component

  1. Click in the upper left corner to return to the Application Management page.
  2. Click Create Component in the Operation column of the application created in Creating an Application (for example, weathermap).
  3. In the Basic Information area, set the following mandatory parameters. Retain the default values for other parameters.

    Parameter

    Description

    Component Name

    Enter the frontend component name weathermapweb.

    Component Version

    Click Generate. By default, the version number is generated based on 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.

    Application

    Select the application created in Creating an Application, for example, weathermap.

    Environment

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

    Namespace

    Select default to isolate component instances.

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

    Parameter

    Description

    Stack

    Select Node.js.

    Source Code/Software Package

    Select ZIP package.

    Upload Method

    1. Select OBS.
    2. Click Select Software Package and select the uploaded software package of component weathermapweb by referring to Table 1.
    Figure 2 Setting frontend software package parameters

  5. In the Build Job 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.

    Namespace

    Select default to isolate build data.

  6. Click Next to add an environment variable.

    1. Choose Container Settings > Environment Variable.
    2. Click Add Environment Variable to configure environment variables.

      Type

      Name

      Variable/Variable Reference

      Add manually

      SERVICE_ADDR

      Access address generated in Setting the Access Mode of the edge-service Component.

  7. Click Create and Deploy.

Confirming the Deployment Result

  1. Click in the upper left corner to return to the Application Management page.
  2. Choose Cloud Service Engine > Microservice Catalog.
  3. Select the ServiceComb engine where the microservice application is deployed from the Microservice Engine drop-down list.
  4. Select the application (for example, weathermap) created in Creating an Application from Microservice List.

    If the number of instances of each microservice is the same as listed in the following table, the deployment is successful.

    Component Name

    Instances

    weather

    2

    forecast

    1

    fusionweather

    1

    edge-service

    1

Setting the Access Mode

  1. Choose Application Management.
  2. Click the application created in Creating an Application (for example, weathermap). The Overview page is displayed.
  3. In the Component List area, locate the row that contains weathermapweb and click View Access Mode in the External Access Address column.
  4. 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.

    Protocol

    Select TCP.

    Container Port

    Enter 3000.

    Access Port

    Select Automatically generated.

    Figure 3 Setting the access mode

  5. Click OK.

    Figure 4 Access address

Accessing an Application

  1. Click in the upper left corner to return to the Application Management page.
  2. Click the application created in Creating an Application (for example, weathermap). The Overview page is displayed.
  3. In the Component List area, locate the row that contains weathermapweb and click View Access Mode in the External Access Address column.

    If the following page is displayed, the weather forecast microservice application is successfully deployed.

    Figure 5 Application deployed successfully
    NOTE:
    • The data is real-time data.
    • When you access the application for the first time, it takes some time for the weather system to be ready. If the preceding page is not displayed, refresh the page.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback