Skip to main content

Deploying Static Applications to a Private Environment with CloudBase CLI

This document guides you through deploying a front-end static application (React / Vue / Vite, etc.) to a WeDa private deployment environment using CloudBase CLI.

Prerequisites​

Requirements
  1. WeDa environment: private deployment completed, with the environment ID and platform address at hand
  2. Credentials: console account and password of the private deployment environment
  3. CLI: @cloudbase/cli 3.8.7 or later (this capability is available from 3.8.7; check with tcb -v)
  4. Local environment: Node.js installed, and the project builds locally

Step 1: Configure cloudbaserc.json​

Add the private environment configuration to cloudbaserc.json in your project root:

{
"envId": "software-xxxxxxxxxxxx",
"privateSettings": {
"credential": {
"weda": {
"username": "admin",
"password": "******"
}
},
"endpoints": {
"cliApi": "http://your-private-domain.com"
}
},
"app": {
"serviceName": "my-app",
"framework": "vite",
"outputDir": "dist"
}
}

Fields:

FieldRequiredDescription
envIdYesPrivate environment ID
privateSettings.credential.weda.username / passwordYesConsole account of the private environment; the only usable credential in this deployment mode
privateSettings.endpoints.cliApiYesPrivate platform address, including the protocol (e.g. http://1.2.3.4)
privateSettings.privateUinNoUser uin of the private environment
app.serviceNameNoApplication name; determines the access URL sub-path and the version name prefix (e.g. my-app-003). Defaults to the positional argument → interactive selection → project directory name
app.outputDirYesBuild output directory; a key setting for private deployment, see Step 2
app.deployPathNoAccess sub-path, default /<app.serviceName>; changing it changes the access URL
app.ignoreNoExtra ignore rules; must be configured explicitly in a private environment, see Notes
app.envVariablesNoHas no effect in a private environment: not injected into the local build; set them yourself when building locally (e.g. .env)
No login required

When privateSettings is present, the CLI automatically detects the private environment and handles authentication. Running tcb login is not required, and no object storage keys are needed.

Step 2: Build locally​

Important: no cloud build in private environments

For public cloud deployment, the server performs "install dependencies → build". A private environment does not provide cloud build capabilities, so you must build the output directory locally first.

If the output directory does not exist, the deployment command fails immediately and prompts you to build locally first.

npm install
npm run build

After the build, make sure the app.outputDir directory (default: dist) has been generated.

Step 3: Deploy​

tcb app deploy

Common options (run tcb app deploy -h for the full list):

OptionDescriptionEffective in a private environment
[serviceName]Positional argument, application name; defaults to app.serviceName → interactive selection → project directory nameYes
-e, --env-id <envId>Override the environment ID (--envId is a deprecated alias)Yes
--output-dir <dir>Override app.outputDir; decides which directory is uploadedYes
--deploy-path <path>Override app.deployPathYes
--cwd <path>Project directory, relative path (defaults to the current directory)Yes
--ignore <patterns>Ignore patterns, comma-separated, appended after app.ignoreYes
--enable-git-ignoreMerge the project .gitignore rules (off by default)Yes
-f, --forceSkip the confirmation when the application name already exists (recommended for CI)Yes
--framework <fw>Framework type, recorded with the version (static is treated as other)Recorded only
--install-command / --build-commandInstall / build commandNo, see Step 2

The CLI performs the following in sequence: package the output directory → upload → create the cloud application → poll the build status.

Step 4: Access the application​

After a successful deployment, the terminal prints the access URL and version:

Deployment succeeded!
Access URL: http://your-private-domain.com/my-app/
Version: my-app-003
Duration: 32s
Note

The application access URL looks like http://<domain>/<serviceName>; whether a trailing slash is present depends on the domain returned by the platform — always trust the URL printed in the terminal. If a fallback address is printed, use the application domain shown in the platform console instead.

Querying and deleting applications​

Application management commands are also available in a private environment:

CommandDescription
tcb app listList applications in the environment
tcb app info <serviceName>Show details of an application
tcb app versions list <serviceName>List the version history of an application
tcb app versions detail <serviceName>Show details of a version (latest by default)
tcb app delete <serviceName>Delete an application and all of its versions (supports --dry-run)
tcb app list
tcb app info my-app
tcb app versions list my-app
tcb app versions detail my-app

# Preview before deleting
tcb app delete my-app --dry-run
Note
  • Access URLs are rendered with the platform protocol (http://<domain>/<serviceName>)
  • app versions detail resolves the latest version automatically when --version-name is omitted
  • app delete removes all versions of the application and cannot be undone; use --dry-run first to confirm the target
About tcb app build

tcb app build is not provided in a private environment.

It builds static hosting projects declared in cloudbaserc.json (hosting[]), and its artifacts are consumed by tcb deploy / tcb hosting deploy — neither of which works in a private environment, since the platform has no static hosting service; the artifacts would have nowhere to go. It also handles only hosting[], not the app field used in this guide.

Use your project's own build command (e.g. npm run build) to produce app.outputDir instead.

Differences from public cloud deployment​

DimensionPublic cloudPrivate (software)
Build locationCloud (server-side)Local; build the output first
Uploaded contentProject source codeContents of the app.outputDir directory
app.installCommand / app.buildCommandSent to the server to executeIgnored, with a notice printed
app.framework: "static"Uses the static hosting direct-upload pathTreated as other
Access URL formathttps://{envId}-{appId}.tcloudbaseapp.comhttp://<domain>/<serviceName> (trust the URL printed in the terminal)
Authenticationtcb loginAccount and password from the configuration file
Build output is uploaded, not source

A private environment publishes the root of the uploaded package as the site content. The CLI locates the upload directory automatically based on app.outputDir, so be sure to build locally first and configure outputDir correctly.

Notes​

  • Available commands: in a private environment the CLI registers only supported commands; run tcb -h to see the current list
  • No SPA route fallback: requests to extension-less paths return NoSuchKey instead of falling back to index.html; when using React Router and similar, prefer hash mode
  • Static hosting only: private environments support only the static-hosting deployment type, which the CLI always uses
  • No cloud build log link: private environments have no corresponding console page, so no link is printed
  • Configure app.ignore explicitly: the app deploy path does not exclude node_modules by default. When outputDir points to the project root (.), you must configure it yourself, otherwise dependencies are packed and published (bare directory names are expanded to <dir>/** automatically, so node_modules is enough). .git and .DS_Store are always excluded by the CLI — no need to list them

FAQ​

SymptomCause and resolution
"not a valid command"The command is not supported in a private environment; run tcb -h to see available commands
Missing private credentialprivateSettings.credential.weda is not configured; configuring only secretId / secretKey does not work in this mode
Missing platform addressprivateSettings.endpoints.cliApi is not configured
"build and produce dist locally first"The output directory does not exist; run npm run build first
Site opens but static assets return 404The source directory was uploaded instead of the output directory; check app.outputDir
Error "app.outputDir resolves outside the project directory"outputDir is a ../ path or an absolute path; the upload directory must stay inside the project — use a relative path such as dist
Error "app.outputDir escapes the project directory via a symbolic link"The outputDir directory is a symlink whose real path is outside the project; remove the symlink, or copy the external content into the project during the build
Deployment failedThe error message includes a request ID that you can provide to the platform team