From d26a828a40613272f3286cb7fb2f89c8ae78e0ce Mon Sep 17 00:00:00 2001 From: Ark74 Date: Tue, 5 Dec 2023 01:49:21 -0600 Subject: [PATCH] add titles and style --- opensearch-node-installer.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/opensearch-node-installer.sh b/opensearch-node-installer.sh index ec2703b..86484a0 100644 --- a/opensearch-node-installer.sh +++ b/opensearch-node-installer.sh @@ -30,6 +30,11 @@ NL="$(printf '\n ')" printwc() { printf "%b$2%b" "$1" "${Color_Off}" } +print_title() { + printwc "${Blue}" "\n#--------------------------------------------------" + printwc "${Blue}" "\n# $1" + printwc "${Blue}" "\n#--------------------------------------------------\n" +} install_if_not() { if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | \ grep -c "ok installed")" == "1" ]; then @@ -88,7 +93,7 @@ fi apt-get update -q2 # Test RAM size (4GB min) + CPUs (min 2) -#Check system resources +print_title "Check system resources" printf "\n\nVerifying System Resources:" if [ "$(nproc --all)" -lt 2 ];then printf "\nWarning!: The system do not meet the minimum CPU" @@ -134,7 +139,8 @@ printf '\nThis server will likely have issues due the lack of resources.\n' printf '>>> We highly recommend to increase resources of this server. <<<\n' fi sleep .1 -# Set domain + +print_title "Set CA domain" while [ "$ANS_DMN" != "yes" ] do read -p "> Set your CA domain (or subdomain) here: $NL" -r DOMAIN @@ -165,13 +171,15 @@ else fi fi sleep .1 -# Check & install docker -install_if_not docker.io -install_if_not docker-compose +print_title "Set system vm.max_map_count." sysctl -w vm.max_map_count="$max_map_count" set_once_hash_comment "vm.max_map_count=$max_map_count" "/etc/sysctl.conf" +print_title "Install and setup Docker" +install_if_not docker.io +install_if_not docker-compose + mkdir -p "$OPNSDIR" docker pull "$opens_fts" BCRYPT_HASH="$(docker run --rm -it $opens_fts \ @@ -295,13 +303,13 @@ networks: #[1] https://github.com/opensearch-project/performance-analyzer YML_DOCKER_COMPOSE -# Prepare certs +print_title "Prepare certs" create_certs "$DOMAIN" # Set permissions chmod 744 -R $OPNSDIR -# Launch docker-compose +print_title "Launch opensearch via docker-compose" cd $OPNSDIR docker-compose up -d @@ -331,4 +339,5 @@ docker-compose exec fts_os-node \ docker logs $fts_node -printwc "$Green" "\n\nYou can now use: \"http://${INDEX_USER}:${OPNSREST}@localhost:9200\"\n" +printwc "$Green" "\n\nYou can now use: " +printwc "$Cyan" "'http://${INDEX_USER}:${OPNSREST}@localhost:9200'\n"