|
|
@@ -165,7 +165,7 @@ litemall是一个简单的商场系统,基于现有的开源项目,重新实
|
|
|
7. 编译本项目
|
|
|
8. 运行litemall-os-api, 打开浏览器,输入
|
|
|
```
|
|
|
- http://localhost:8081/storage/index/index
|
|
|
+ http://localhost:8081/os/index/index
|
|
|
```
|
|
|
如果出现JSON数据,则Spring Boot开发环境部署成功,litemall-os-api模块运行正常。
|
|
|
9. 同上,运行litemall-wx-api, 打开浏览器,输入
|
|
|
@@ -272,13 +272,13 @@ mvn package
|
|
|
最后,本机测试性部署三个Spring Boot应用
|
|
|
```
|
|
|
cd litemall
|
|
|
-java -jar ./litemall-os-api/target/litemall-os-api-0.1.0.jar &
|
|
|
-java -jar ./litemall-wx-api/target/litemall-wx-api-0.1.0.jar &
|
|
|
-java -jar ./litemall-admin-api/target/litemall-admin-api-0.1.0.jar &
|
|
|
+java -jar ./litemall-os-api/target/litemall-os-api-0.1.0-exec.jar &
|
|
|
+java -jar ./litemall-wx-api/target/litemall-wx-api-0.1.0-exec.jar &
|
|
|
+java -jar ./litemall-admin-api/target/litemall-admin-api-0.1.0-exec.jar &
|
|
|
```
|
|
|
如果,能够访问以下链接的数据,则表明本地测试部署成功:
|
|
|
```
|
|
|
-http://localhost:8081/storage/index/index
|
|
|
+http://localhost:8081/os/index/index
|
|
|
http://localhost:8082/wx/index/index
|
|
|
http://localhost:8083/admin/index/index
|
|
|
```
|
|
|
@@ -474,9 +474,9 @@ cnpm run build:prod
|
|
|
https://docs.spring.io/spring-boot/docs/1.5.10.RELEASE/reference/htmlsingle/#deployment-service
|
|
|
|
|
|
1. 项目进一步打包到deploy文件夹中:
|
|
|
- * litemall-os-api模块编译得到的litemall-os-api-xxx.jar 保存到deploy的litemall-os-api文件夹中,同时重命名成litemall-os-api.jar
|
|
|
- * litemall-wx-api模块编译得到的litemall-wx-api-xxx.jar 保存到deploy的litemall-wx-api文件夹中,同时重命名成litemall-wx-api.jar
|
|
|
- * litemall-admin-api模块编译得到的litemall-admin-api-xxx.jar 保存到deploy的litemall-admin-api文件夹中,同时重命名成litemall-admin-api.jar
|
|
|
+ * litemall-os-api模块编译得到的litemall-os-api-xxx-exec.jar 保存到deploy的litemall-os-api文件夹中,同时重命名成litemall-os-api.jar
|
|
|
+ * litemall-wx-api模块编译得到的litemall-wx-api-xxx-exec.jar 保存到deploy的litemall-wx-api文件夹中,同时重命名成litemall-wx-api.jar
|
|
|
+ * litemall-admin-api模块编译得到的litemall-admin-api-xxx-exec.jar 保存到deploy的litemall-admin-api文件夹中,同时重命名成litemall-admin-api.jar
|
|
|
* litemall-admin模块编译以后,把dist文件夹压缩,然后放到deploy的litemall-admin文件夹中。
|
|
|
|
|
|
2. 使用FileZilla把deploy整个文件夹上传到云主机的/home/ubuntu文件夹中
|
|
|
@@ -509,7 +509,7 @@ https://docs.spring.io/spring-boot/docs/1.5.10.RELEASE/reference/htmlsingle/#dep
|
|
|
然后测试是否部署成功(xxx.xxx.xxx.xxx是云主机IP):
|
|
|
|
|
|
```
|
|
|
- http://xxx.xxx.xxx.xxx:8081/storage/index/index
|
|
|
+ http://xxx.xxx.xxx.xxx:8081/os/index/index
|
|
|
http://xxx.xxx.xxx.xxx:8082/wx/index/index
|
|
|
http://xxx.xxx.xxx.xxx:8083/admin/index/index
|
|
|
http://xxx.xxx.xxx.xxx:8080/#/login
|
|
|
@@ -537,16 +537,38 @@ https://docs.spring.io/spring-boot/docs/1.5.10.RELEASE/reference/htmlsingle/#dep
|
|
|
|
|
|
### 1.5.4 分布式云部署方案
|
|
|
|
|
|
-目前没有测试过,但是简单的分布式应该是可行的。
|
|
|
-
|
|
|
由于本项目是面向微小型企业的小商城系统,因此预期的分布式部署方案是
|
|
|
1. 专门的云数据库部署数据
|
|
|
-2. 一台云主机部署管理后台的后台服务
|
|
|
-3. 一台云主机部署管理后台静态文件服务
|
|
|
-4. 一台云主机部署小商场的后台服务
|
|
|
-5. 专门的云存储方案
|
|
|
+2. 专门的云存储方案
|
|
|
+3. 专门的CDN分发管理后台的静态文件
|
|
|
+4. 一台云主机部署管理后台的后台服务
|
|
|
+5. 一台云主机部署小商场的后台服务
|
|
|
+
|
|
|
+虽然由于环境原因没有正式测试过,但是这种简单的分布式场景应该是可行的。
|
|
|
+在1.5.3节中所演示的四个服务是独立的,因此延伸到这里分布式是非常容易的。
|
|
|
|
|
|
-因此,如果需要实现互联网式分布式云部署,目前的项目架构和方案会存在很多问题。
|
|
|
+但是,如果需要实现互联网式分布式云部署,目前的项目架构和方案会存在很多问题。
|
|
|
至少每个功能模块应该是独立服务系统。此外,需要引入单点登录系统、集群、缓存
|
|
|
-和消息队列等多种技术。
|
|
|
+和消息队列等多种技术。因此如果开发者需要这种形式的分布式方案,请参考其他项目。
|
|
|
+
|
|
|
+### 1.5.5 单主机单服务war部署方案
|
|
|
+
|
|
|
+这里介绍另外一种单主机单服务的方案,即四个服务打包成一个war格式的项目部署包。
|
|
|
|
|
|
+和1.5.3节相比,采用这样方案的原因是:
|
|
|
+1. 安装方便,是传统的web项目安装方式,在tomcat里面部署一个war项目包,即可完成安装;
|
|
|
+2. 内存消耗少。在1.5.3节中四个独立的java环境消耗的内存大概1.2G多,而这里部署以后
|
|
|
+只需要一个java环境,因此消耗内存只有1.5.3节方案的四分之一,适合1G云主机部署。
|
|
|
+3. 只存在一个域名和端口,没有多个服务之间依赖关系。
|
|
|
+
|
|
|
+具体的打包部署方案是;
|
|
|
+1. litemall-admin首先需要先编译得到静态文件;
|
|
|
+2. 采用`mvn package`命令,litemall-all模块自动生成war格式的安装包,里面
|
|
|
+ 包含了三个后台服务和静态文件;
|
|
|
+3. 把这个安装包手动或采用其他方式部署云主机的tomcat服务器。
|
|
|
+
|
|
|
+更多细节阅读2.5节litemall-all模块。
|
|
|
+
|
|
|
+注意:
|
|
|
+> 虽然这里介绍了这种方案,但是本项目的开发、测试和部署是基于1.5.3方案,
|
|
|
+> 因此开发者可能需要做一些配置方面的调整,例如三个后台服务地址调整。
|