Deno plugin
Tencent CloudBase Framework Deno Plugin
CloudBase Framework "Deno" Plugin: Deploy Deno applications to CloudBase's cloud hosting environment with one click via the CloudBase Framework, delivering a high-performance Deno application service featuring automatic elastic scaling for production-ready use.
Features
- No need to worry about the underlying architecture: Just develop business services without adapting to the underlying infrastructure
- Cost Savings: Achieves significant resource cost reduction through resource scaling, elastic scaling, and flexible billing.
- Framework Support: Seamlessly supports Deno applications
Usage
Step 1. Preparations
Specific steps please refer to Preparing the Cloud Development Environment and CloudBase CLI Command Tool
Step 2. Enter the project directory and initialize
Execute the following command to initialize a new deno project.
cloudbase init --template deno
Step 3. One-Click Deployment
cloudbase framework deploy
Configuration
By default, no configuration is required for use. The following configuration parameters are intended for scenarios with specific requirements.
Configuration Example
After running
cloudbase init, the Cloud Development configuration file
cloudbaserc.json` will be created. You can modify and write plugin configurations in the plugins section of the configuration file.
{
"envId": "{{envId}}",
"framework": {
"plugins": {
"client": {
"use": "@cloudbase/framework-plugin-deno",
"inputs": {
"serviceName": "deno-app",
"projectPath": "/deno-app"
}
}
}
}
}
Configuration Parameters Description
serviceName
Required, service name, string format, such as 'deno-app'
servicePath
Required, service path configuration, string format, such as '/deno-app'
projectPath
Optional. Path of the local code folder relative to the project root directory, in string format. Default: './'
dockerImage
Optional, Dockerfile base image, in string format. Default: 'debian:buster-slim'
runtime
Optional. Deno runtime version, in string format, such as 'v1.3.0'
. Default: 'latest'
denonVersion
Optional. Denon version, in string format, such as '@2.4.0'
. Default: ''
entry
Optional. Entry file, in string format. Default: ''
After setting the entry file to entry.ts
, during docker build, it will execute deno install entry.ts
.
However, it is not recommended to manage projects this way. Instead, use the denon configuration file and perform local compilation before deployment.
autoBuild
Optional. Whether to enable cloud auto-build, in boolean format. Default: true
About denon
docker uses denon to manage the deno process, facilitating the management of deno startup parameters.
denon configuration example:
# denon.yml
scripts:
build:
cmd:
- mkdir dist
- deno bundle src/entry.ts dist/entry.js
watch: false
start:
cmd: deno run dist/entry.js
allow:
- net
- env
- read
dev:
cmd: deno run src/entry.ts
env:
PORT: "3000"
allow:
- net
- env
- read
Compiling deno applications directly in docker may cause image build failures due to network environment issues with certain dependency files. It is recommended to install denon locally, perform local compilation using the denon build
command provided by denon.yml
, and then deploy the application to the cloud.
After
cloudbase init`, a default denon.yml will be automatically provided. Modify it according to your application requirements.
The default docker image executes the denon start
command to launch the application.
More Plugins
Please visit the CloudBase Framework Plugin List to use other plugins in combination
Documentation Resources
- CloudBase official website: https://tcb.cloud.tencent.com/
- CloudBase Static Website Setup Guide: https://docs.cloudbase.net/hosting/
- CloudBase Console: https://console.cloud.tencent.com/tcb