Tencent CloudBase supports a one-click deployment flow that can take a public Git project and launch it directly on CloudBase. That removes much of the usual setup friction and makes it easier for people to try an app quickly. The deployment button works with GitHub, GitLab, Coding, Gitee, and other Git repository URLs.

The basic idea is to describe the application with a cloudbaserc.json file through CloudBase Framework, commit that file together with the project files, and then generate a one-click deployment button from it.

For example, the BBer repository is organized like this:

├── bber
│   ├── index.js
│   └── package.json
└── cloudbaserc.json

Its one-click deployment link is simply:

https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject&appUrl=https://github.com/lmm214/bber&branch=main

When that link is opened, CloudBase reads the configuration in cloudbaserc.json and automatically builds the required resources, including cloud functions, database collections, and storage-related setup.

With BBer, whether the deployment succeeds really depends on the configuration file. Here is the example configuration:

{
  "version": "2.0",  //一开始随后改成 1.0 悲催一整夜!
  "envId": "{{envId}}",  //2.0才能用这个动态变量 {{envId}}
  "functionRootPath": ".",  //根目录就一个点
  "functions": [
    {
      "name": "bber",
      "timeout": 30,
      "runtime": "Nodejs10.15",
      "memorySize": 128,
      "handler": "index.main"
    }
  ],
  "framework": {
    "name": "bber",
    "plugins": {
      "function": {  //部署云函数文件 index.js 和 package.json
        "use": "@cloudbase/framework-plugin-function",
        "inputs": {
          "functionRootPath": ".",
          "functions": [{ //云函数名儿
              "name": "bber",
              "timeout": 30,
              "envVariables": {},
              "runtime": "Nodejs10.15",
              "memory": 128
          }],
          "servicePaths": { //开启http访问链接
            "bber": "/bber"
          }
        }
      },
      "client": {  //创建数据库集合
        "use": "@cloudbase/framework-plugin-database",
        "inputs": {
          "collections": [
            {
              "collectionName": "talks",  //集合名儿
              "aclTag": "ADMINWRITE"  //权限为所有人可读仅管理员可写
            }
          ]
        }
      }
    }
  }
}

A few details in this file matter quite a bit. In this case, the configuration uses version: "2.0", and that matters because the dynamic variable {{envId}} is only available under 2.0. The root path is set to . because the project is deployed from the repository root. The function plugin handles deployment of the cloud function files, specifically index.js and package.json, while servicePaths exposes the bber function through an HTTP path at /bber.

The database plugin is also part of the same configuration. It creates a collection named talks, with ADMINWRITE access control, meaning everyone can read from it but only administrators can write to it.

So in practice, a single configuration file plus a single deployment link can replace a series of manual steps: creating cloud functions by hand, setting up the database manually, and enabling HTTP access routes one by one.

For BBer, that entire set of CloudBase resources can be provisioned through one-click deployment.