Preparing the Environment
You need to prepare the local development and commissioning environment and cloud environment.
Preparing a Local Development and Commissioning Environment
Set up a simple test environment by referring to https://servicecomb.apache.org/docs/getting-started/.
Preparing the Cloud Environment
Before deploying microservice applications on the cloud, you need to prepare the cloud environment. Perform the following procedure to prepare the environment:
- Create a ServiceComb engine. For details, see Creating a ServiceComb Engine.
- Create an environment. For details, see Creating an Environment. The created environment must contain resources such as CCE clusters, load balancers, and ServiceComb engines.
- Create an application. For details, see Creating an Application.
Common Environment Variables
Using ServiceStage to manage environments and deploy applications simplifies user configuration. ServiceStage sets some environment variables for applications. The following table lists some common environment variables:
| Name | Description |
|---|---|
| PAAS_CSE_SC_ENDPOINT | Registry center address of a ServiceComb engine. |
| PAAS_CSE_CC_ENDPOINT | Configuration center address of a ServiceComb engine. |
| PAAS_PROJECT_NAME | Name of a . |
| CAS_APPLICATION_NAME | Name of a ServiceStage application. |
| CAS_COMPONENT_NAME | Name of a ServiceStage component. |
| CAS_INSTANCE_VERSION | Version of the deployed ServiceStage. |
You can use these variables based on the mechanisms of different microservice development frameworks, such as the Place Holder mechanism of Spring Cloud and the mapping.yaml mechanism of Java chassis, to reduce manual input during deployment.
When creating an application on ServiceStage, you can bind middleware, such as Distributed Cache Service (DCS) and Relational Database Service (RDS), to the application. You can obtain the configuration information about the middleware bound to applications by using the following environment variables.
- Distributed session
Distributed sessions are stable and reliable session storage based on DCS, supporting automatic injection for mainstream web containers, such as tomcat context, node.js express-session, and PHP session handler.
The following table describes the environment variables of distributed sessions.
Table 2 Environment variables of DCS sessions Name
Description
DISTRIBUTED_SESSION_CLUSTER
Whether the instance is in cluster mode. Value: true or false.
DISTRIBUTED_SESSION_TYPE
Storage type of a distributed session instance. Currently, only Redis is supported.
DISTRIBUTED_SESSION_VERSION
Version of a distributed session instance.
DISTRIBUTED_SESSION_NAME
Name of a distributed session instance.
DISTRIBUTED_SESSION_HOST
IP address for connecting to a distributed session instance.
DISTRIBUTED_SESSION_PORT
Port for connecting to a distributed session instance.
DISTRIBUTED_SESSION_PASSWORD
Password for connecting to a distributed session instance.
- Distributed cache
DCS is an online, distributed, in-memory cache service compatible with Redis and Memcached. It combines high reliability and scalability with instant availability and easy management, delivering high read/write performance and fast data access.
The following table describes the environment variables of DCS.
Table 3 Environment variables of DCS Name
Description
DISTRIBUTED_CACHE_CLUSTER
Whether the instance is in cluster mode. Value: true or false.
DISTRIBUTED_CACHE_TYPE
Storage type of a distributed cache instance. Currently, only Redis is supported.
DISTRIBUTED_CACHE_VERSION
Version of a DCS instance.
DISTRIBUTED_CACHE_NAME
Name of a DCS instance.
DISTRIBUTED_CACHE_HOST
IP address for connecting to a DCS instance.
DISTRIBUTED_CACHE_PORT
Port for connecting to a DCS instance.
DISTRIBUTED_CACHE_PASSWORD
Password for connecting to a DCS instance.
- Cloud database
RDS is a cloud-based web service that is reliable, scalable, easy to manage, and out of the box.
The following table describes the environment variables of RDS.
Table 4 Environment variables of RDS Name
Description
RELATIONAL_DATABASE_NAME
Name of an RDS instance.
RELATIONAL_DATABASE_CONNECTION_TYPE
Connection type of an RDS instance. Value: JNDI/SPRING_CLOUD_CONNECTOR.
RELATIONAL_DATABASE_JNDI_NAME
JNDI name of an RDS instance. This variable is used if the connection type is JNDI.
RELATIONAL_DATABASE_DB_NAME
Database name of an RDS instance.
RELATIONAL_DATABASE_DB_USER
Database user of an RDS instance.
RELATIONAL_DATABASE_DB_TYPE
Database type of an RDS instance. Currently, only MySQL is supported.
RELATIONAL_DATABASE_VERSION
Database version of an RDS instance.
RELATIONAL_DATABASE_HOST
Database IP address of an RDS instance.
RELATIONAL_DATABASE_PORT
Database port of an RDS instance.
RELATIONAL_DATABASE_PASSWORD
Database password of an RDS instance.
Table 5 Environment variables related to the registry/configuration center Environment Variable
Description
REGISTER_SERVICE_REGISTERTYPE
Fixed value: NACOS
PAAS_CSE_ENGINE_MGR_ENDPOINT
Engine management endpoint
REGISTER_SERVICE_ADDRESS
Service registration address
SPRING_CLOUD_NACOS_DISCOVERY_SERVERADDR
Nacos discovery endpoint
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE
Eureka-compatible endpoint
DYNAMIC_CONFIG_DYNAMICCONFIGTYPE
Fixed value: NACOS
DYNAMIC_CONFIG_SERVERADDRESS
Dynamic configured address
Table 6 Environment variables related to Distributed Message Service (DMS) for Kafka Environment Variable
Description
DISTRIBUTED_MESSAGE_KAFKA_NAME
Instance name
DISTRIBUTED_MESSAGE_KAFKA_VERSION
Version
DISTRIBUTED_MESSAGE_KAFKA_ADDRESS
Connection address
DISTRIBUTED_MESSAGE_KAFKA_USER
Username
DISTRIBUTED_MESSAGE_KAFKA_PASSWORD
Password
Table 7 Environment variables related to GaussDB Environment Variable
Description
PAAS_GAUSSDB_NAME
Instance name
PAAS_GAUSSDB_VERSION
Database version
PAAS_GAUSSDB_ADDRESS
Connection address
PAAS_GAUSSDB_DB_NAME
Database name
PAAS_GAUSSDB_DB_USER
Database username
PAAS_GAUSSDB_PASSWORD
Password
Table 8 Environment variables related to DMS for RocketMQ Environment Variable
Description
DISTRIBUTED_MESSAGE_ROCKETMQ_NAME
Instance name
DISTRIBUTED_MESSAGE_ROCKETMQ_VERSION
Version
DISTRIBUTED_MESSAGE_ROCKETMQ_ADDRESS
Connection address
DISTRIBUTED_MESSAGE_ROCKETMQ_USER
Username
DISTRIBUTED_MESSAGE_ROCKETMQ_PASSWORD
Password
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot