当前位置:网站首页>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
边栏推荐
- How to build a practical website and how to operate after the website goes online
- Analysis of the whole process of webapck5 core packaging principle
- Technology sharing | Clickhouse cluster's way of expanding replicas under sharding
- An accident caused by a MySQL misoperation, and the "high availability" cannot withstand it!
- How to view kubernetes API traffic by grabbing packets
- [technology planting grass] skillfully use cloud function to create wechat web page authorization public service
- Is the domain name available for trademark registration? How long is the trademark registration cycle?
- JS input / output statements, variables
- On November 11, 2021, live broadcast e-commerce opened a new way to play
- 7 tips for preventing DDoS Attacks
猜你喜欢
![[shutter] how to use shutter packages and plug-ins](/img/a6/e494dcdb2d3830b6d6c24d0ee05af2.png)
[shutter] how to use shutter packages and plug-ins

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

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

Installation and use of winscp and putty

Perhaps the greatest romance of programmers is to commemorate their dead mother with a software

JS input / output statements, variables
Shengdun technology joined dragon lizard community to build a new open source ecosystem

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

Shardingsphere-proxy-5.0.0 implementation of capacity range partition (V)
![[flutter] comment utiliser les paquets et plug - ins flutter](/img/a6/e494dcdb2d3830b6d6c24d0ee05af2.png)
[flutter] comment utiliser les paquets et plug - ins flutter
随机推荐
Build a smart drug supervision platform based on easycvr video technology and build a drug safety firewall
How to implement NSQ delay streaming technology in easycvr?
4 most common automated test challenges and Countermeasures
Echo framework: automatically add requestid
Selenium crawls stocks in practice
How to improve program performance
7 tips for preventing DDoS Attacks
November 17, 2021: the longest path of the same value. Given a binary tree, find the longest path
Build fiora chat room with Tencent lightweight cloud
Activity Registration - Tencent cloud digital intelligence driven SME transformation and upgrading series salon · Zhuhai station
Coordinate system "slang" in GIS world
An accident caused by a MySQL misoperation, and the "high availability" cannot withstand it!
Sockfwd a data forwarding gadget
Devops culture: Amazon leadership principles
Thread safety and lock optimization
Golang gets the start timestamp and end timestamp of a past or future week or month
A review of Tencent digital ecology conference · wechat low code special session
Online and offline integrated operation of channel sales system in the home furnishing industry to promote product update and iteration
Solution of self Networking Wireless Communication intercom system in Beifeng oil and gas field
If the program exits abnormally, how to catch the fatal error through the go language?