当前位置:网站首页>Best practices cloud development cloudbase multi environment management practices
Best practices cloud development cloudbase multi environment management practices
2022-06-24 01:30:00 【Tencent cloud development TCB】
background
Development of cloud CloudBase Provide environment replication capability , It is convenient for developers to develop projects in multiple environments .
Environmental resource replication practice ( Environmental Science A -> Environmental Science B)
Function resource
1、 Cloud function code from A Environment corresponding function copy , Pay attention to the dead environment in the code ID A It needs to be manually modified to B.
If... Is used in the function Node SDK And Use the current environment , Suggest writing :
const cloudbase = require("@cloudbase/node-sdk")
const app = cloudbase.init({
env: cloudbase.SYMBOL_CURRENT_ENV // Automatically select the current environment
})2、 The function attribute configuration is as follows Memory , Timeout time , environment variable , Timing trigger ,VPC, Public network access configuration , Function corresponds to cloud access configuration & authentication ,CLS All log configurations are copied , No developer action .
3、 The function layer does not copy , It needs to be manually on B Create a new layer in .
Database resources
- During database replication, only empty collections with the same name are created in the new environment , The table data needs to be manually imported by the user in the console (A Environment library export , Import to B Environment library ).
- Database security rules , Index settings are copied , Developers don't need to operate .
Cloud storage resources
- Cloud storage configuration, such as permission configuration , All cache configurations are copied , No user action required
- Specific file resources , The user needs to manually guide (A Environment export file resources , Import to B Environmental Science )
Recommended Practice :
- install cloudbase cli Tool and log in
npm i -g @cloudbase/cli tcb login
- download A Environment all files to local
# Download all the files tcb storage download / localPath --dir -e A
- Upload local files to B Environmental Science
tcb storage upload localPath -e B
Multi environment project development practice
1. development environment , Production environment differentiation
Environment based replication capabilities , Can quickly build and develop dev And production prod Two sets of environments ( There is no need to create tables repeatedly , Repeat the operation of building a function ).
Reference documents :
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/concepts/environment.html
Operation practice
1、 The cloud function side uses SDK Use the dynamic environment to write ( Similar to function resource replication ), Avoid writing dead environments ID.
- Applet side example
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
})- Tencent cloud side example
const cloudbase = require("@cloudbase/node-sdk")
const app = cloudbase.init({
env: cloudbase.SYMBOL_CURRENT_ENV // Automatically select the current environment
})2、 The client is in the development and production environment , Specify the corresponding environment respectively ID that will do
wx.cloud.init({
// Please fill in the environment here ID, Environmental Science ID You can open the cloud console to view
env: config.ENV // dev or prod
})Further more , In order to avoid the risk of manual operation , The environment can be configured in an engineering way ID, Such as Configure in development mode dev Environmental Science ID, In production mode, it is configured as prod Environmental Science ID, The specific implementation is not expanded here .
2. Project collaborative development
Under the same environment , The problem of dirty data is easy to occur in multi person collaborative development , Each developer can copy their own development environment based on the initial environment of the project , Debugging and development in each environment do not affect each other .
Open Cloud Development :https://console.cloud.tencent.com/tcb?tdl_anchor=techsite
边栏推荐
- Note 3 of disruptor: basic operation of ring queue (without disruptor class)
- Echo framework: implementing timeout Middleware
- What is the cost of domain name trademark registration? What is the use of domain names and trademarks?
- 7 tips for preventing DDoS Attacks
- . Net core cross platform development bbs forum (connotation source code + complete operation video)
- Everything I see is the category of my precise positioning! Open source of a new method for saliency map visualization
- If the program exits abnormally, how to catch the fatal error through the go language?
- 2022 postgraduate entrance examination experience sharing [preliminary examination, school selection, re examination, adjustment, school recruitment and social recruitment]
- Openstack
- CODING CD
猜你喜欢
![Graduation project - thesis writing notes [design topic type, thesis writing details, design materials]](/img/66/c0c400609b56dd012d87c620ca66e4.png)
Graduation project - thesis writing notes [design topic type, thesis writing details, design materials]
![[shutter] how to use shutter packages and plug-ins](/img/a6/e494dcdb2d3830b6d6c24d0ee05af2.png)
[shutter] how to use shutter packages and plug-ins

Use recursion to form a multi-level directory tree structure, with possibly the most detailed notes of the whole network.

An accident caused by a MySQL misoperation, and the "high availability" cannot withstand it!

Everything I see is the category of my precise positioning! Open source of a new method for saliency map visualization

【Flutter】如何使用Flutter包和插件

Error reported using worker: uncaught domexception: failed to construct 'worker': script at***

Theoretical analysis of countermeasure training: adaptive step size fast countermeasure training

Zhongshanshan: engineers after being blasted will take off | ONEFLOW u

Icml'22 | progcl: rethinking difficult sample mining in graph contrast learning
随机推荐
Talk about 11 tips for interface performance optimization
Software cost evaluation: basic knowledge interpretation of cosmoc method
Echo framework: automatically add requestid
What is the relationship between the Internet of things and artificial intelligence?
13 `bs_ duixiang. Tag tag ` get a tag object
Teach you to set up a gift card voucher exchange platform
Mobile direct payment, super convenient
Icml'22 | progcl: rethinking difficult sample mining in graph contrast learning
How is the national standard easygbs video technology applied in the comprehensive supervision scenario of the power supply business hall?
2022 postgraduate entrance examination experience sharing [preliminary examination, school selection, re examination, adjustment, school recruitment and social recruitment]
[redis advanced ziplist] if someone asks you what is a compressed list? Please dump this article directly to him.
Longest substring without duplicate characters
Error reported using worker: uncaught domexception: failed to construct 'worker': script at***
jdbc
What is the website construction process? What details need to be valued?
How to build a "preemptive" remote control system (- - memory chapter)
How to build a pagoda panel web site on Tencent ECS?
Gin framework: automatically add requestid
Cross domain and jsonp
Use recursion to form a multi-level directory tree structure, with possibly the most detailed notes of the whole network.