当前位置:网站首页>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
边栏推荐
- [solution] how to realize AI automatic recognition of high altitude parabolic behavior?
- Law / principle / rule / rule / theorem / axiom / essence / Law
- Icml'22 | progcl: rethinking difficult sample mining in graph contrast learning
- Kubernetes' ci/cd practice based on Jenkins spinnaker - adding product image scanning
- Qu'est - ce que le financement des pensions? Quels sont les produits financiers pour les personnes âgées?
- Ctfhub miscellaneous --icmp
- Technology sharing | Clickhouse cluster's way of expanding replicas under sharding
- Server performance monitoring: Best Practices for server monitoring
- Sockfwd a data forwarding gadget
- Architecture solutions
猜你喜欢

Cross domain and jsonp

An accident caused by a MySQL misoperation, and the "high availability" cannot withstand it!
![[flutter] comment utiliser les paquets et plug - ins flutter](/img/a6/e494dcdb2d3830b6d6c24d0ee05af2.png)
[flutter] comment utiliser les paquets et plug - ins flutter
Shengdun technology joined dragon lizard community to build a new open source ecosystem

LMS Virtual. Derivation method of lab acoustic simulation results

Icml'22 | progcl: rethinking difficult sample mining in graph contrast learning

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

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

Arm learning (7) symbol table and debugging
Talk to Wu Jiesheng, head of Alibaba cloud storage: my 20 years of data storage (unlimited growth)
随机推荐
ctfhub---SSRF
Go language core 36 lectures (go language practice and application VII) -- learning notes
Use recursion to form a multi-level directory tree structure, with possibly the most detailed notes of the whole network.
How to write the domain name of trademark registration? What is the process of trademark and domain name registration?
How to choose a website construction company self-study website or website construction company
Online and offline integrated operation of channel sales system in the home furnishing industry to promote product update and iteration
Analysis of the whole process of webapck5 core packaging principle
EasyPlayer. JS play m3u8 error net:: err_ EMPTY_ Response, how to solve it?
Application analysis of video edge computing gateway easynvr in video overall monitoring solution
Icml'22 | progcl: rethinking difficult sample mining in graph contrast learning
Oushudb learning experience sharing (I)
Technology sharing | Clickhouse cluster's way of expanding replicas under sharding
[redis advanced ziplist] if someone asks you what is a compressed list? Please dump this article directly to him.
Everything I see is the category of my precise positioning! Open source of a new method for saliency map visualization
JS input / output statements, variables
Attack and defense world PyC trade
Graduation project - thesis writing notes [design topic type, thesis writing details, design materials]
How to self-study website construction is website construction company reliable
Textplus - reverse engineering of textplus
13 `bs_ duixiang. Tag tag ` get a tag object