Skip to content

Commit

Permalink
feat: 支持安装arm架构proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
chalice-1831 committed Oct 17, 2024
1 parent 8ebfc53 commit 491130d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 6 deletions.
5 changes: 3 additions & 2 deletions apps/node_man/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ class PolicyRollBackType:
]

TOOLS_TO_PUSH_TO_PROXY: List[Dict[str, Union[List[str], Any]]] = [
{"files": ["py36.tgz"], "name": _("检测 BT 分发策略(下发Py36包)")},
{"files": ["py36-x86_64.tgz", "py36-aarch64.tgz"], "name": _("检测 BT 分发策略(下发Py36包)")},
{
"files": [
"ntrights.exe",
Expand All @@ -1120,7 +1120,8 @@ class PolicyRollBackType:
"handle.exe",
"unixdate.exe",
"tcping.exe",
"nginx-portable.tgz",
"nginx-portable-x86_64.tgz",
"nginx-portable-aarch64.tgz",
],
"name": _("下发安装工具"),
},
Expand Down
18 changes: 17 additions & 1 deletion script_tools/agent_tools/agent2/setup_proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
# vim:ft=sh expandtab sts=4 ts=4 sw=4 nu
# gse proxy 2.0 安装脚本, 仅在节点管理2.0中使用

get_cpu_arch () {
local cmd=$1
CPU_ARCH=$($cmd)
CPU_ARCH=$(echo ${CPU_ARCH} | tr 'A-Z' 'a-z')
if [[ "${CPU_ARCH}" =~ "x86_64" ]]; then
return 0
elif [[ "${CPU_ARCH}" =~ "x86" || "${CPU_ARCH}" =~ ^i[3456]86 ]]; then
return 1
elif [[ "${CPU_ARCH}" =~ "aarch" ]]; then
return 0
else
return 1
fi
}
get_cpu_arch "uname -p" || get_cpu_arch "uname -m" || fail get_cpu_arch "Failed to get CPU arch or unsupported CPU arch, please contact the developer."

NODE_TYPE=proxy
PROC_LIST=(agent data file)
GSE_AGENT_RUN_DIR=/var/run/gse
Expand Down Expand Up @@ -877,7 +893,7 @@ DEBUG_LOG_FILE=${TMP_DIR}/nm.${0##*/}.${TASK_ID}.debug

# 获取包名
PKG_NAME=${NAME}-${VERSION}.tgz
COMPLETE_DOWNLOAD_URL="${DOWNLOAD_URL}/agent/linux/x86_64/"
COMPLETE_DOWNLOAD_URL="${DOWNLOAD_URL}/agent/linux/${CPU_ARCH}/"
GSE_AGENT_CONFIG_PATH="${AGENT_SETUP_PATH}/etc/${GSE_AGENT_CONFIG}"

# redirect STDOUT & STDERR to DEBUG
Expand Down
Binary file added script_tools/nginx-portable-aarch64.tgz
Binary file not shown.
Binary file added script_tools/nginx-portable-x86_64.tgz
Binary file not shown.
19 changes: 18 additions & 1 deletion script_tools/setup_proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
# gse proxy安装脚本, 仅在节点管理2.0中使用

# DEFAULT DEFINITION

get_cpu_arch () {
local cmd=$1
CPU_ARCH=$($cmd)
CPU_ARCH=$(echo ${CPU_ARCH} | tr 'A-Z' 'a-z')
if [[ "${CPU_ARCH}" =~ "x86_64" ]]; then
return 0
elif [[ "${CPU_ARCH}" =~ "x86" || "${CPU_ARCH}" =~ ^i[3456]86 ]]; then
return 1
elif [[ "${CPU_ARCH}" =~ "aarch" ]]; then
return 0
else
return 1
fi
}
get_cpu_arch "uname -p" || get_cpu_arch "uname -m" || fail get_cpu_arch "Failed to get CPU arch or unsupported CPU arch, please contact the developer."

GSE_COMPARE_VERSION="1.7.2"
NODE_TYPE=proxy
PKG_NAME=gse_${NODE_TYPE}-linux-x86_64.tgz
PKG_NAME=gse_${NODE_TYPE}-linux-${CPU_ARCH}.tgz
BACKUP_CONFIG_FILES=("procinfo.json")

GSE_AGENT_RUN_DIR=/var/run/gse
Expand Down
22 changes: 20 additions & 2 deletions script_tools/start_nginx.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
get_cpu_arch () {
local cmd=$1
CPU_ARCH=$($cmd)
CPU_ARCH=$(echo ${CPU_ARCH} | tr 'A-Z' 'a-z')
if [[ "${CPU_ARCH}" =~ "x86_64" ]]; then
return 0
elif [[ "${CPU_ARCH}" =~ "x86" || "${CPU_ARCH}" =~ ^i[3456]86 ]]; then
return 1
elif [[ "${CPU_ARCH}" =~ "aarch" ]]; then
return 0
else
return 1
fi
}
get_cpu_arch "uname -p" || get_cpu_arch "uname -m" || fail get_cpu_arch "Failed to get CPU arch or unsupported CPU arch, please contact the developer."

/opt/nginx-portable/nginx-portable stop || :;
rm -rf /opt/nginx-portable/;
rm -rf /opt/py36/;
tar xvf %(nginx_path)s/py36.tgz -C /opt;
tar xvf %(nginx_path)s/nginx-portable.tgz -C /opt;

tar xvf %(nginx_path)s/py36-${CPU_ARCH}.tgz -C /opt;
tar xvf %(nginx_path)s/nginx-portable-${CPU_ARCH}.tgz -C /opt;

timeout 120 chmod -R 755 %(nginx_path)s || echo "chmod directory %(nginx_path)s failed"
user=root
group=root
Expand Down

0 comments on commit 491130d

Please sign in to comment.