Cloud Native 13 min read

Deploy a Spring Boot Mall Application to Alibaba Cloud Serverless in 5 Steps

This step‑by‑step guide shows how to prepare a VM, clone the open‑source Mall project, build Docker images for its dependencies, push them to Alibaba Cloud Container Registry, configure Serverless Devs, and finally deploy both the backend and Vue‑based frontend to Alibaba Cloud Function Compute, including log inspection and verification.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Deploy a Spring Boot Mall Application to Alibaba Cloud Serverless in 5 Steps

Prerequisites

Alibaba Cloud account.

A VM with a public IP that can run MySQL, Redis, MongoDB, Elasticsearch, RabbitMQ, etc.

Git, Docker, Java 8/11, Maven and Serverless Devs CLI installed on the VM.

Security‑group inbound rules allowing ports 3306 (MySQL), 6379 (Redis) and other service ports.

Clone source code and build dependency images

Clone the Mall project (GitHub or Gitee mirror) and run the provided script to build Docker images for all required services.

git clone https://github.com/hryang/mall
# or
git clone https://gitee.com/aliyunfc/mall.git
sudo bash docker.sh

Verify that the containers are running:

sudo docker ps

Push images to Alibaba Cloud Container Registry (ACR)

Create a namespace in ACR (e.g., quanxi-hryang) and tag each image with the registry address, then push.

sudo docker tag mall/mall-admin:1.0-SNAPSHOT registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-admin:1.0-SNAPSHOT
sudo docker push registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-admin:1.0-SNAPSHOT

sudo docker tag mall/mall-portal:1.0-SNAPSHOT registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-portal:1.0-SNAPSHOT
sudo docker push registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-portal:1.0-SNAPSHOT

sudo docker tag mall/mall-search:1.0-SNAPSHOT registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-search:1.0-SNAPSHOT
sudo docker push registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-search:1.0-SNAPSHOT

Configure application properties

Edit the three application-prod.yml files:

mall-admin/src/main/resources/application-prod.yml
mall-portal/src/main/resources/application-prod.yml
mall-search/src/main/resources/application-prod.yml

Replace the host field with the public IP of the VM that runs the dependency services.

Update Serverless Devs definition ( s.yaml )

In s.yaml, set the following fields for each function: access: the Serverless Devs credential profile (usually default). region: the target region (e.g., cn-hangzhou). image: the full ACR image URL that was pushed in the previous step.

Deploy backend services

s deploy

After a successful deployment the CLI prints an endpoint URL. Access /swagger-ui.html on that URL to view the API testing page. The first request may take ~30 seconds due to cold start.

View logs

s logs

– view logs for all services at a specific time. s mall-admin logs – view logs for the mall-admin function. s mall-admin logs -t – follow logs in real time. s mall-admin logs --keyword=abc – filter logs by keyword.

Build and deploy the frontend (Vue + Element)

Clone the frontend repository and set the backend API endpoint.

git clone https://github.com/hryang/mall-admin-web
# or
git clone https://gitee.com/aliyunfc/mall-admin-web.git

Modify config/prod.env.js and set BASE_API to the backend endpoint obtained from the previous deployment.

npm install
npm run build

Package the built files into a Docker image using the same docker.sh script, then tag and push the image to ACR.

sudo bash docker.sh
sudo docker tag mall/mall-admin-web:1.0-SNAPSHOT registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-admin-web:1.0-SNAPSHOT
sudo docker push registry.cn-hangzhou.aliyuncs.com/quanxi-hryang/mall-admin-web:1.0-SNAPSHOT

Update the s.yaml entry for the frontend service (adjust access, region and image) and deploy: s deploy Open the provided URL, log in with the default password macro123, and the full Mall UI will be displayed.

Summary of the deployment process

Clone the project repositories.

Prepare a VM and install MySQL, Redis, etc., using the provided Docker scripts.

Update the host entries in the YAML configuration files to the VM’s public IP.

Build Docker images for backend and frontend services and push them to Alibaba Cloud Container Registry.

Deploy the images with Serverless Devs ( s deploy) and verify the generated endpoints.

Reference URLs

Spring Boot – https://spring.io/projects/spring-boot

Mall source code – https://github.com/macrozheng/mall

Serverless Devs CLI installation – http://serverless-devs.com/zh-cn/docs/installed/cliinstall.html

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeDockerServerlessDeploymentSpring BootAlibaba CloudFunction Compute
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.