From 6e0e62b943af6859d0060d2c7e19a59a9ab33ce2 Mon Sep 17 00:00:00 2001 From: xietangxin Date: Sat, 27 May 2023 08:58:40 +0800 Subject: [PATCH] add download gopher by os arch and version --- README.md | 13 ++- deploy/download_offline_res.sh | 182 +++++++++++++++++++-------------- 2 files changed, 116 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index b86bac9..cd40787 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,12 @@ gala-ops还依赖一些开源软件,包括kafka、arangodb、prometheus等。 ## gala-ops系统安装 Gala提供了集成式部署工具[Gala-Deploy-Tools](./deploy)以便用户快速部署gala-gopher、gala-ops(gala-spider/gala-inference/gala-anteater)组件、kafka/prometheus/arangodb/es/logstash/pyroscope中间件、grafana前端页面展示相关组件,并同时支持离线/在线部署两种模式。 +- kafka 用于传输 gala 软件数据 +- prometheus 用于存储 gopher metrics数据 +- arangodb 用于存储 gala-spider 生成的实时拓扑数据 +- elasticsearch/logstash 存储 gala 数据支持 grafana 前端展示 +- pyroscope 存储 gopher 火焰图数据 +- grafana 展示 gala 前端页面 ### 约束限制 @@ -233,10 +239,13 @@ sh deploy.sh middleware -K <部署节点管理IP> -P /dev/null) - if [ "$OS_VERSION" == "openEuler-22.03-LTS-SP1" ] ; then - REMOTE_REPO_PREFIX="$REMOTE_REPO_PREFIX/$OS_VERSION" - elif [ "$OS_VERSION" == "openEuler-22.03-LTS" ] ; then - REMOTE_REPO_PREFIX="$REMOTE_REPO_PREFIX/openEuler-22.03-LTS-SP1" - elif [ "$OS_VERSION" == "openEuler-20.03-LTS-SP1" ] ; then - REMOTE_REPO_PREFIX="$REMOTE_REPO_PREFIX/$OS_VERSION" +# use OS_TYPE OS_VERSION config yum repo +function config_remote_repo() { + if [ "x$OS_TYPE" == "xopenEuler" ] ; then + if [ "$OS_VERSION" == "openEuler-22.03-LTS-SP1" ] ; then + REMOTE_REPO_PREFIX="$REMOTE_ALIYUN_REPO_PREFIX/$OS_VERSION" + elif [ "$OS_VERSION" == "openEuler-22.03-LTS" ] ; then + REMOTE_REPO_PREFIX="$REMOTE_ALIYUN_REPO_PREFIX/openEuler-22.03-LTS-SP1" + elif [ "$OS_VERSION" == "openEuler-20.03-LTS-SP1" ] ; then + REMOTE_REPO_PREFIX="$REMOTE_ALIYUN_REPO_PREFIX/$OS_VERSION" + else + echo_err_exit "Unsupported openEuler version, aborting!" + fi + elif [ "x$OS_TYPE" == "xkylin" ] ; then + [ ${OS_ARCH} != "x86_64" ] && echo_err_exit "Unsupported on Kylin aarch64" + + OS_VERSION="$OS_TYPE" + REMOTE_REPO_PREFIX="$REMOTE_ALIYUN_REPO_PREFIX/openEuler-20.03-LTS-SP1" else - echo_err_exit "Unsupported openEuler version, aborting!" + echo_err_exit "Unsupport OS type, aborting" fi } @@ -296,16 +307,30 @@ function detect_os() { OS_TYPE=$(cat /etc/os-release | grep '^ID=' | awk -F '\"' '{print $2}') [ -z "$OS_TYPE" ] && echo_err_exit "Unsupport OS type, aborting!" - if [ "x$OS_TYPE" == "xopenEuler" ] ; then - detect_openEuler_version - elif [ "x$OS_TYPE" == "xkylin" ] ; then - [ $(uname -m) != "x86_64" ] && echo_err_exit "Unsupported on Kylin aarch64" + OS_VERSION=$(cat /etc/openEuler-latest | head -n1 | awk -F= '{print $2}' 2> /dev/null) - OS_VERSION="$OS_TYPE" - REMOTE_REPO_PREFIX="$REMOTE_REPO_PREFIX/openEuler-20.03-LTS-SP1" + config_remote_repo +} + +function parse_arg_gopher() { + if [ $# -ne 3 ];then + echo_err_exit "download gopher param err" + fi + + if [ $2 == "kylin" ];then + OS_TYPE="kylin" else - echo_err_exit "Unsupport OS type, aborting" + OS_TYPE="openEuler" fi + OS_VERSION=$2 + + if [ $3 == "aarch64" ] || [ $3 == "x86_64" ]; then + OS_ARCH=$3 + else + echo_err_exit "no support \"$3\" arch" + fi + + config_remote_repo } detect_os @@ -314,6 +339,9 @@ case "x$component" in xgopher) DOWNLOAD_COMPONENT_LIST="${DOWNLOAD_COMPONENT_LIST}gopher " DOWNLOAD_DIR=$DOWNLOAD_DIR_GOPHER + if [ $# -gt 1 ]; then + parse_arg_gopher $@ + fi ;; xops) DOWNLOAD_COMPONENT_LIST="${DOWNLOAD_COMPONENT_LIST}ops " -- Gitee