Skip to main content

Migrate Your Services to Cloud Hosting

Most backend services typically include the following components:

  • Service Entity
  • Persistent services (various databases, file storage)
  • Infrastructure (e.g., message queues, service registration and discovery centers, monitoring systems, logging systems, etc.)

Migrating Service Entities

CloudBase Cloud Hosting is suitable for deploying stateless containerized services. You need to transform your services into this type.

Stateless Services

A stateless service does not need to persistently save context when handling individual requests, ensuring that the service can be scaled out arbitrarily.

In a stateless service, all service nodes are completely equivalent. Requests may be processed by any random node, and nodes may be dynamically destroyed, rebuilt, or scaled out. Therefore, you should not save any state on the nodes, for example:

  • Using local memory to store HTTP Session;
  • Using local files to store data;
  • Using the IP of a specific node in business logic.

If you have the above requirements, you can consider the following solutions:

  • Using external databases such as Redis to store HTTP Session;
  • Using external services such as CFS and Object Storage to store files;
  • Use the service's public URL.

Containerization

CloudBase Cloud Hosting can only deploy applications based on Docker containers. To encapsulate your service into containers, you should use a Dockerfile to define your application's runtime environment.

CloudBase Cloud Hosting automatically collects the standard output generated by your application and provides log query functionality.

Migration Infrastructure

Cloud Hosting applications can access any cloud resources via their VPC. If your infrastructure is already deployed within Tencent Cloud, you only need to establish VPC connectivity to enable your services to access your infrastructure.