@@ -87,7 +87,7 @@ start_docker_swarm() {
87
87
if [[ -n ${VOINETWORK_DOCKER_SWARM_INIT_SETTINGS} ]]; then
88
88
command+=" ${VOINETWORK_DOCKER_SWARM_INIT_SETTINGS} "
89
89
else
90
- command+=" --listen-addr lo --advertise-addr 127.0.0.1 "
90
+ command+=" --listen-addr lo --advertise-addr lo "
91
91
fi
92
92
93
93
execute_sudo " $command "
@@ -102,7 +102,13 @@ start_docker_swarm() {
102
102
}
103
103
104
104
start_stack () {
105
- command=" env VOINETWORK_TELEMETRY_NAME=$VOINETWORK_TELEMETRY_NAME docker stack deploy -c ${voi_home} /docker/compose.yml"
105
+ docker_file=" ${voi_home} /docker/compose.yml"
106
+
107
+ if [[ ${VOINETWORK_PROFILE} == " relay" ]]; then
108
+ echo " Starting relay node stack"
109
+ docker_file=" ${voi_home} /docker/relay.yml"
110
+ fi
111
+ command=" env VOINETWORK_TELEMETRY_NAME=$VOINETWORK_TELEMETRY_NAME docker stack deploy -c ${docker_file} "
106
112
107
113
if [[ -f " ${voi_home} /docker/notification.yml" ]]; then
108
114
command+=" -c ${voi_home} /docker/notification.yml"
@@ -444,7 +450,13 @@ docker_swarm_instructions() {
444
450
echo " To fix this, set VOINETWORK_DOCKER_SWARM_INIT_SETTINGS to the settings you want to use to initialize Docker Swarm and try again."
445
451
echo " Parameters that can be passed to the swarm can be found at: https://docs.docker.com/engine/reference/commandline/swarm_init/"
446
452
echo " "
447
- echo " Join #node-resources on Discord (https://discord.com/invite/vnFbrJrHeW) to engage with the community and get help."
453
+ if [[ ${VOINETWORK_PROFILE} == " relay" ]]; then
454
+ echo " Troubleshoot on your own, and after troubleshooting join #relay-runners on Discord (https://discord.com/invite/vnFbrJrHeW) to engage with the community and get help."
455
+ echo " It's crucial to have a strong grasp of technical details, including the ability to execute commands directly on the server, and access and understand cloud resources and logs. Being self-sufficient and having the ability to debug issues independently are key skills for managing this setup."
456
+ echo " If this is not for you, consider other means to engage with the community and contribute."
457
+ else
458
+ echo " Join #node-resources on Discord (https://discord.com/invite/vnFbrJrHeW) to engage with the community and get help by using the Discord ((https://discord.com/invite/vnFbrJrHeW))."
459
+ fi
448
460
abort " Exiting the program."
449
461
}
450
462
@@ -469,8 +481,7 @@ joined_network_instructions() {
469
481
echo " Account setup skipped. Detected existing account with address: ${account_addr} "
470
482
fi
471
483
472
- echo " "
473
- echo " To see network participation status use ${HOME} /voi/bin/get-node-status"
484
+ echo " To see network participation status use ${HOME} /voi/bin/get-participation-status ${account_addr} "
474
485
echo " To go online use ${HOME} /voi/bin/go-online ${account_addr} "
475
486
fi
476
487
@@ -480,12 +491,23 @@ joined_network_instructions() {
480
491
echo " The network is now catching up and will continue to do so in the background."
481
492
fi
482
493
494
+ if [[ ${VOINETWORK_PROFILE} == " relay" ]]; then
495
+ echo " "
496
+ display_banner " Relay node setup"
497
+ echo " Due to the nature of relay nodes, you will not be able to participate in the consensus network on this server."
498
+ echo " "
499
+ echo " Few things to be mindful of:"
500
+ echo " - *BETA*: Utility commands are available in ${voi_home} /bin, however any that assumes participation will not work."
501
+ echo " - It is your responsibility to monitor the server and ensure it is running smoothly."
502
+ echo " - You're responsible for server security, maintenance, updates, access controls, and monitoring."
503
+ fi
504
+
483
505
echo " "
484
506
echo " To easily access commands from ${HOME} /voi/bin, add the following to ${HOME} /.bashrc or ${HOME} /.profile:"
485
507
echo " export PATH=\"\$ PATH:${HOME} /voi/bin\" "
486
508
echo " "
487
509
488
- if [[ ${skip_account_setup} -eq 0 ]]; then
510
+ if [[ ${skip_account_setup} -eq 0 && ${VOINETWORK_PROFILE} != " relay " ]]; then
489
511
echo " ${bold} *********************************** READ THIS! ***********************************${normal} "
490
512
echo " After joining the network, it might take up to 2 hours for your server to appear on telemetry"
491
513
echo " tracking services. Initially, you can identify your server using the 12-digit short GUID shown by"
@@ -542,17 +564,50 @@ add_docker_groups() {
542
564
}
543
565
544
566
get_telemetry_name () {
567
+ if [[ ${VOINETWORK_PROFILE} == " relay" ]]; then
568
+ return
569
+ fi
570
+
545
571
if [[ -f " /var/lib/voi/algod/data/logging.config" ]]; then
546
572
VOINETWORK_TELEMETRY_NAME=$( execute_sudo " cat /var/lib/voi/algod/data/logging.config" | jq -r ' .Name' )
547
573
fi
548
574
}
549
575
576
+ set_relay_name () {
577
+ if [[ -f " ${voi_home} /relay-name.env" ]]; then
578
+ VOINETWORK_TELEMETRY_NAME=$( grep telemetry-name " ${voi_home} /relay-name.env" | cut -d' =' -f2)
579
+ return
580
+ fi
581
+
582
+ echo " If you are operating a relay node you need to set a relay name in accordance with the naming convention."
583
+ echo " The relay name should be in the format: <your initials>-<provider-code>-<iso-3166-alpha2-country-code>-<supported-iata-airport-code>-<your-chosen-identifier>"
584
+ echo " Example: hs-htz-us-iad-002"
585
+ echo " Supported IATA airport codes can be found here: https://github.com/grafana/grafana/blob/main/public/gazetteer/airports.geojson"
586
+ # shellcheck disable=SC2162
587
+ read -p " Relay name: " VOINETWORK_TELEMETRY_NAME
588
+
589
+ while [[ ${VOINETWORK_TELEMETRY_NAME} == " " ]]
590
+ do
591
+ # shellcheck disable=SC2162
592
+ read -p " Please enter a relay name: " VOINETWORK_TELEMETRY_NAME
593
+ done
594
+
595
+ # This is quite rudimentary, but it's a start. We can add more validation and better structure later. Remember to clean
596
+ # up the file as a migration when this is done.
597
+ echo " telemetry-name=${VOINETWORK_TELEMETRY_NAME} " >> " ${voi_home} " /relay-name.env
598
+ }
599
+
550
600
set_telemetry_name () {
551
601
if [[ ${headless_install} -eq 1 ]]; then
552
602
# # Allow headless install to skip telemetry name setup in case people bring their own wallets / use CI
553
603
return
554
604
fi
555
605
606
+ if [[ ${VOINETWORK_PROFILE} == " relay" ]]; then
607
+ set_relay_name
608
+ return
609
+ fi
610
+
556
611
detect_existing_host_based_setup
557
612
558
613
if [[ ${migrate_host_based_setup} -eq 1 ]]; then
@@ -622,6 +677,16 @@ check_minimum_requirements() {
622
677
return
623
678
fi
624
679
680
+ minimum_cpus=4
681
+ minimum_memory_bytes=6710886
682
+ minimum_memory_gigabytes_pretty=8
683
+
684
+ if [[ -n ${VOINETWORK_PROFILE} && ${VOINETWORK_PROFILE} == " relay" ]]; then
685
+ minimum_cpus=8
686
+ minimum_memory_bytes=15938355
687
+ minimum_memory_gigabytes_pretty=16
688
+ fi
689
+
625
690
echo " Checking system requirements.."
626
691
echo " "
627
692
@@ -632,27 +697,37 @@ check_minimum_requirements() {
632
697
# Check if the number of cores is less than 4 and less (8 GB * 0.8) memory. Reported memory from
633
698
# /proc/meminfo prints out accessible memory, not total memory. We use 80% of the total memory as an approximation,
634
699
# intentionally going too low to allow variability from various cloud providers.
635
- if [[ ${num_cores} -lt 4 || ${total_memory} -lt 6710886 ]]; then
700
+ if [[ ${num_cores} -lt ${minimum_cpus} || ${total_memory} -lt ${minimum_memory_bytes} ]]; then
636
701
echo " *************************************************************************************"
637
702
echo " * ${bold} WARNING: Your system does not meet the minimum requirements to run Voi Swarm effectively.${normal} "
638
703
echo " *************************************************************************************"
639
704
echo " *"
640
705
echo " * Voi Swarm requires at least 4 CPU cores and 8 GB of memory to run effectively."
641
706
echo " *"
642
707
echo " * Your system has:"
643
- echo " * - CPU cores: ${bold}${num_cores}${normal} CPU cores. ${bold} 4${normal} is required."
644
- echo " * - Memory: ${bold} $(( total_memory / 1024 / 1024 )) ${normal} GB of accessible memory. ${bold} 8${normal} GB is required."
645
- echo " *"
646
- echo " * You can still proceed, however, it may not be as beneficial to the network or to you,"
647
- echo " * as your node won't be able to contribute or earn rewards effectively."
648
- echo " * You should ${bold} expect poor performance${normal} , and the community may ${bold} not be able to help${normal} you with issues."
649
- echo " * "
650
- echo " * If you are running this on a cloud provider, you should consider upgrading your instance to"
651
- echo " * meet the requirements."
652
- echo " * "
653
- echo " * Read more about other options for running a node on:"
654
- echo " * - https://voinetwork.github.io/voi-swarm/getting-started/introduction/"
655
- echo " *"
708
+ echo " * - CPU cores: ${bold}${num_cores}${normal} CPU cores. ${bold}${minimum_cpus}${normal} is required."
709
+ echo " * - Memory: ${bold} $(( total_memory / 1024 / 1024 )) ${normal} GB of accessible memory. ${bold}${minimum_memory_gigabytes_pretty}${normal} GB is required."
710
+ if [[ ${VOINETWORK_PROFILE} == " relay" ]]; then
711
+ echo " *"
712
+ echo " * You are running a relay node profile. Relay nodes require at least 8 CPU cores and 16 GB of memory."
713
+ echo " *"
714
+ echo " * Upgrade your system to meet the minimum requirements to run as a relay node."
715
+ echo " *"
716
+ abort " Exiting the program."
717
+ else
718
+ echo " *"
719
+ echo " * You can still proceed, however, it may not be as beneficial to the network or to you,"
720
+ echo " * as your node won't be able to contribute or earn rewards effectively."
721
+ echo " * You should ${bold} expect poor performance${normal} , and the community may ${bold} not be able to help${normal} you with issues."
722
+ echo " * "
723
+ echo " * If you are running this on a cloud provider, you should consider upgrading your instance to"
724
+ echo " * meet the requirements."
725
+ echo " * "
726
+ echo " * Read more about other options for running a node on:"
727
+ echo " * - https://voinetwork.github.io/voi-swarm/getting-started/introduction/"
728
+ echo " *"
729
+ fi
730
+
656
731
echo " * Find other ways to contribute to the network by joining the Voi Network Discord:"
657
732
echo " * - https://discord.com/invite/vnFbrJrHeW"
658
733
echo " *"
@@ -669,6 +744,29 @@ check_minimum_requirements() {
669
744
fi
670
745
}
671
746
747
+ set_profile () {
748
+ mkdir -p " ${voi_home} "
749
+
750
+ # Check if ${voi_home}/profile exists
751
+ if [[ -f " ${voi_home} /profile" ]]; then
752
+ # If it does exist, read the value and save it in the environment variable VOINETWORK_PROFILE
753
+ VOINETWORK_PROFILE=$( cat " ${voi_home} /profile" )
754
+ export VOINETWORK_PROFILE
755
+ else
756
+ # If the file does not exist, check if VOINETWORK_PROFILE is set
757
+ if [[ -z ${VOINETWORK_PROFILE} ]]; then
758
+ # If VOINETWORK_PROFILE is not set, write "participation" to the file for the default profile
759
+ VOINETWORK_PROFILE=" participation"
760
+ echo " participation" > " ${voi_home} /profile"
761
+ else
762
+ # If VOINETWORK_PROFILE is set, write its value to the file
763
+ echo " ${VOINETWORK_PROFILE} " > " ${voi_home} /profile"
764
+ fi
765
+ fi
766
+
767
+ display_banner " Setting up Voi Swarm using profile: ${VOINETWORK_PROFILE} "
768
+ }
769
+
672
770
if [ -z " ${BASH_VERSION:- } " ]; then
673
771
abort " Bash is required to interpret this script."
674
772
fi
685
783
abort " This script is only meant to be run on Debian or Ubuntu."
686
784
fi
687
785
688
- if uname -r | grep -q " Microsoft" ; then
786
+ # shellcheck disable=SC2143
787
+ if [[ $( uname -r | grep -q " Microsoft" ) ]]; then
689
788
abort " WSL 1 is not supported. Please run this script on a native Linux installation (best) or WSL 2 (experimental)."
690
789
fi
691
790
710
809
711
810
display_banner " ${bold} Welcome to Voi Swarm${normal} . Let's get started!"
712
811
812
+ set_profile
813
+
713
814
check_minimum_requirements
714
815
715
816
get_telemetry_name
716
-
717
817
set_telemetry_name
718
818
719
819
display_banner " Installing Docker"
@@ -756,7 +856,10 @@ start_docker_swarm
756
856
if [[ ! -e /var/lib/voi/algod/data ]]; then
757
857
execute_sudo " mkdir -p /var/lib/voi/algod/data"
758
858
fi
759
- mkdir -p " ${voi_home} "
859
+
860
+ if [[ ! -e /var/lib/voi/algod/metrics ]]; then
861
+ execute_sudo " mkdir -p /var/lib/voi/algod/metrics"
862
+ fi
760
863
761
864
display_banner " Fetching the latest Voi Network updates and scripts."
762
865
curl -sSL https://api.github.com/repos/VoiNetwork/voi-swarm/tarball/main --output " ${voi_home} " /voi-swarm.tar.gz
@@ -769,9 +872,11 @@ start_stack
769
872
770
873
wait_for_stack_to_be_ready
771
874
772
- verify_node_is_running
875
+ if [[ ${VOINETWORK_PROFILE} != " relay" ]]; then
876
+ verify_node_is_running
877
+ fi
773
878
774
- if [[ -n ${VOINETWORK_SKIP_WALLET_SETUP} && ${VOINETWORK_SKIP_WALLET_SETUP} -eq 1 ]]; then
879
+ if [[ ${VOINETWORK_PROFILE} == " relay " || ( -n ${VOINETWORK_SKIP_WALLET_SETUP} && ${VOINETWORK_SKIP_WALLET_SETUP} -eq 1 ) ]]; then
775
880
display_banner " Wallet setup will be skipped."
776
881
777
882
joined_network_instructions true
0 commit comments