Skip to content

Commit f6c44e1

Browse files
committed
fix: fixing issues reported in 2.18.0 release
1 parent cac7f2e commit f6c44e1

File tree

1 file changed

+59
-23
lines changed

1 file changed

+59
-23
lines changed

static/scripts/install-nim-bundle.sh

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ NGINX_PLUS_VERSION="latest"
3434
NIM_SM_VERSION="latest"
3535
CLICKHOUSE_VERSION="latest"
3636
CLICKHOUSE_LATEST_VERSION="24.9.2.42"
37-
NGINX_LATEST_VERSION=1.25.5-1
38-
NIM_LATEST_VERSION=2.18.0
37+
NGINX_LATEST_VERSION=1.27.3-1
38+
NIM_LATEST_VERSION=2.19.0
3939
CURRENT_TIME=$(date +%s)
4040
TEMP_DIR="/tmp/${CURRENT_TIME}"
4141
TARGET_DISTRIBUTION=""
4242
PACKAGE_INSTALLER=""
4343
NMS_NGINX_MGMT_BLOCK="mgmt { \n usage_report endpoint=127.0.0.1 interval=30m; \n ssl_verify off; \n}";
44-
44+
NIM_FQDN=""
4545

4646
# Added to account for the renaming of the adc dimension from application to app.
4747
if [ -f "/usr/share/nms/catalogs/dimensions/application.yml" ]; then
@@ -117,7 +117,9 @@ fi
117117

118118
createNginxMgmtFile(){
119119
# Check if the mgmt block exists in the file
120-
if grep -Eq '^[[:space:]]*#mgmt' "/etc/nginx/nginx.conf"; then
120+
if grep -Eq '^[[:space:]]*mgmt' "/etc/nginx/nginx.conf"; then
121+
printf "nginx management found, skipping adding nginx mgmt block"
122+
elif grep -Eq '^[[:space:]]*#mgmt' "/etc/nginx/nginx.conf"; then
121123
printf "nginx management block disabled, enabling mgmt block"
122124
sed -i '/#mgmt {/,/#}/d' /etc/nginx/nginx.conf
123125
# shellcheck disable=SC2059
@@ -335,24 +337,30 @@ installBundleForDebianDistro() {
335337
debian_install_clickhouse
336338
debian_install_nim
337339
if [ "${USE_SM_MODULE}" == "true" ]; then
338-
printf "Installing security module...\n"
339-
if [ "${NIM_SM_VERSION}" == "latest" ]; then
340-
apt-get install -y nms-sm
341-
check_last_command_status "apt-get install -y nms-sm" $?
340+
nim_major_version=$(nms-core --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | awk -F. '{print $1}')
341+
nim_minor_version=$(nms-core --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | awk -F. '{print $1}')
342+
if [[ $nim_major_version -ge 2 && $nim_minor_version -ge 19 ]]; then
343+
echo "Warning: NIM version >=2.19.0 comes with security module installed already. skipping installing security module"
342344
else
343-
sm_pkg_version=$(findVersionForPackage "nms-sm" "${NIM_SM_VERSION}")
344-
cmd_status=$?
345-
if [ $cmd_status -ne 0 ]; then
346-
echo "Package nms-sm with version ${NIM_SM_VERSION} not found"
347-
exit $cmd_status
345+
printf "Installing security module...\n"
346+
if [ "${NIM_SM_VERSION}" == "latest" ]; then
347+
apt-get install -y nms-sm
348+
check_last_command_status "apt-get install -y nms-sm" $?
349+
else
350+
sm_pkg_version=$(findVersionForPackage "nms-sm" "${NIM_SM_VERSION}")
351+
cmd_status=$?
352+
if [ $cmd_status -ne 0 ]; then
353+
echo "Package nms-sm with version ${NIM_SM_VERSION} not found"
354+
exit $cmd_status
355+
fi
356+
apt-get install -y nms-sm="${sm_pkg_version}"
357+
check_last_command_status "apt-get install -y nms-sm=${NIM_SM_VERSION}" $?
348358
fi
349-
apt-get install -y nms-sm="${sm_pkg_version}"
350-
check_last_command_status "apt-get install -y nms-sm=${NIM_SM_VERSION}" $?
359+
systemctl restart nms
360+
sleep 5
361+
systemctl restart nginx
362+
systemctl start nms-sm
351363
fi
352-
systemctl restart nms
353-
sleep 5
354-
systemctl restart nginx
355-
systemctl start nms-sm
356364
else
357365
systemctl restart nms
358366
sleep 5
@@ -495,10 +503,15 @@ install_nim_online(){
495503
PACKAGE_INSTALLER="rpm"
496504
installBundleForRPMDistro
497505
generate
506+
498507
else
499508
printf "Unsupported distribution"
500509
exit 1
501510
fi
511+
if [[ -n ${NIM_FQDN} ]] ; then
512+
/etc/nms/scripts/certs.sh ${NIM_FQDN}
513+
fi
514+
curl -s -o /dev/null --cert ${NGINX_CERT_PATH} --key ${NGINX_CERT_KEY_PATH} "https://pkgs.nginx.com/nms/?using_install_script=true&app=nim&mode=online"
502515
}
503516

504517
printUsageInfo(){
@@ -519,6 +532,24 @@ printUsageInfo(){
519532
exit 0
520533
}
521534

535+
printSupportedOS(){
536+
echo "This script can be run on the following operating systems
537+
[-d distribution (ubuntu20.04,ubuntu22.04,ubuntu24.04,debian11,debian12,centos8,rhel8,rhel9,oracle7,oracle8,amzn2)] [-h print help]"
538+
printf "\n ubuntu20.04(focal)"
539+
printf "\n ubuntu22.04()"
540+
printf "\n ubuntu24.04()"
541+
printf "\n debian11()"
542+
printf "\n debian12()"
543+
printf "\n centos8"
544+
printf "\n "
545+
printf "\n "
546+
printf "\n "
547+
printf "\n "
548+
printf "\n "
549+
printf "\n "
550+
exit 0
551+
}
552+
522553
check_NIM_status(){
523554
sleep 5
524555
GREEN='\033[0;32m'
@@ -641,7 +672,7 @@ This action deletes all files in the following directories: /etc/nms , /etc/ngin
641672
fi
642673
}
643674

644-
OPTS_STRING="k:c:m:d:i:s:p:n:hv:t:j:r"
675+
OPTS_STRING="k:c:m:d:i:s:p:n:hv:t:j:rf:"
645676
while getopts ${OPTS_STRING} opt; do
646677
case ${opt} in
647678
c)
@@ -692,13 +723,17 @@ while getopts ${OPTS_STRING} opt; do
692723
r)
693724
UNINSTALL_NIM="true"
694725
;;
726+
f)
727+
NIM_FQDN=${OPTARG}
728+
;;
695729
h)
696-
printUsageInfo
697730
printUsageInfo
698731
exit 0
699-
printUsageInfo
700-
exit 0
701732
;;
733+
l)
734+
printSupportedOS
735+
exit 0
736+
;;
702737
:)
703738
echo "Option -${OPTARG} requires an argument."
704739
exit 1
@@ -968,5 +1003,6 @@ else
9681003
echo "Provided install path ${INSTALL_PATH} doesn't exists"
9691004
exit 1
9701005
fi
1006+
curl -s -o /dev/null --cert ${NGINX_CERT_PATH} --key ${NGINX_CERT_KEY_PATH} "https://pkgs.nginx.com/nms/?using_install_script=true&app=nim&mode=online"
9711007
fi
9721008
fi

0 commit comments

Comments
 (0)