Skip to content

Commit e2088f2

Browse files
authored
Add hardware recommendation check (#30)
1 parent a64f1c5 commit e2088f2

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

install.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,50 @@ migrate_host_based_voi_setup() {
553553
fi
554554
}
555555

556+
check_minimum_recommendations() {
557+
if [[ ${headless_install} -eq 1 ]]; then
558+
## Allow headless install to skip telemetry name setup in case people bring their own wallets / use CI
559+
return
560+
fi
561+
562+
echo "Checking system requirements.."
563+
echo ""
564+
565+
num_cores=$(lscpu | grep "^CPU(s):" | awk '{print $2}')
566+
567+
total_memory=$(grep MemTotal /proc/meminfo | awk '{print $2}')
568+
569+
# Check if the number of cores is less than 4 and less (8 GB * 0.8) memory. Reported memory from
570+
# /proc/meminfo prints out accessible memory, not total memory. We use 80% of the total memory as an approximation,
571+
# intentionally going too low to allow variability from various cloud providers.
572+
if [[ ${num_cores} -lt 4 || ${total_memory} -lt 6710886 ]]; then
573+
echo "Voi Swarm recommends at least 4 CPU cores and 8 GB of memory to run effectively."
574+
echo "Your system has ${num_cores} CPU cores and $((total_memory / 1024 / 1024)) GB of accessible memory."
575+
echo ""
576+
echo "If you are unable to meet these requirements, you can still proceed. However, it may not"
577+
echo "be as beneficial to the network or to you, as your node won't be able to earn rewards effectively."
578+
echo ""
579+
echo "If you are running this on a cloud provider, you can consider upgrading your instance to"
580+
echo "meet the recommended requirements."
581+
echo ""
582+
echo "Read more about other options for running a node on:"
583+
echo " - https://voinetwork.github.io/voi-swarm/getting-started/introduction/"
584+
echo ""
585+
echo "Find other ways to contribute to the network by joining the Voi Network Discord:"
586+
echo " - https://discord.com/invite/vnFbrJrHeW"
587+
echo ""
588+
# shellcheck disable=SC2162
589+
read -p "Type 'acknowledged' when you're ready to continue: " prompt
590+
while [[ ${prompt} != "acknowledged" ]]
591+
do
592+
# shellcheck disable=SC2162
593+
read -p "Type 'acknowledged' to continue: " prompt
594+
done
595+
else
596+
echo "Your system meets the minimum requirements to run Voi Swarm effectively."
597+
fi
598+
}
599+
556600
if [ -z "${BASH_VERSION:-}" ]; then
557601
abort "Bash is required to interpret this script."
558602
fi
@@ -590,6 +634,8 @@ fi
590634

591635
display_banner "Welcome to Voi Swarm. Let's get started!"
592636

637+
check_minimum_recommendations
638+
593639
get_telemetry_name
594640

595641
set_telemetry_name

0 commit comments

Comments
 (0)