Browse Source

优化部署文件

dev-lc
chenzhihang 1 year ago
parent
commit
afe3650e9e
4 changed files with 38 additions and 7 deletions
  1. +7
    -1
      k8s/build-java.sh
  2. +9
    -3
      k8s/build.sh
  3. +1
    -1
      k8s/build_and_deploy.sh
  4. +21
    -2
      k8s/deploy.sh

+ 7
- 1
k8s/build-java.sh View File

@@ -6,8 +6,14 @@ baseDir="/home/somuns/ci4s"
#判断$1是否为all,如果是,则编译所有模块,否则只编译management-platform模块 #判断$1是否为all,如果是,则编译所有模块,否则只编译management-platform模块
if [ "$1" == "all" ]; then if [ "$1" == "all" ]; then
buildDir=$baseDir buildDir=$baseDir
else
elif [ "$1" == "manage"]
buildDir="$baseDir/ruoyi-modules/management-platform" buildDir="$baseDir/ruoyi-modules/management-platform"
elif [ "$1" == "auth"]
buildDir="$baseDir/ruoyi-auth"
elif [ "$1" == "gateway"]
buildDir="$baseDir/ruoyi-gateway"
elif [ "$1" == "system"]
buildDir="$baseDir/ruoyi-modules/ruoyi-system"
fi fi


echo "Building $buildDir" echo "Building $buildDir"


+ 9
- 3
k8s/build.sh View File

@@ -30,7 +30,7 @@ done
echo "branch: $branch" echo "branch: $branch"
echo "service: $service" echo "service: $service"


valid_services=("manage-front" "manage" "front" "all")
valid_services=("manage-front" "manage" "front" "all" "auth" "gateway" "system")
if [[ ! " ${valid_services[@]} " =~ " $service " ]]; then if [[ ! " ${valid_services[@]} " =~ " $service " ]]; then
echo "Invalid service name: $service" >&2 echo "Invalid service name: $service" >&2
echo "Valid services are: ${valid_services[*]}" echo "Valid services are: ${valid_services[*]}"
@@ -107,13 +107,19 @@ compile_java() {
fi fi
} }


if [ "$service" == "manage-front" ] || [ "$service" == "front" ]; then
if [ "$service" == "front" ]; then
# 编译前端 # 编译前端
compile_front compile_front
fi fi


if [ "$service" == "manage-front" ]; then
# 编译前端
compile_front
# 编译java
compile_java "manage"
fi


if [ "$service" == "manage-front" ] || [ "$service" == "manage" ]; then
if [ "$service" != "manage-front" ] || [ "$service" != "all" ] || [ "$service" != "front" ]; then
# 编译java # 编译java
compile_java $service compile_java $service
fi fi


+ 1
- 1
k8s/build_and_deploy.sh View File

@@ -35,7 +35,7 @@ while getopts "b:s:e:h" opt; do
esac esac
done done


valid_services=("manage-front" "manage" "front" "all")
valid_services=("manage-front" "manage" "front" "all" "auth" "gateway" "system")
if [[ ! " ${valid_services[@]} " =~ " $service " ]]; then if [[ ! " ${valid_services[@]} " =~ " $service " ]]; then
echo "Invalid service name: $service" >&2 echo "Invalid service name: $service" >&2
echo "Valid services are: ${valid_services[*]}" echo "Valid services are: ${valid_services[*]}"


+ 21
- 2
k8s/deploy.sh View File

@@ -129,15 +129,34 @@ build_and_deploy() {
deploy_service ${yaml_file} deploy_service ${yaml_file}
} }


if [ "$service" == "front" ]; then
build_and_deploy "nginx-dockerfile" "172.20.32.187/ci4s/ci4s-front:${tag}" "k8s-12front.yaml"
fi

# 构建和部署 manage 服务 # 构建和部署 manage 服务
if [ "$service" == "manage-front" ] || [ "$service" == "manage" ]; then
if [ "$service" == "manage" ]; then
build_and_deploy "managent-dockerfile" "172.20.32.187/ci4s/ci4s-managent:${tag}" "k8s-7management.yaml" build_and_deploy "managent-dockerfile" "172.20.32.187/ci4s/ci4s-managent:${tag}" "k8s-7management.yaml"
fi fi


if [ "$service" == "auth" ]; then
#部署认证中心
build_and_deploy "auth-dockerfile" "172.20.32.187/ci4s/ci4s-auth:${tag}" "k8s-5auth.yaml"
fi

if [ "$service" == "gateway" ]; then
#部署网关
build_and_deploy "gateway-dockerfile" "172.20.32.187/ci4s/ci4s-gateway:${tag}" "k8s-4gateway.yaml"
fi

if [ "$service" == "system" ]; then
#部署系统服务
build_and_deploy "system-dockerfile" "172.20.32.187/ci4s/ci4s-system:${tag}" "k8s-6system.yaml"
fi


# 构建和部署 front 服务 # 构建和部署 front 服务
if [ "$service" == "manage-front" ] || [ "$service" == "front" ]; then
if [ "$service" == "manage-front" ]; then
build_and_deploy "nginx-dockerfile" "172.20.32.187/ci4s/ci4s-front:${tag}" "k8s-12front.yaml" build_and_deploy "nginx-dockerfile" "172.20.32.187/ci4s/ci4s-front:${tag}" "k8s-12front.yaml"
build_and_deploy "managent-dockerfile" "172.20.32.187/ci4s/ci4s-managent:${tag}" "k8s-7management.yaml"
fi fi






Loading…
Cancel
Save