Commit 535f54a8 authored by Junling Bu's avatar Junling Bu
Browse files

添加litemall_schema脚本,并且在上传脚本中自动打包数据库相关文件。

parent ee6207c1
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
/litemall-os-api/litemall-os-api.jar /litemall-os-api/litemall-os-api.jar
/litemall-wx-api/litemall-wx-api.jar /litemall-wx-api/litemall-wx-api.jar
/litemall-admin/dist.tar /litemall-admin/dist.tar
/litemall-db/litemall.sql
/litemall-db/litemall_schema.sql
...@@ -9,13 +9,25 @@ ...@@ -9,13 +9,25 @@
3. 使用PuTTY登录云主机 3. 使用PuTTY登录云主机
4. 运行脚本部署运行 4. 如果用户没有部署litemall数据库,可以运行以下命令:
```bash
cd deploy
mysql -h localhost -u root -p123456
source ./litemall-db/litemall_schema.sql
source ./litemall-db/litemall.sql
```
注意,123456是用户所设置的MySQL管理员密码
警告:
> litemall_schema.sql会尝试删除litemall数据库然后重建一个新的数据。
5. 运行脚本部署运行
```bash ```bash
sudo ./deploy/bin/deploy.sh sudo ./deploy/bin/deploy.sh
``` ```
5. 测试部署是否成功 6. 测试部署是否成功
请确保云主机的安全组已经允许相应的端口(见1.5.3.1); 请确保云主机的安全组已经允许相应的端口(见1.5.3.1);
然后测试是否部署成功(xxx.xxx.xxx.xxx是云主机IP): 然后测试是否部署成功(xxx.xxx.xxx.xxx是云主机IP):
...@@ -27,6 +39,12 @@ ...@@ -27,6 +39,12 @@
http://xxx.xxx.xxx.xxx:8080/#/login http://xxx.xxx.xxx.xxx:8080/#/login
``` ```
6. 自动上传脚本 7. 自动上传脚本
为了简化步骤1和步骤2,完成了util/upload.sh脚本,用户需要设置相应的云主机IP和密钥文件路径。
该脚本会自动把当前项目不同模块下的最终部署文件复制到deploy文件夹中,然后上传到云主机。
注意:
> 上传脚本没有自动做Spring Boot项目打包和Vue项目打包工作
> 因此运行该脚本前请确认最终部署文件已经生成。
> 如果用户觉得需要,可以自行在upload.sh脚本中添加相应的编译打包命令。
\ No newline at end of file
为了简化步骤1和步骤2,完成了util/upload.sh脚本,用户需要设置相应的云主机IP和密钥文件路径
\ No newline at end of file
...@@ -19,5 +19,9 @@ cp -f ./litemall-admin-api/target/litemall-admin-api-*.jar ./deploy/litemall-ad ...@@ -19,5 +19,9 @@ cp -f ./litemall-admin-api/target/litemall-admin-api-*.jar ./deploy/litemall-ad
# 压缩litemall-admin应用 # 压缩litemall-admin应用
tar -zcvf ./deploy/litemall-admin/dist.tar -C ./litemall-admin/dist . tar -zcvf ./deploy/litemall-admin/dist.tar -C ./litemall-admin/dist .
# 复制数据库
cp -f ./litemall-db/sql/litemall_schema.sql ./deploy/litemall_db/litemall_schema.sql
cp -f ./litemall-db/sql/litemall.sql ./deploy/litemall_db/litemall.sql
# 上传云主机 # 上传云主机
scp -i $ID_RSA -r ./deploy ubuntu@$CVM:/home/ubuntu/ scp -i $ID_RSA -r ./deploy ubuntu@$CVM:/home/ubuntu/
drop database if exists litemall;
drop user if exists 'litemall'@'localhost';
create database litemall;
use litemall;
create user 'litemall'@'localhost' identified by 'litemall123456';
grant all privileges on litemall.* to 'litemall'@'localhost';
flush privileges;
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment