From 46fa4b4fbfe9184354c02db948f8b472a1945c09 Mon Sep 17 00:00:00 2001 From: rajesh bejjanki Date: Mon, 24 Feb 2025 11:34:01 +0530 Subject: [PATCH 1/8] fix: fixing nim dependency on keepalived --- static/scripts/install-nim-bundle.sh | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index 9707437f4..9c4d0ba02 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -691,6 +691,39 @@ This action deletes all files in the following directories: /etc/nms , /etc/ngin fi } +download_third_party_dependencies(){ + if cat /etc/*-release | grep -iq 'debian\|ubuntu'; then + if echo "${target_distribution}" | grep -iq 'debian\|ubuntu'; then + mkdir "${TEMP_DIR}/${target_distribution}/keepalived" + apt-get install --download-only -o Dir::Cache="${TEMP_DIR}/${target_distribution}/keepalived" keepalived + else + if command -v docker >/dev/null 2>&1; then + mkdir "${TEMP_DIR}/${target_distribution}/keepalived" + docker run --rm -it -v "${TEMP_DIR}/${target_distribution}/keepalived":/downloads fedora dnf download --resolve --destdir=/downloads keepalived + else + echo "Cross platform packing requires docker, please install docker and then try again" + fi + fi + elif cat /etc/*-release | grep -iq 'centos\|fedora\|rhel\|Amazon Linux'; then + if echo "${target_distribution}" | grep -iq 'centos\|fedora\|rhel\|Amazon Linux'; then + mkdir "${TEMP_DIR}/${target_distribution}/keepalived" + yumdownloader --destdir="${TEMP_DIR}/${target_distribution}/keepalived" --resolve keepalived + else + if command -v docker >/dev/null 2>&1; then + mkdir -p "${TEMP_DIR}/keepalived" + docker run --rm -it -v "${TEMP_DIR}/keepalived":/tmp/nim ubuntu bash -c "apt-get update && mkdir -p /tmp/nim && apt-get install -y --download-only -o Dir::Cache=\"/tmp/nim\" keepalived" + mkdir "${TEMP_DIR}/${target_distribution}/keepalived" + mv "${TEMP_DIR}/keepalived/archives/*" "${TEMP_DIR}/${target_distribution}/keepalived" + else + echo "Cross platform packing requires docker, please install docker and then try again" + fi + fi + else + printf "Unsupported distribution" + exit 1 + fi +} + OPTS_STRING="k:c:m:d:i:s:p:n:hv:t:j:rf:l" while getopts ${OPTS_STRING} opt; do case ${opt} in @@ -932,6 +965,7 @@ else url_file_download "$file_to_download" "$save_path" echo "Downloaded NGINX Instance Manager package - $save_path" done + download_third_party_dependencies bundle_file="nim-${NIM_VERSION}-${target_distribution}.tar.gz" echo -n "Creating NGINX Instance Manager install bundle ... ${bundle_file}" cp ${NGINX_CERT_PATH} "${TEMP_DIR}/${target_distribution}/nginx-repo.crt" @@ -965,6 +999,11 @@ else DEBIAN_FRONTEND=noninteractive dpkg -i "$pkg_clickhouse_srv" check_last_command_status "dpkg -i \"$pkg_clickhouse_srv\"" $? done + if [ -d "${TEMP_DIR}/keepalived" ]; then + echo "installing keepalived from ${TEMP_DIR}/keepalived" + DEBIAN_FRONTEND=noninteractive dpkg -i "${TEMP_DIR}/keepalived/*.deb" + check_last_command_status "dpkg -i \"$pkg_nim\"" $? + fi for pkg_nim in "${TEMP_DIR}"/nms-instance-manager*.deb; do echo "Installing NGINX Instance Manager from ${pkg_nim}" DEBIAN_FRONTEND=noninteractive dpkg -i "$pkg_nim" @@ -999,6 +1038,12 @@ else echo "Installing clickhouse dependencies from ${pkg_clickhouse}" yum localinstall -y -v --disableplugin=subscription-manager --skip-broken "$pkg_clickhouse_srv" done + if [ -d "${TEMP_DIR}/keepalived" ]; then + echo "installing keepalived from ${TEMP_DIR}/keepalived" + yum localinstall -y -v --disableplugin=subscription-manager --skip-broken "${TEMP_DIR}/keepalived/*.rpm" + DEBIAN_FRONTEND=noninteractive dpkg -i "${TEMP_DIR}/keepalived/*.deb" + check_last_command_status "dpkg -i yum localinstall -y -v --disableplugin=subscription-manager --skip-broken ${TEMP_DIR}/keepalived/*.rpm" $? + fi for pkg_nim in "${TEMP_DIR}"/nms-instance-manager*.rpm; do echo "Installing NGINX Instance Manager from ${pkg_nim}" yum localinstall -y -v --disableplugin=subscription-manager --skip-broken "$pkg_nim" From 0a86459b620daf2bef0c259f47cacd09e27e40bb Mon Sep 17 00:00:00 2001 From: rajesh bejjanki Date: Mon, 24 Feb 2025 13:27:27 +0530 Subject: [PATCH 2/8] fix: fixing nim dependency on keepalived --- static/scripts/install-nim-bundle.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index 9c4d0ba02..2be212ac9 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -702,6 +702,7 @@ download_third_party_dependencies(){ docker run --rm -it -v "${TEMP_DIR}/${target_distribution}/keepalived":/downloads fedora dnf download --resolve --destdir=/downloads keepalived else echo "Cross platform packing requires docker, please install docker and then try again" + exit 1 fi fi elif cat /etc/*-release | grep -iq 'centos\|fedora\|rhel\|Amazon Linux'; then @@ -716,6 +717,7 @@ download_third_party_dependencies(){ mv "${TEMP_DIR}/keepalived/archives/*" "${TEMP_DIR}/${target_distribution}/keepalived" else echo "Cross platform packing requires docker, please install docker and then try again" + exit 1 fi fi else From cb80e65f638a07d51bfe857b75fe9530f08db850 Mon Sep 17 00:00:00 2001 From: rajesh bejjanki Date: Mon, 24 Feb 2025 14:26:30 +0530 Subject: [PATCH 3/8] fix: fixing rpm pkg name typo --- static/scripts/install-nim-bundle.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index 2be212ac9..bd34ad834 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -1004,7 +1004,7 @@ else if [ -d "${TEMP_DIR}/keepalived" ]; then echo "installing keepalived from ${TEMP_DIR}/keepalived" DEBIAN_FRONTEND=noninteractive dpkg -i "${TEMP_DIR}/keepalived/*.deb" - check_last_command_status "dpkg -i \"$pkg_nim\"" $? + check_last_command_status "dpkg -i ${TEMP_DIR}/keepalived/*.deb" $? fi for pkg_nim in "${TEMP_DIR}"/nms-instance-manager*.deb; do echo "Installing NGINX Instance Manager from ${pkg_nim}" @@ -1043,7 +1043,7 @@ else if [ -d "${TEMP_DIR}/keepalived" ]; then echo "installing keepalived from ${TEMP_DIR}/keepalived" yum localinstall -y -v --disableplugin=subscription-manager --skip-broken "${TEMP_DIR}/keepalived/*.rpm" - DEBIAN_FRONTEND=noninteractive dpkg -i "${TEMP_DIR}/keepalived/*.deb" + DEBIAN_FRONTEND=noninteractive dpkg -i "${TEMP_DIR}/keepalived/*.rpm" check_last_command_status "dpkg -i yum localinstall -y -v --disableplugin=subscription-manager --skip-broken ${TEMP_DIR}/keepalived/*.rpm" $? fi for pkg_nim in "${TEMP_DIR}"/nms-instance-manager*.rpm; do From 61e9ce2ee556286d615d14789a99987d9c8d955b Mon Sep 17 00:00:00 2001 From: rajesh bejjanki Date: Mon, 24 Feb 2025 18:46:43 +0530 Subject: [PATCH 4/8] fix: fixing rpm pkg name typo --- static/scripts/install-nim-bundle.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index bd34ad834..3ebd2090e 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -1043,7 +1043,6 @@ else if [ -d "${TEMP_DIR}/keepalived" ]; then echo "installing keepalived from ${TEMP_DIR}/keepalived" yum localinstall -y -v --disableplugin=subscription-manager --skip-broken "${TEMP_DIR}/keepalived/*.rpm" - DEBIAN_FRONTEND=noninteractive dpkg -i "${TEMP_DIR}/keepalived/*.rpm" check_last_command_status "dpkg -i yum localinstall -y -v --disableplugin=subscription-manager --skip-broken ${TEMP_DIR}/keepalived/*.rpm" $? fi for pkg_nim in "${TEMP_DIR}"/nms-instance-manager*.rpm; do From 0cae1cc1d33ba0c54a83bee5e61594b2ea8499e5 Mon Sep 17 00:00:00 2001 From: rajesh bejjanki Date: Mon, 24 Feb 2025 19:07:56 +0530 Subject: [PATCH 5/8] fix: fixing keepalived folders --- static/scripts/install-nim-bundle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index 3ebd2090e..aadf7f6a0 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -972,7 +972,7 @@ else echo -n "Creating NGINX Instance Manager install bundle ... ${bundle_file}" cp ${NGINX_CERT_PATH} "${TEMP_DIR}/${target_distribution}/nginx-repo.crt" cp ${NGINX_CERT_KEY_PATH} "${TEMP_DIR}/${target_distribution}/nginx-repo.key" - tar -zcf "$bundle_file" -C "${TEMP_DIR}/${target_distribution}" . + tar -zcf "$bundle_file" -C "${TEMP_DIR}/${target_distribution}/" . echo -e "\nSuccessfully created the NGINX Instance Manager bundle - $bundle_file" 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=offline" From 4ba95f7310ac8aaf7e667927485e752e19735cf6 Mon Sep 17 00:00:00 2001 From: rajesh bejjanki Date: Wed, 26 Feb 2025 23:34:12 +0530 Subject: [PATCH 6/8] fix: fixing keepalived dependency issue --- static/scripts/install-nim-bundle.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index aadf7f6a0..95e8d0f27 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -714,7 +714,7 @@ download_third_party_dependencies(){ mkdir -p "${TEMP_DIR}/keepalived" docker run --rm -it -v "${TEMP_DIR}/keepalived":/tmp/nim ubuntu bash -c "apt-get update && mkdir -p /tmp/nim && apt-get install -y --download-only -o Dir::Cache=\"/tmp/nim\" keepalived" mkdir "${TEMP_DIR}/${target_distribution}/keepalived" - mv "${TEMP_DIR}/keepalived/archives/*" "${TEMP_DIR}/${target_distribution}/keepalived" + mv ${TEMP_DIR}/keepalived/archives/* ${TEMP_DIR}/${target_distribution}/keepalived else echo "Cross platform packing requires docker, please install docker and then try again" exit 1 @@ -1003,7 +1003,7 @@ else done if [ -d "${TEMP_DIR}/keepalived" ]; then echo "installing keepalived from ${TEMP_DIR}/keepalived" - DEBIAN_FRONTEND=noninteractive dpkg -i "${TEMP_DIR}/keepalived/*.deb" + DEBIAN_FRONTEND=noninteractive dpkg -i ${TEMP_DIR}/keepalived/*.deb check_last_command_status "dpkg -i ${TEMP_DIR}/keepalived/*.deb" $? fi for pkg_nim in "${TEMP_DIR}"/nms-instance-manager*.deb; do From 995fb1ffa6453c4c99e19d22a3930891290af6ed Mon Sep 17 00:00:00 2001 From: Mike Jang <3287976+mjang@users.noreply.github.com> Date: Thu, 27 Feb 2025 06:30:41 -0800 Subject: [PATCH 7/8] Apply suggestions from code review --- static/scripts/install-nim-bundle.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index d3274c883..cc53ac81e 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -707,7 +707,7 @@ download_third_party_dependencies(){ mkdir "${TEMP_DIR}/${target_distribution}/keepalived" docker run --rm -it -v "${TEMP_DIR}/${target_distribution}/keepalived":/downloads fedora dnf download --resolve --destdir=/downloads keepalived else - echo "Cross platform packing requires docker, please install docker and then try again" + echo "Cross platform packing requires Docker, please install Docker and try again" exit 1 fi fi @@ -722,7 +722,7 @@ download_third_party_dependencies(){ mkdir "${TEMP_DIR}/${target_distribution}/keepalived" mv ${TEMP_DIR}/keepalived/archives/* ${TEMP_DIR}/${target_distribution}/keepalived else - echo "Cross platform packing requires docker, please install docker and then try again" + echo "Cross platform packing requires Docker, please install Docker and try again" exit 1 fi fi @@ -1008,7 +1008,7 @@ else check_last_command_status "dpkg -i \"$pkg_clickhouse_srv\"" $? done if [ -d "${TEMP_DIR}/keepalived" ]; then - echo "installing keepalived from ${TEMP_DIR}/keepalived" + echo "Installing keepalived from ${TEMP_DIR}/keepalived" DEBIAN_FRONTEND=noninteractive dpkg -i ${TEMP_DIR}/keepalived/*.deb check_last_command_status "dpkg -i ${TEMP_DIR}/keepalived/*.deb" $? fi @@ -1047,7 +1047,7 @@ else yum localinstall -y -v --disableplugin=subscription-manager --skip-broken "$pkg_clickhouse_srv" done if [ -d "${TEMP_DIR}/keepalived" ]; then - echo "installing keepalived from ${TEMP_DIR}/keepalived" + echo "Installing keepalived from ${TEMP_DIR}/keepalived" yum localinstall -y -v --disableplugin=subscription-manager --skip-broken "${TEMP_DIR}/keepalived/*.rpm" check_last_command_status "dpkg -i yum localinstall -y -v --disableplugin=subscription-manager --skip-broken ${TEMP_DIR}/keepalived/*.rpm" $? fi From 2479872f58bbdadf125b92e4949199d8cb16b15a Mon Sep 17 00:00:00 2001 From: Mike Jang <3287976+mjang@users.noreply.github.com> Date: Thu, 27 Feb 2025 06:52:47 -0800 Subject: [PATCH 8/8] Apply suggestions from code review --- static/scripts/install-nim-bundle.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/scripts/install-nim-bundle.sh b/static/scripts/install-nim-bundle.sh index cc53ac81e..10e3e6612 100755 --- a/static/scripts/install-nim-bundle.sh +++ b/static/scripts/install-nim-bundle.sh @@ -707,7 +707,7 @@ download_third_party_dependencies(){ mkdir "${TEMP_DIR}/${target_distribution}/keepalived" docker run --rm -it -v "${TEMP_DIR}/${target_distribution}/keepalived":/downloads fedora dnf download --resolve --destdir=/downloads keepalived else - echo "Cross platform packing requires Docker, please install Docker and try again" + echo "Cross platform packing requires Docker. Please install Docker and try again." exit 1 fi fi @@ -722,7 +722,7 @@ download_third_party_dependencies(){ mkdir "${TEMP_DIR}/${target_distribution}/keepalived" mv ${TEMP_DIR}/keepalived/archives/* ${TEMP_DIR}/${target_distribution}/keepalived else - echo "Cross platform packing requires Docker, please install Docker and try again" + echo "Cross platform packing requires Docker. Please install Docker and try again." exit 1 fi fi