add titles and style

This commit is contained in:
Luis Guzmán 2023-12-05 01:49:21 -06:00
parent 48bda8a05f
commit d26a828a40
1 changed files with 17 additions and 8 deletions

View File

@ -30,6 +30,11 @@ NL="$(printf '\n ')"
printwc() { printwc() {
printf "%b$2%b" "$1" "${Color_Off}" printf "%b$2%b" "$1" "${Color_Off}"
} }
print_title() {
printwc "${Blue}" "\n#--------------------------------------------------"
printwc "${Blue}" "\n# $1"
printwc "${Blue}" "\n#--------------------------------------------------\n"
}
install_if_not() { install_if_not() {
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | \ if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | \
grep -c "ok installed")" == "1" ]; then grep -c "ok installed")" == "1" ]; then
@ -88,7 +93,7 @@ fi
apt-get update -q2 apt-get update -q2
# Test RAM size (4GB min) + CPUs (min 2) # Test RAM size (4GB min) + CPUs (min 2)
#Check system resources print_title "Check system resources"
printf "\n\nVerifying System Resources:" printf "\n\nVerifying System Resources:"
if [ "$(nproc --all)" -lt 2 ];then if [ "$(nproc --all)" -lt 2 ];then
printf "\nWarning!: The system do not meet the minimum CPU" 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' printf '>>> We highly recommend to increase resources of this server. <<<\n'
fi fi
sleep .1 sleep .1
# Set domain
print_title "Set CA domain"
while [ "$ANS_DMN" != "yes" ] while [ "$ANS_DMN" != "yes" ]
do do
read -p "> Set your CA domain (or subdomain) here: $NL" -r DOMAIN read -p "> Set your CA domain (or subdomain) here: $NL" -r DOMAIN
@ -165,13 +171,15 @@ else
fi fi
fi fi
sleep .1 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" sysctl -w vm.max_map_count="$max_map_count"
set_once_hash_comment "vm.max_map_count=$max_map_count" "/etc/sysctl.conf" 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" mkdir -p "$OPNSDIR"
docker pull "$opens_fts" docker pull "$opens_fts"
BCRYPT_HASH="$(docker run --rm -it $opens_fts \ BCRYPT_HASH="$(docker run --rm -it $opens_fts \
@ -295,13 +303,13 @@ networks:
#[1] https://github.com/opensearch-project/performance-analyzer #[1] https://github.com/opensearch-project/performance-analyzer
YML_DOCKER_COMPOSE YML_DOCKER_COMPOSE
# Prepare certs print_title "Prepare certs"
create_certs "$DOMAIN" create_certs "$DOMAIN"
# Set permissions # Set permissions
chmod 744 -R $OPNSDIR chmod 744 -R $OPNSDIR
# Launch docker-compose print_title "Launch opensearch via docker-compose"
cd $OPNSDIR cd $OPNSDIR
docker-compose up -d docker-compose up -d
@ -331,4 +339,5 @@ docker-compose exec fts_os-node \
docker logs $fts_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"