forked from YaoApp/yao-wms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uat.sh
47 lines (39 loc) · 1.85 KB
/
uat.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# ./deploy.sh 192.168.31.99
VERSION=$(xiang version)
HOST=139.199.30.36
# 清理工作目录
rm -rf .tmp
# 创建工作目录
mkdir -p .tmp/source
git clone [email protected]:YaoApp/warehouse.git .tmp/source
mkdir -p .tmp/source/cloud/bin
# 复制文件
cp ~/Code/bin/xiang-$VERSION-linux-amd64 .tmp/source/cloud/bin/warehouse
cp .tmp/source/cloud/uat.env .tmp/source/cloud/.env
chmod +x .tmp/source/cloud/bin/warehouse
# 删除 Git 目录
rm -rf .tmp/source/.git
rm -rf .tmp/source/db/*
rm -rf .tmp/source/plugins/*
rm -rf .tmp/source/*.sh
# 应用文件打包
cd .tmp/source/cloud && tar cvfz ../../dist.tar.gz . && cd ../../..
# 上传到服务器
scp .tmp/dist.tar.gz [email protected]:/root/dist-warehouse.tar.gz
ssh [email protected] '''rm -rf /data/warehouse'''
ssh [email protected] '''mkdir -p /data/warehouse/logs'''
ssh [email protected] '''mkdir -p /data/warehouse/data'''
ssh [email protected] '''cd /data/warehouse && tar xvfz /root/dist-warehouse.tar.gz'''
ssh [email protected] '''sudo supervisorctl stop warehouse-server >> /dev/null'''
# ssh [email protected] '''sudo supervisorctl stop warehouse-webcam >> /dev/null'''
ssh [email protected] '''sudo rm -rf /etc/supervisor/conf.d/warehouse.conf'''
# ssh [email protected] '''sudo rm -rf /etc/supervisor/conf.d/warehouse-webcam.conf'''
ssh [email protected] '''sudo ln -s /data/warehouse/supervisor/online.conf /etc/supervisor/conf.d/warehouse.conf'''
# ssh [email protected] '''sudo ln -s /data/warehouse/supervisor/webcam.conf /etc/supervisor/conf.d/warehouse-webcam.conf'''
ssh [email protected] '''sudo supervisorctl reload'''
ssh [email protected] '''sudo supervisorctl start warehouse-server >> /dev/null'''
# ssh [email protected] '''sudo supervisorctl start warehouse-webcam >> /dev/null'''
ssh [email protected] '''cd /data/warehouse && ./init.sh'''
# 清理工作目录
rm -rf .tmp