github.com/polarismesh/polaris@v1.17.8/release/standalone/build_standalone.sh (about)

     1  #!/bin/bash
     2  
     3  
     4  INNER_GOOS=${GOOS}
     5  INNER_GOARCH=${GOARCH}
     6  INNER_SERVER_VERSION=${SERVER_VERSION}
     7  INNER_CONSOLE_VERSION=${CONSOLE_VERSION}
     8  INNER_LIMITER_VERSION=${LIMITER_VERSION}
     9  
    10  set -e
    11  workdir=${WORKDIR}
    12  
    13  if [ ${INNER_GOOS} == "kubernetes" ]; then
    14      # ---------------------- 出简单 kubernetes 安装包 ----------------------
    15      cd ${workdir}
    16      cd release/cluster
    17  
    18      sed -i "s/##POLARIS_SERVER_VERSION##/${INNER_SERVER_VERSION}/g" kubernetes/03-polaris-server.yaml
    19      sed -i "s/##POLARIS_CONSOLE_VERSION##/${INNER_CONSOLE_VERSION}/g" kubernetes/03-polaris-server.yaml
    20      sed -i "s/##POLARIS_PROMETHEUS_VERSION##/${INNER_SERVER_VERSION}/g" kubernetes/05-prometheus.yaml
    21      sed -i "s/##POLARIS_LIMITER_VERSION##/${INNER_LIMITER_VERSION}/g" kubernetes/07-polaris-limiter.yaml
    22  
    23      DIR_NAME=polaris-cluster-release_${INNER_SERVER_VERSION}.${INNER_GOOS}
    24      mkdir ${DIR_NAME}
    25      pushd ${DIR_NAME}
    26      cp -rf ../kubernetes/* ./
    27      popd
    28  
    29      PACKAGE_NAME=${DIR_NAME}.zip
    30      zip -r ${PACKAGE_NAME} ${DIR_NAME}
    31      rm -rf ${DIR_NAME}
    32      mv ${PACKAGE_NAME} ../../
    33  
    34      # ---------------------- 出 docker-compose 安装包 ----------------------
    35      cd ${workdir}
    36      cd release/standalone
    37  
    38      cp -rf ../../store/mysql/scripts/* docker-compose/mysql/
    39  
    40      sed -i "s/##POLARIS_SERVER_VERSION##/${INNER_SERVER_VERSION}/g" docker-compose/docker-compose.yaml
    41      sed -i "s/##POLARIS_CONSOLE_VERSION##/${INNER_CONSOLE_VERSION}/g" docker-compose/docker-compose.yaml
    42      sed -i "s/##POLARIS_PROMETHEUS_VERSION##/${INNER_SERVER_VERSION}/g" docker-compose/docker-compose.yaml
    43      sed -i "s/##POLARIS_LIMITER_VERSION##/${INNER_LIMITER_VERSION}/g" docker-compose/docker-compose.yaml
    44  
    45      DOCKER_COMPOSE_DIR_NAME=polaris-standalone-release_${INNER_SERVER_VERSION}.docker-compose
    46      mkdir ${DOCKER_COMPOSE_DIR_NAME}
    47      pushd ${DOCKER_COMPOSE_DIR_NAME}
    48      cp -rf ../docker-compose/* ./
    49      popd
    50  
    51      DOCKER_COMPOSE_PACKAGE_NAME=${DOCKER_COMPOSE_DIR_NAME}.zip
    52      zip -r ${DOCKER_COMPOSE_PACKAGE_NAME} ${DOCKER_COMPOSE_DIR_NAME}
    53      rm -rf ${DOCKER_COMPOSE_DIR_NAME}
    54      mv ${DOCKER_COMPOSE_PACKAGE_NAME} ../../
    55  
    56      # ---------------------- 出 helm 安装包 ----------------------
    57      cd ${workdir}
    58      cd release/cluster
    59  
    60      sed -i "s/##POLARIS_SERVER_VERSION##/${INNER_SERVER_VERSION}/g" helm/values.yaml
    61      sed -i "s/##POLARIS_CONSOLE_VERSION##/${INNER_CONSOLE_VERSION}/g" helm/values.yaml
    62      sed -i "s/##POLARIS_PROMETHEUS_VERSION##/${INNER_SERVER_VERSION}/g" helm/values.yaml
    63      sed -i "s/##POLARIS_LIMITER_VERSION##/${INNER_LIMITER_VERSION}/g" helm/values.yaml
    64  
    65      HELM_DIR_NAME=polaris-cluster-release_${INNER_SERVER_VERSION}.helm
    66      mkdir ${HELM_DIR_NAME}
    67      pushd ${HELM_DIR_NAME}
    68      cp -rf ../helm/* ./
    69      popd
    70  
    71      HELM_PACKAGE_NAME=${HELM_DIR_NAME}.zip
    72      zip -r ${HELM_PACKAGE_NAME} ${HELM_DIR_NAME}
    73      rm -rf ${HELM_DIR_NAME}
    74      mv ${HELM_PACKAGE_NAME} ../
    75  else
    76      cd release/standalone
    77      
    78      POLARIS_GIT_PATH=https://github.com/polarismesh
    79      
    80      DIR_NAME=polaris-standalone-release_${INNER_SERVER_VERSION}.${INNER_GOOS}.${INNER_GOARCH}
    81      
    82      mkdir ${DIR_NAME}
    83      pushd ${DIR_NAME}
    84      
    85      SERVER_PKG_NAME=polaris-server-release_${INNER_SERVER_VERSION}.${INNER_GOOS}.${INNER_GOARCH}.zip
    86      wget -T10 -t3 ${POLARIS_GIT_PATH}/polaris/releases/download/${INNER_SERVER_VERSION}/${SERVER_PKG_NAME} --no-check-certificate
    87      
    88      CONSOLE_PKG_NAME=polaris-console-release_${INNER_CONSOLE_VERSION}.${INNER_GOOS}.${INNER_GOARCH}.zip
    89      wget -T10 -t3 ${POLARIS_GIT_PATH}/polaris-console/releases/download/${INNER_CONSOLE_VERSION}/${CONSOLE_PKG_NAME} --no-check-certificate
    90      
    91      LIMITER_PKG_NAME=polaris-limiter-release_${INNER_LIMITER_VERSION}.${INNER_GOOS}.${INNER_GOARCH}.zip
    92      wget -T10 -t3 ${POLARIS_GIT_PATH}/polaris-limiter/releases/download/${INNER_LIMITER_VERSION}/${LIMITER_PKG_NAME} --no-check-certificate
    93      
    94      if [ ${INNER_GOOS} == "windows" ]; then
    95          wget -T10 -t3 https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometheus-2.28.0.${INNER_GOOS}-${INNER_GOARCH}.zip --no-check-certificate
    96          wget -T10 -t3 https://github.com/prometheus/pushgateway/releases/download/v1.6.0/pushgateway-1.6.0.${INNER_GOOS}-${INNER_GOARCH}.zip --no-check-certificate
    97          mv ../${INNER_GOOS}/install.bat ./install.bat
    98          mv ../${INNER_GOOS}/install-windows.ps1 ./install-windows.ps1
    99          mv ../${INNER_GOOS}/uninstall.bat ./uninstall.bat
   100          mv ../${INNER_GOOS}/uninstall-windows.ps1 ./uninstall-windows.ps1
   101          mv ../port.properties ./port.properties
   102      else
   103          wget -T10 -t3 https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometheus-2.28.0.${INNER_GOOS}-${INNER_GOARCH}.tar.gz --no-check-certificate
   104          wget -T10 -t3 https://github.com/prometheus/pushgateway/releases/download/v1.6.0/pushgateway-1.6.0.${INNER_GOOS}-${INNER_GOARCH}.tar.gz --no-check-certificate
   105          mv ../${INNER_GOOS}/install.sh ./install.sh
   106          mv ../${INNER_GOOS}/uninstall.sh ./uninstall.sh
   107          mv ../port.properties ./port.properties
   108          mv ../prometheus-help.sh ./prometheus-help.sh
   109      fi
   110      echo "${INNER_GOARCH}" > arch.txt
   111      popd
   112      PACKAGE_NAME=${DIR_NAME}.zip
   113      zip -r ${PACKAGE_NAME} ${DIR_NAME}
   114      rm -rf ${DIR_NAME}
   115      mv ${PACKAGE_NAME} ../../
   116      echo ::set-output name=name::${PACKAGE_NAME}
   117  fi