Skip to main content

CloudBase Environment Migration Guide

This document provides data and configuration migration solutions between CloudBase environments, helping you migrate resources from one environment to another.

Overview

CloudBase currently does not support one-click migration. You need to manually migrate data and configurations module by module. The migration process involves the following modules:

  • Document Database: Data models, collection data
  • MySQL Database: Data models, data tables
  • Cloud Functions: Function code and configuration
  • CloudRun: Service code and configuration
  • Cloud Storage: Bucket files
  • Static Website Hosting: Hosted files
  • WeDa Applications: Low-code applications

Pre-migration Preparation

Before starting migration, please ensure:

  1. Confirm Target Environment: Create target CloudBase environment and obtain environment ID
  2. Permission Check: Ensure you have appropriate operation permissions in both source and target environments
  3. Install CLI Tool (Optional): Some migration operations require CloudBase CLI Tool

⚠️ Important Notes:

  • Migration process will not automatically delete data in source environment, please proceed with confidence
  • Some resources (such as database permissions, indexes) need to be manually reconfigured in target environment

Document Database Migration

Document database supports two data organization methods with different migration approaches:

Method 1: Data Model Migration

If you created data sources through "Data Model", simply export and import data model table structure and data for simple and efficient operation.

1. Export Data Model

  1. Visit CloudBase Platform/Document Database/Data Model
  2. Select the data model to migrate
  3. Export Data:
    • Switch to "Manage Data" tab
    • Click "Batch Export Data", select "All Data"
    • If data exceeds 100,000 records, export in batches (single export limit is 100,000 records)
  4. Export Model Configuration:
    • Switch to "Configure Model" tab
    • Click "Export Model Configuration" button

2. Import Data Model

  1. Enter target environment's Data Model Management Page
  2. Import in reverse order of export:
    • First import "Model Configuration"
    • Then import "Data"

Method 2: Data Collection Migration

If you directly created collections for operations, you need to export collection data.

1. Export Collection Data

  1. Visit CloudBase Platform/Document Database/Collection Management
  2. Select the collection to export, click "Export" button
  3. Export Format: Select JSON format (required)
  4. If exported data file exceeds 50 MB, export in batches:
    • Recommend exporting in batches by creation time or other fields
    • Ensure single data file is less than 50 MB

2. Import Collection Data

  1. Enter target environment's collection management page
  2. Create collection with same name (if not exists)
  3. Select collection, click "Import" button, upload exported JSON file

⚠️ Notes:

  • Database permission rules need to be manually reconfigured in target environment
  • Database indexes need to be manually recreated in target environment
  • Recommend migrating small amount of data for testing first, then bulk migrate after confirmation

MySQL Database Migration

MySQL database also supports two migration methods, choose corresponding migration method based on your data organization.

Method 1: Data Model Migration

If you created data sources through "Data Model", you can use data model's import/export functionality for migration.

Refer to Document Database/Data Model Migration for operation steps, the process is identical.

Method 2: Data Table Migration

If you directly created data tables for operations, you need to export and import through DMC database management platform.

1. Export Data Tables

  1. Visit CloudBase Platform/MySQL Database/Database Settings
  2. Create database account in "Account Management" module (skip if already created)
  3. Click "Database Management" button to enter DMC database management platform
  4. Perform data export operations in DMC platform

For detailed import/export operation methods, refer to MySQL Database/DMC Database Management/Import and Export

2. Import Data Tables

  1. Enter target environment's DMC database management platform
  2. Use import functionality to upload exported data files

⚠️ Notes:

  • Database permission rules need to be manually reconfigured in target environment
  • Database indexes need to be manually recreated in target environment
  • Ensure target database has sufficient storage space before importing

Cloud Functions Migration

Cloud functions migration includes migration of function code and configuration, supporting both console operations and CLI commands.

Method 1: Console Operations

1. Export Cloud Function Code

  1. Visit CloudBase Platform/Cloud Functions
  2. Click the "Function Name" to migrate, enter function details page
  3. Switch to "Function Code" tab
  4. In "Grayscale Configuration" area below, select $LATEST version
  5. Click "Download" button to download function code package (.zip format)

2. Import Cloud Function Code

  1. Enter target environment's Cloud Functions Management Page
  2. Click "Create Cloud Function"
  3. Select "Code Package Creation" method
  4. Upload exported code package (.zip file)
  5. Configure function's runtime environment, memory, timeout and other parameters
  6. Click "Complete" to create function

💡 Tip: If function uses environment variables, they need to be reconfigured in target environment.

Method 2: CLI Command Operations

Using CLI tool can migrate cloud functions more efficiently in batches.

1. Download Cloud Function Code

Use CLI command to download function code:

# Download to default directory
tcb fn code download <functionName>

# Download to specified directory
tcb fn code download <functionName> <destPath>

Example:

# Download login function to current directory
tcb fn code download login

# Download to specified directory
tcb fn code download login ./functions/login

For detailed instructions, refer to CLI/Cloud Function Code Management

2. Deploy Cloud Function Code

Deploy cloud function in target environment:

# Deploy specified function
tcb fn deploy <functionName>

# Deploy all functions in functions directory
tcb fn deploy

Example:

# Switch to target environment
tcb env:switch <Target Environment ID>

# Deploy function
tcb fn deploy login

For detailed instructions, refer to CLI/Cloud Function Deployment

⚠️ Notes:

  • Confirm whether function's runtime version is supported in target environment before migration
  • Function triggers need to be reconfigured in target environment
  • Function environment variables need to be reset in target environment

CloudRun Service Migration

CloudRun service migration requires exporting service code and redeploying in target environment.

Method 1: CLI Command Export

1. Export CloudRun Code

Use CLI command to download CloudRun service code:

tcb cloudrun download -s <Service Name> --targetPath <Target Path> --force

Parameter Description:

  • -s: Specify service name to download
  • --targetPath: Specify local path to save code
  • --force: Force overwrite existing files

Example:

# Download api-service to ./cloudrun/api-service directory
tcb cloudrun download -s api-service --targetPath ./cloudrun/api-service --force

For detailed instructions, refer to CLI/CloudRun Code Management

2. Deploy to Target Environment

Method 1: Console Upload Code Package

  1. Enter target environment's CloudRun Management Page
  2. Create new CloudRun service
  3. Select "Code Package Creation" method
  4. Upload exported code package (.zip format)
  5. Configure service's CPU, memory, instance count and other parameters
  6. Complete creation and deployment

Method 2: CLI Command Deployment

# Switch to target environment
tcb env:switch <Target Environment ID>

# Execute deployment command in service code directory
cd ./cloudrun/api-service
tcb cloudrun deploy

For detailed instructions, refer to CLI/CloudRun Code Deployment

⚠️ Notes:

  • CloudRun service environment variables need to be reconfigured in target environment
  • Service access path and domain configuration need to be reset
  • Ensure target environment has sufficient quota to support new service operation

Cloud Storage File Migration

Cloud storage uses Tencent Cloud Object Storage (COS) as underlying storage service, files can be migrated using COS data migration tools.

Migration Steps

1. View Source Environment Bucket Name

  1. Visit CloudBase Platform/Cloud Storage
  2. Record the "Bucket Name" displayed on the page

2. Execute Data Migration

Refer to COS to COS Data Migration documentation, use any of the following methods for migration:

  • COS Migration Tool: Suitable for large batch file migration
  • COS Console Batch Operations: Suitable for small file migration
  • COSCMD Command Line Tool: Suitable for scripted migration

💡 Tips:

  • Migration process will not affect data in source bucket
  • Recommend testing with small amount of files before migration to confirm correct configuration
  • Large file migration may take considerable time, please be patient

Static Website Hosting Migration

Static website hosting also uses Tencent Cloud Object Storage (COS) service, migration method is similar to cloud storage.

Migration Steps

1. View Source Environment Hosting Bucket Name

  1. Visit CloudBase Platform/Static Website Hosting/File Management
  2. Record the "Bucket Name" displayed on the page

2. Execute Data Migration

Refer to COS to COS Data Migration documentation for file migration.

3. Reconfigure Domain (If Any)

If you configured custom domain for static website hosting, you need to reconfigure domain in target environment:

  1. Enter target environment's static website hosting settings
  2. Add custom domain
  3. Configure DNS resolution to point domain to target environment

⚠️ Notes:

  • Custom domain and SSL certificate need to be reconfigured after migration
  • If CDN acceleration is used, it needs to be reconfigured in target environment

WeDa Application Migration

WeDa low-code applications support migration through template method.

Migration Steps

1. Export WeDa Application Template

  1. Visit CloudBase Platform/WeDa Low-Code/Custom Template Management
  2. Click "Create" button to create new template
  3. Enter "Template Details" page, add application resources to export
  4. Return to template list page, click corresponding template's "Export" button
  5. Select "Export Standardized Deployment Package"
  6. In "Template Details", switch to "Version" tab
  7. Click latest version's "Download" button to download deployment package

2. Import to Target Environment

  1. Enter target environment's WeDa Low-Code Console
  2. Create new application using downloaded deployment package
  3. Configure application's related parameters and resource bindings
  4. Publish application