mirror of
https://github.com/jeequan/jeepay
synced 2024-11-17 14:58:04 +08:00
修改部署脚本文件;
This commit is contained in:
parent
56405fa3d2
commit
74647ed060
@ -1,13 +1,12 @@
|
||||
#! /bin/sh
|
||||
#exec 2>>build.log ##编译过程打印到日志文件中
|
||||
## 自动构建,并下载基础文件 .Power by terrfly
|
||||
## 一键启动jeepay服务,包含mysqlDB/MQ/redis/javaservice/nginx .Power by terrfly
|
||||
|
||||
#引入config
|
||||
. ./config.sh
|
||||
|
||||
# 需要注意:
|
||||
# 1. root用户登录
|
||||
# 2. 请务必包含 docker环境 和 git环境
|
||||
if [ $UID != '0' ]; then
|
||||
echo 'ERROR: 请使用root用户安装(Please install using root user)!'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 第0步:提示信息
|
||||
echo "请确认当前是全新服务器安装, 是否继续?"
|
||||
@ -20,6 +19,44 @@ then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 检查 配置文件是否存在
|
||||
if ! [ -f "./config.sh" ]; then
|
||||
echo '下载默认配置文件。'
|
||||
yum install -y wget && wget -O config.sh https://gitee.com/jeequan/jeepay/raw/dev/docs/install/config.sh
|
||||
fi
|
||||
|
||||
#引入config
|
||||
chmod 777 ./config.sh
|
||||
. ./config.sh
|
||||
|
||||
|
||||
# 第0步:提示信息
|
||||
echo "检查配置信息是否正确(配置内容在 config.sh文件):"
|
||||
echo "【项目根目录的地址】: $rootDir"
|
||||
echo "【mysql root密码】: $mysql_pwd"
|
||||
echo " [yes/no] ?"
|
||||
read useryes
|
||||
if [ -z "$useryes" ] || [ $useryes != 'yes' ]
|
||||
then
|
||||
echo 'good bye'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 检查 git
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
echo 'install git...'
|
||||
yum install -y git
|
||||
fi
|
||||
|
||||
# 检查 docker环境
|
||||
if ! [ -x "$(command -v docker)" ]; then
|
||||
echo 'install docker...'
|
||||
yum install -y yum-utils && yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
||||
yum makecache && yum install -y docker-ce
|
||||
systemctl restart docker && systemctl enable docker
|
||||
fi
|
||||
|
||||
|
||||
# 第1步:创建基本目录
|
||||
echo "[1] 创建项目根目录($rootDir).... "
|
||||
mkdir $rootDir/nginx -p
|
||||
@ -50,16 +87,22 @@ echo "[1] Done. "
|
||||
echo "[2] 拉取项目源代码文件.... "
|
||||
cd $rootDir/sources
|
||||
git clone https://gitee.com/jeequan/jeepay.git
|
||||
cd jeepay && git checkout -b dev origin/dev # TODO 这个在发布master后可删除。
|
||||
echo "[2] Done. "
|
||||
|
||||
#源码中install.sh文件目录
|
||||
sourcesInstallPath=$rootDir/sources/jeepay/docs/install
|
||||
|
||||
|
||||
# 创建一个 bridge网络
|
||||
docker network create jeepay-net
|
||||
|
||||
# 第3步:下载mysql官方镜像 & 启动
|
||||
echo "[3] 下载并启动mysql容器.... "
|
||||
echo "提示: 如下载进度缓慢,建议配置阿里云或其他镜像加速服务。 "
|
||||
|
||||
# 将Mysql的配置文件复制到对应的映射目录下
|
||||
cd $currentPath && cp ./include/my.cnf $rootDir/mysql/config/my.cnf
|
||||
cd $sourcesInstallPath && cp ./include/my.cnf $rootDir/mysql/config/my.cnf
|
||||
|
||||
# 镜像启动
|
||||
docker run -p 3306:3306 --name mysql8 --network=jeepay-net \
|
||||
@ -74,7 +117,7 @@ docker run -p 3306:3306 --name mysql8 --network=jeepay-net \
|
||||
# 容器重启
|
||||
docker restart mysql8
|
||||
|
||||
# 避免未启动完成或出现错误: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
|
||||
# 避免未启动完成或出现错误: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
|
||||
echo "等待重启mysql容器....... "
|
||||
sleep 10
|
||||
|
||||
@ -89,7 +132,7 @@ echo "[3] Done. "
|
||||
echo "[4] 下载并启动redis容器.... "
|
||||
|
||||
# 将配置文件复制到对应的映射目录下
|
||||
cd $currentPath && cp ./include/redis.conf $rootDir/redis/config/redis.conf
|
||||
cd $sourcesInstallPath && cp ./include/redis.conf $rootDir/redis/config/redis.conf
|
||||
|
||||
# 镜像启动
|
||||
docker run -p 6379:6379 --name redis6 --network=jeepay-net \
|
||||
@ -115,7 +158,7 @@ docker run -p 8161:8161 -p 61616:61616 --name activemq5 --network=jeepay-net \
|
||||
echo "[5] Done. "
|
||||
|
||||
|
||||
# 第6步:下载并启动 java 项目
|
||||
# 第6步:下载并启动 java 项目
|
||||
|
||||
# 复制java配置文件
|
||||
cd $rootDir/service/configs/ && cp -r $rootDir/sources/jeepay/conf/* .
|
||||
@ -158,7 +201,7 @@ wget https://gitee.com/jeequan/jeepay-ui/releases/download/v1.10.0/html.tar.gz
|
||||
tar -vxf html.tar.gz
|
||||
|
||||
# 将配置文件复制到对应的映射目录下
|
||||
cd $currentPath && cp ./include/nginx.conf $rootDir/nginx/conf/nginx.conf
|
||||
cd $sourcesInstallPath && cp ./include/nginx.conf $rootDir/nginx/conf/nginx.conf
|
||||
|
||||
|
||||
docker run --name nginx118 \
|
||||
|
Loading…
Reference in New Issue
Block a user