Deploy the Mall E‑commerce Project on Rainbond: A Step‑by‑Step Guide
This guide walks you through deploying the Mall e‑commerce application on Rainbond, covering both quick deployment via the open‑source app store and a full manual setup of all required services, middleware, backend and frontend components, with configuration examples and troubleshooting tips.
Introduction
Many developers spend a long time configuring the Mall e‑commerce project for deployment. This article shows how to use Rainbond, a cloud‑native application management platform, to deploy Mall quickly and easily, allowing you to focus on code.
Deployment Methods
Deploy Mall via Rainbond's open‑source app store.
Deploy Mall from scratch by setting up all services manually.
Prerequisite
Install a functional Rainbond environment on Linux, macOS, or Windows. See the Rainbond quick‑install guide.
Quick Deployment via App Store
The Mall project is published in the Rainbond open‑source app store. Search for mall in Platform Management → Application Market → Open‑Source App Store and install it.
Rainbond will automatically build and start all Mall services. After deployment, the topology looks like this:
Verify the deployment by accessing the mall-admin-web front‑end (default credentials admin / macro123). The mall-portal and mall-search services currently have no front‑end; you can verify them via the backend Swagger UI at http://xxx/swagger-ui/.
Manual Deployment from Scratch
Middleware Installation
Mall requires the following middleware, all of which can be installed from the Rainbond app store:
MySQL
Redis
RabbitMQ
MongoDB
ElasticSearch
Install Redis
Search for Redis in the open‑source app store and install version 5.x.
Install MongoDB
Search for MongoDB and install version 4.x.
Install RabbitMQ
Search for RabbitMQ and install it.
Install MySQL
Search for MySQL and install version 5.7. Then open the component’s Component → Port page, enable the external port, and connect using root / root. Import the Mall SQL data via a client.
Install ElasticSearch
Search for ElasticSearch and install version 7.15.2. Optionally remove the Kibana component. Disable security by setting xpack.security.enabled to false in the component’s configuration file.
Install IK Analyzer Plugin
In Team View → Plugin → Add Plugin → Install from App Store , search for ES-IK-Analysis and install it.
Add storage to the ElasticSearch component at Component → Storage → Add Storage with:
Name: Custom
Mount Path: /usr/share/elasticsearch/plugins Type: Shared Storage
Enable the ES-IK-Analysis plugin under Component → Plugin → Not Enabled .
Restart or update the ElasticSearch component.
Backend Service Configuration
Modify Maven Build Settings
Comment out the execution section in pom.xml so that Docker image building is handled by Rainbond.
<!--
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
-->Update Configuration Files
Replace hard‑coded values with environment variables for flexibility.
mall‑admin application-dev.yml
spring:
datasource:
url: jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false # MySQL connection URL
username: ${MYSQL_USERNAME} # MySQL user
password: ${MYSQL_PWD} # MySQL password
redis:
host: ${REDIS_HOST} # Redis host
...mall‑portal application-dev.yml
spring:
datasource:
url: jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false # MySQL connection URL
username: ${MYSQL_USERNAME} # MySQL user
password: ${MYSQL_PWD} # MySQL password
data:
mongodb:
host: ${MONGODB_HOST} # MongoDB host
port: 27017
database: mall-port
redis:
host: ${REDIS_HOST} # Redis host
rabbitmq:
host: ${AMQP_HOST} # RabbitMQ host
virtual-host: ${RABBITMQ_DEFAULT_VHOST}
username: ${RABBITMQ_DEFAULT_USER}
password: ${RABBITMQ_DEFAULT_PASS}
...mall‑search application-dev.yml
spring:
datasource:
url: jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false # MySQL connection URL
username: ${MYSQL_USERNAME} # MySQL user
password: ${MYSQL_PWD} # MySQL password
elasticsearch:
uris: ${ES_HOST}:${ES_PORT} # ElasticSearch URL
...Using environment variables makes the deployment portable; Rainbond automatically injects variables from dependent components.
Deploy Backend Components
Create components from source in the team or application view ( New → Create Component from Source ) with the following settings:
Component name: custom
Component English name: custom
Repository URL: https://github.com/zzzhangqi/mall.git Version: master
Rainbond detects the multi‑module project and builds mall-admin, mall-portal, and mall-search. Adjust each component’s port:
mall-admin: 8080
mall-portal: 8085
mall-search: 8081
Establish Component Dependencies
In edit mode, connect components according to their dependencies.
Frontend Deployment
Handle Cross‑Origin Issues
The backend address in config/prod.env.js must match the front‑end address to avoid CORS. Define a proxy path (e.g., /api) and rewrite it with Nginx.
module.exports = {
NODE_ENV: "production",
BASE_API: "/api"
}Rewrite /api to the actual backend endpoint using Nginx:
server {
listen 80;
location / {
root /app/www;
index index.html index.htm;
}
location /api {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8080;
}
}Deploy Frontend Component
Create a new component from source with these settings:
Component name: custom
Component English name: custom
Repository URL: https://github.com/zzzhangqi/mall-admin-web.git Version: master
Set the mall-admin-web component to depend on the mall-admin backend service.
Verification
Access mall-admin-web to verify the front‑end (default credentials admin / macro123). The mall-portal and mall-search services can be verified via their Swagger UI at http://xxx/swagger-ui/.
Reference Links
Rainbond quick‑install: https://www.rainbond.com/docs/quick-start/quick-install
Rainbond environment variable injection: https://www.rainbond.com/docs/micro-service/service-mesh/connection_env
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
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.
