提交 bb83bb24 authored 作者: Andy's avatar Andy

12

上级 3d29a094
#!/bin/bash #!/bin/bash
# 数据库用户密码
# mall
# XXKytcACPX3GbdsH
Install_Dir="/home/deploy/shopec" Install_Dir="/home/deploy/shopec"
production_run_dir="$install_dir/install_projects" production_run_dir="$install_dir/install_projects"
...@@ -8,8 +13,8 @@ production_run_repo="git.wkwork.xyz/root/install_projects.git" ...@@ -8,8 +13,8 @@ production_run_repo="git.wkwork.xyz/root/install_projects.git"
production_server_config_dir="$install_dir/production-server-config" production_server_config_dir="$install_dir/production-server-config"
production_server_config_repo="git.wkwork.xyz/tiktok/production-server-config.git" production_server_config_repo="git.wkwork.xyz/tiktok/production-server-config.git"
production_mysql_dir="$install_dir/production-mysql" # production_mysql_dir="$install_dir/production-mysql"
production_mysql_repo="git.wkwork.xyz/tiktok/production-mysql.git" # production_mysql_repo="git.wkwork.xyz/tiktok/production-mysql.git"
production_install_dir="$production_run_dir/production" production_install_dir="$production_run_dir/production"
...@@ -287,9 +292,9 @@ uninstall_project() { ...@@ -287,9 +292,9 @@ uninstall_project() {
start_project() { start_project() {
cd "$production_install_dir" || exit 1 cd "$production_install_dir" || exit 1
rm nginx/nginx.conf # rm nginx/nginx.conf
rm -rf nginx/nginx.conf # rm -rf nginx/nginx.conf
cp nginx/nginx_clear_mysql.conf nginx/nginx.conf # cp nginx/nginx_clear_mysql.conf nginx/nginx.conf
echo_content "green" "是否要启动/重启 项目?(y/n):" echo_content "green" "是否要启动/重启 项目?(y/n):"
read -r restart read -r restart
...@@ -368,7 +373,7 @@ select_operation() { ...@@ -368,7 +373,7 @@ select_operation() {
echo_content "yellow" "请选择要执行的操作:" echo_content "yellow" "请选择要执行的操作:"
PS3="请输入操作对应的数字:" PS3="请输入操作对应的数字:"
select operation in "更新项目" "启动/重启【项目】" "启动/重启【mysql】" "对外开放【mysql】" "重置容器" "卸载" "退出"; do select operation in "更新项目" "启动/重启【项目】" "重置容器" "卸载" "退出"; do
case $REPLY in case $REPLY in
1) 1)
echo_content "green" "你选择了操作: 更新项目" echo_content "green" "你选择了操作: 更新项目"
...@@ -381,23 +386,8 @@ select_operation() { ...@@ -381,23 +386,8 @@ select_operation() {
start_project start_project
break break
;; ;;
3) 3)
echo_content "green" "你选择了操作: 重启mysql"
cd "$production_install_dir" || exit 1
docker-compose restart mysql
break
;;
4)
echo_content "green" "对外开放【mysql】"
cd "$production_install_dir" || exit 1
rm nginx/nginx.conf
rm -rf nginx/nginx.conf
cp nginx/nginx_open_mysql.conf nginx/nginx.conf
docker-compose rm -sf nginx
docker-compose up -d nginx
break
;;
5)
echo_content "green" "你选择了操作: 重置容器" echo_content "green" "你选择了操作: 重置容器"
echo_content "green" "是否要启动/重启 项目?(y/n):" echo_content "green" "是否要启动/重启 项目?(y/n):"
read -r restart read -r restart
...@@ -408,12 +398,12 @@ select_operation() { ...@@ -408,12 +398,12 @@ select_operation() {
fi fi
exit exit
;; ;;
6) 4)
echo_content "green" "你选择了操作: 卸载" echo_content "green" "你选择了操作: 卸载"
uninstall_project uninstall_project
exit exit
;; ;;
7) 5)
echo_content "green" "你选择了操作: 退出" echo_content "green" "你选择了操作: 退出"
exit exit
;; ;;
...@@ -441,14 +431,14 @@ init_environment_check() { ...@@ -441,14 +431,14 @@ init_environment_check() {
updata_project "$production_run_dir" "production_run" updata_project "$production_run_dir" "production_run"
fi fi
if [ ! -d "$production_mysql_dir/.git" ]; then # if [ ! -d "$production_mysql_dir/.git" ]; then
# 运行相关逻辑,找到匹配项后可立即处理 # # 运行相关逻辑,找到匹配项后可立即处理
echo_content "green" "拉取项目: production_mysql" # echo_content "green" "拉取项目: production_mysql"
echo_content "green" "项目仓库: $production_mysql_repo" # echo_content "green" "项目仓库: $production_mysql_repo"
echo_content "green" "项目目录: $production_mysql_dir" # echo_content "green" "项目目录: $production_mysql_dir"
pull_project "$production_mysql_repo" "$production_mysql_dir" "服务端配置" # pull_project "$production_mysql_repo" "$production_mysql_dir" "服务端配置"
cd "$production_mysql_dir/mysql" # cd "$production_mysql_dir/mysql"
unzip data.zip # unzip data.zip
# else # else
# echo_content "green" "更新项目: production_mysql" # echo_content "green" "更新项目: production_mysql"
# echo_content "green" "项目仓库: $production_mysql_repo" # echo_content "green" "项目仓库: $production_mysql_repo"
...@@ -516,7 +506,8 @@ main() { ...@@ -516,7 +506,8 @@ main() {
# check_git # check_git
# check_unzip # check_unzip
# install_docker # install_docker
check_install_deps() init_environment_check check_install_deps
init_environment_check
select_operation select_operation
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论