From 6bfbfdc2a901902fa51bdd2247518f0bb2b9a728 Mon Sep 17 00:00:00 2001 From: "aravind.est" Date: Tue, 19 Mar 2024 15:08:20 +0000 Subject: [PATCH] Cleanup ChartMuseum to use v0.16.1 ChartMuseum version fixed to v0.16.1 ChartMuseum cleaned up as part of uninstall Issue-ID: NONRTRIC-992 Change-Id: I556c3ada7cd80b7a97da326f4cb135d38df70a1e Signed-off-by: aravind.est --- scripts/install/README.md | 2 +- scripts/install/install-base.sh | 21 ++++++++++++++++----- scripts/install/uninstall-all.sh | 13 +++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/scripts/install/README.md b/scripts/install/README.md index 3862e13..8102976 100755 --- a/scripts/install/README.md +++ b/scripts/install/README.md @@ -18,7 +18,7 @@ The installation scripts do not handle the required installations listed below. > **"dev"** mode installation can be used to deploy snapshot images of rApp Manager and DME Participant. To initiate the dev mode installation, provide "dev" as an argument when executing the script. -All the components can be installed as shown below, +All the components can be installed as shown below("sudo" is necessary when the user lacks root privileges.), ```./install-all.sh``` (or) ```./install-all.sh dev``` diff --git a/scripts/install/install-base.sh b/scripts/install/install-base.sh index cee2211..a3d75df 100755 --- a/scripts/install/install-base.sh +++ b/scripts/install/install-base.sh @@ -2,7 +2,7 @@ # ============LICENSE_START=============================================== # Copyright (C) 2023 Nordix Foundation. All rights reserved. -# Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved. +# Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved. # ======================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,10 +25,21 @@ snap install helm --classic HELM_VERSION=$(helm version --short) echo "Helm version $HELM_VERSION installed." -echo "Installing chartmuseum..." -curl https://raw.githubusercontent.com/helm/chartmuseum/main/scripts/get-chartmuseum | bash -CHART_MUSEUM_VERSION=$(helm version --short) -echo "Chartmuseum version $CHART_MUSEUM_VERSION is installed." +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +CM_VERSION="v0.16.1" +CM_PORT="8879" +HELM_LOCAL_REPO="$ROOT_DIR/chartstorage" + +echo "Installing ChartMuseum binary..." +pushd /tmp +wget https://get.helm.sh/chartmuseum-$CM_VERSION-linux-amd64.tar.gz +tar xvfz chartmuseum-$CM_VERSION-linux-amd64.tar.gz +sudo mv /tmp/linux-amd64/chartmuseum /usr/local/bin/chartmuseum +popd + +echo "Starting ChartMuseum on port $CM_PORT..." +nohup chartmuseum --port=$CM_PORT --storage="local" --context-path=/charts --storage-local-rootdir=$HELM_LOCAL_REPO >/dev/null 2>&1 & +echo $! > $ROOT_DIR/CM_PID.txt echo "Install yq..." snap install yq diff --git a/scripts/install/uninstall-all.sh b/scripts/install/uninstall-all.sh index 33a0dff..3963254 100755 --- a/scripts/install/uninstall-all.sh +++ b/scripts/install/uninstall-all.sh @@ -20,6 +20,7 @@ echo "######### Uninstalling Rapp Manager #########" +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" echo "Uninstalling ACM Components..." helm uninstall csit-policy -n default @@ -39,6 +40,18 @@ helm uninstall istiod -n istio-system helm uninstall istio-base -n istio-system kubectl delete ns istio-system +# Cleanup ChartMuseum +CM_PID_FILE="$ROOT_DIR/CM_PID.txt" +if [ -f $CM_PID_FILE ]; then + echo "Cleaning up ChartMuseum..." + PID=$(cat "$CM_PID_FILE") + echo "Killing ChartMuseum with PID $PID" + kill $PID + rm $CM_PID_FILE + echo "ChartMuseum cleanup completed" +fi + +rm -rf "$ROOT_DIR/chartstorage" rm -rf dep/ rm -rf docker/ -- 2.16.6