litemall项目
github地址
部署文档
安装nodejs8.9
curl -OL https://nodejs.org/download/release/v8.9.4/node-v8.9.4-linux-x64.tar.xz
tar -xvf node-v8.9.4-linux-x64.tar.xz
# vim ~/.bash_profile
# export NODEJS_HOME=/home/huangyansheng/nodejs/node-v8.9.4-linux-x64
# export PATH=$NODEJS_HOME/bin:$PATH
npm install -g cnpm --registry=https://registry.npm.taobao.org
安装docker
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo docker run hello-world
which docker-compose
部署过程
git clone https://gitee.com/linlinjava/litemall.git
cd litemall
自动化部署脚本 package.sh
运行方式
bash -x $LITEMALL_HOME/docker/utils/package.sh
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
解决方案
diff --git a/docker/litemall/application.yml b/docker/litemall/application.yml
index 9f4434b..f4a41b9 100644
--- a/docker/litemall/application.yml
+++ b/docker/litemall/application.yml
@@ -5,7 +5,7 @@ spring:
encoding: UTF-8
datasource:
druid:
- url: jdbc:mysql://mysql:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=true
+ url: jdbc:mysql://mysql:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false
driver-class-name: com.mysql.cj.jdbc.Driver
username: litemall
password: litemall123456
脚本内容,不需要改动
#!/bin/bash
# 请注意
# 本脚本的作用是把本项目编译的结果保存到deploy文件夹中
# 1. 把项目数据库文件拷贝到docker/db/init-sql
# 2. 编译litemall-admin
# 3. 编译litemall-all模块,然后拷贝到docker/litemall
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd $DIR/../..
LITEMALL_HOME=$PWD
echo "LITEMALL_HOME $LITEMALL_HOME"
# 复制数据库
cat $LITEMALL_HOME/litemall-db/sql/litemall_schema.sql > $LITEMALL_HOME/docker/db/init-sql/litemall.sql
cat $LITEMALL_HOME/litemall-db/sql/litemall_table.sql >> $LITEMALL_HOME/docker/db/init-sql/litemall.sql
cat $LITEMALL_HOME/litemall-db/sql/litemall_data.sql >> $LITEMALL_HOME/docker/db/init-sql/litemall.sql
# 安装阿里node镜像工具
npm install -g cnpm --registry=https://registry.npm.taobao.org
# 打包litemall-admin
cd $LITEMALL_HOME/litemall-admin
cnpm install
cnpm run build:dep
# 打包litemall-vue
cd $LITEMALL_HOME/litemall-vue
cnpm install
cnpm run build:dep
cd $LITEMALL_HOME
mvn clean package
cp -f $LITEMALL_HOME/litemall-all/target/litemall-all-*-exec.jar $LITEMALL_HOME/docker/litemall/litemall.jar
部署脚本
运行
bash -x bin/deploy.sh
部署脚本内容
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd $DIR/../..
LITEMALL_HOME=$PWD
echo "LITEMALL_HOME $LITEMALL_HOME"
cd $LITEMALL_HOME/docker
sudo docker-compose down
sudo docker-compose build
sudo docker image prune -f
sudo docker-compose up -d
学院部署的变更参考
diff --git a/docker/bin/deploy.sh b/docker/bin/deploy.sh
index 9182a2b..4c3dad1 100644
--- a/docker/bin/deploy.sh
+++ b/docker/bin/deploy.sh
@@ -1,6 +1,7 @@
#!/bin/bash
-cd /home/ubuntu/docker
+LITEMALL_HOME=~/litemall/litemall
+cd $LITEMALL_HOME/docker
sudo docker-compose down
sudo docker-compose build
sudo docker image prune -f
diff --git a/docker/bin/reset.sh b/docker/bin/reset.sh
index e9cfaa0..1101796 100644
--- a/docker/bin/reset.sh
+++ b/docker/bin/reset.sh
@@ -11,6 +11,7 @@
# ii. 同时请注意root密码放在脚本是非常危险的,因此这里仅仅是用于开发测试阶段。
ROOT=root
PASSWORD=litemall123456
+LITEMALL_HOME=~/litemall/litemall
if test -z "$PASSWORD"
then
@@ -19,18 +20,18 @@ then
fi
# 删除storage文件夹内文件
-cd /home/ubuntu/docker/litemall/storage || exit 2
+cd $LITEMALL_HOME/docker/litemall/storage || exit 2
sudo rm -f ./**
-cd /home/ubuntu/docker || exit 3
+cd $LITEMALL_HOME/docker || exit 3
sudo docker-compose down
sudo docker-compose build
sudo docker image prune -f
# 删除db/data文件夹内文件重置数据
# 这样docker启动时会自动运行db/init-sql脚本,导入新的数据
-cd /home/ubuntu/docker/db/data || exit 1
+cd $LITEMALL_HOME/docker/db/data || exit 1
sudo rm -rf ./**
-cd /home/ubuntu/docker || exit 3
+cd $LITEMALL_HOME/docker || exit 3
sudo docker-compose up -d
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index cb707c4..bce1ef1 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -4,7 +4,7 @@ services:
image: mysql:5.7
container_name: mysql
ports:
- - "3306:3306"
+ - "13306:3306"
command:
--character-set-server=utf8
--collation-server=utf8_general_ci
@@ -22,7 +22,7 @@ services:
dockerfile: Dockerfile
container_name: litemall
ports:
- - "8080:8080"
+ - "18080:8080"
volumes:
- ./litemall/storage:/storage
- ./litemall/logs:/logs
@@ -32,4 +32,4 @@ services:
- TZ=Asia/Shanghai
depends_on:
- mysql57
- restart: always
\ No newline at end of file
+ restart: always
diff --git a/docker/litemall/application.yml b/docker/litemall/application.yml
index 9f4434b..f4a41b9 100644
--- a/docker/litemall/application.yml
+++ b/docker/litemall/application.yml
@@ -5,7 +5,7 @@ spring:
encoding: UTF-8
datasource:
druid:
- url: jdbc:mysql://mysql:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=true
+ url: jdbc:mysql://mysql:3306/litemall?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false
driver-class-name: com.mysql.cj.jdbc.Driver
username: litemall
password: litemall123456
@@ -145,4 +145,4 @@ litemall:
bucketName: litemall
swagger:
- production: true
\ No newline at end of file
+ production: true
diff --git a/litemall-admin/.env.deployment b/litemall-admin/.env.deployment
index 5e42a2e..49271b5 100644
--- a/litemall-admin/.env.deployment
+++ b/litemall-admin/.env.deployment
@@ -4,5 +4,5 @@ NODE_ENV = production
ENV = 'deploymenet'
# base api
-VUE_APP_BASE_API = 'http://122.51.199.160:8080/admin'
+VUE_APP_BASE_API = 'http://litemall.hogwarts.ceshiren.com/admin'
diff --git a/litemall-vue/.env.deployment b/litemall-vue/.env.deployment
index 16d4e63..946ad3c 100644
--- a/litemall-vue/.env.deployment
+++ b/litemall-vue/.env.deployment
@@ -2,4 +2,4 @@
ENV = 'production'
# base api
-VUE_APP_BASE_API = 'http://122.51.199.160:8080/'
\ No newline at end of file
+VUE_APP_BASE_API = 'http://litemall.hogwarts.ceshiren.com/'
启动
#打包
bash -x util/package.sh
#清理环境
bash -x bin/reset.sh
#部署
bash -x bin/deploy.sh
界面
前台页面
http://litemall.hogwarts.ceshiren.com/vue/index.html#/
后台页面