Zero‑Code Migration: Deploy a Spring Cloud E‑Commerce App to Tencent TSF
This guide explains how to migrate a native Spring Cloud e‑commerce demo to Tencent Service Framework (TSF) with zero code changes, covering environment preparation, middleware setup, manual and automated deployment steps, service verification, and best‑practice recommendations for cloud‑native microservice operations.
Background
Spring Cloud provides a one‑stop solution for building microservice systems, simplifying service discovery, configuration, load balancing, circuit breaking, and distributed tracing. However, moving a Spring Cloud application to production requires a stable runtime, high‑availability registration, unified control‑plane governance, and visual data‑operation services.
Why TSF
One‑stop application lifecycle management : create, delete, deploy, rollback, scale, start, stop, and version‑track services.
High‑performance service registry : millisecond‑level discovery, local cache, fault alerts, cross‑AZ disaster recovery.
Fine‑grained service governance : multi‑level traffic control, gray release, proximity routing, circuit breaking, fault tolerance, and access authentication.
Three‑dimensional application data operation : performance metrics, distributed tracing, service topology, log collection, and fault analysis.
Example Project
The tutorial uses an open‑source mall system consisting of the following modules:
mall‑admin – backend management system
mall‑auth – role authentication
mall‑gateway – API gateway (request entry)
mall‑portal – frontend shop
mall‑search – product search
mall‑demo – sample API testing project
mall‑monitor – Spring‑provided monitoring (optional with TSF)
Environment Preparation
Development environment: a workstation containing the mall‑demo source code.
Deployment environment: purchased Tencent Cloud CVM instances where TSF will host the services.
Middleware Server Preparation
Purchase a cloud server (e.g., Tencent CVM).
Install Docker and Docker Compose.
Download the mall‑demo package and upload it to the server.
Run the following command in tsf-demo-public/document/docker to start the containers: docker-compose -f docker-compose-env.yml up -d Create the RabbitMQ virtual host, user, and permissions (run after RabbitMQ starts):
docker exec -it rabbitmq /init.shDeploy Application to TSF
Using the mall‑search service as an example:
Create a cluster : log in to the TSF console, navigate to **Cluster**, click **New**, and name it mall-demo. Import the purchased CVM instances into the cluster.
Create a log configuration : go to **Log Service → Log Config**, click **New**, and define a log collection rule.
Create and deploy the application :
Navigate to **Application Management → New Application**, name it mall-search.
Confirm the prompt to upload a package, then upload mall-search-1.0-SNAPSHOT.jar.
Choose the previously created cluster and log config, select target hosts, and click **Deploy**.
In the deployment page, enable health checks (liveness & readiness) and set the request path according to the Actuator configuration.
Deploy remaining services in the order:
mall-gateway → mall-auth → mall-admin → mall-portal → mall-search → mall-demo.
Result Verification
After deployment, verify the following:
Service dependency : access the frontend page (e.g., http://<em>middleware‑IP</em>:8090) and confirm that all services communicate correctly.
Rate limiting : configure a limit of 20 QPS for mall-admin in the TSF service governance console and observe the throttling effect.
Service authentication : set an auth rule so that only the gateway can call mall-admin; requests from other services should be rejected.
One‑Click Automated Deployment
The mall-demo package includes a deploy.py script that can automatically upload and deploy a new application to an existing TSF cluster. Configure the following parameters in deploy.py: path (required) – package file path applicationName (required) – name of the application appId (required) – account appId groupName (optional) – defaults to the application name, must be unique microserviceType (optional) – default NATIVE for cloud‑native apps applicationType (optional) – default V for VM deployment pkgVersion (optional) – defaults to a timestamp (YYYYmmddHHMMSS)
Integrate the script with CI/CD (e.g., Travis CI). Add a job in .travis.yml such as:
- ./scripts/deploy.py mall-demo/target/mall-demo-1.0-SNAPSHOT.jar "test" "1234567890"Commit and push to trigger the pipeline; the script will upload the JAR, create the application, and start the deployment automatically.
Conclusion
Spring Cloud simplifies microservice development but leaves the production‑grade infrastructure to the user. Tencent Service Framework supplies the missing backend capabilities—high‑availability registry, data operation, and unified governance—allowing developers to focus on business logic while achieving cloud‑native scalability and reliability.
Tencent Cloud Middleware
Official account of Tencent Cloud Middleware. Focuses on microservices, messaging middleware and other cloud‑native technology trends, publishing product updates, case studies, and technical insights. Regularly hosts tech salons to share effective solutions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
