当前位置:网站首页>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
边栏推荐
- Cloud computing "keeping the promise"
- Force buckle deletes duplicates in the sort array
- Application analysis of video edge computing gateway easynvr in video overall monitoring solution
- [shutter] how to use shutter packages and plug-ins
- How to open Tencent enterprise mailbox and Tencent enterprise mailbox login portal
- JS stack memory
- Kubernetes' ci/cd practice based on Jenkins spinnaker - adding product image scanning
- November 20, 2021: the start and end times of a movie can be listed in a small array
- Network security meets new regulations again, UK and US warn apt hacker attacks November 18 global network security hotspots
- Tencent cloud recruitment order sincerely invites ISV partners for customized development!
猜你喜欢

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

Arm learning (7) symbol table and debugging
Shengdun technology joined dragon lizard community to build a new open source ecosystem

JS input / output statements, variables

985 Android programmers won the oral offer of Alibaba P6 in 40 days. After the successful interview, they sorted out these interview ideas
![[redis advanced ziplist] if someone asks you what is a compressed list? Please dump this article directly to him.](/img/3f/988ed31a3f1cdc92deed121ed8d4ec.png)
[redis advanced ziplist] if someone asks you what is a compressed list? Please dump this article directly to him.
![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]

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

Shardingsphere-proxy-5.0.0 implementation of capacity range partition (V)

Theoretical analysis of countermeasure training: adaptive step size fast countermeasure training
随机推荐
CSDN articles crawl the top ten bloggers' articles and convert them to MD
How do small businesses do a good job in website construction? Is there any guarantee for network companies to build websites
What is hypervisor? What is the difference between type 1 and type 2?
Solution of self Networking Wireless Communication intercom system in Beifeng oil and gas field
A review of Tencent digital ecology conference · wechat low code special session
How is the national standard easygbs video technology applied in the comprehensive supervision scenario of the power supply business hall?
What is the website domain name trademark registration process? What is the use of a website domain name trademark?
Technology sharing | Clickhouse cluster's way of expanding replicas under sharding
Many ministries and commissions strengthened regulation, and Tencent security helped enterprises resist the "mining" Trojan horse
Basic DDoS commands
What is pension finance? What are the pension financial products?
PHP implementation of interval sorting of classified data
Echo framework: implementing distributed log tracing
Network security meets new regulations again, UK and US warn apt hacker attacks November 18 global network security hotspots
[technical grass planting] deploy a super large capacity and unlimited speed network disk in Tencent cloud
Video stream playback address redirection optimization after easycvr replaces the new kernel
CDN access log quality performance monitoring and operation statistical analysis best practices
JS stack memory
[shutter] how to use shutter packages and plug-ins
Common e-commerce data index system