@@ -6,6 +6,7 @@ voi_home="${HOME}/voi"
6
6
headless_install=0
7
7
is_root=0
8
8
skip_account_setup=0
9
+ migrate_host_based_setup=0
9
10
10
11
execute_sudo () {
11
12
if [[ ${is_root} -eq 1 ]]; then
@@ -449,6 +450,11 @@ join_as_new_user() {
449
450
450
451
account_status=$( execute_docker_command " goal account dump -a ${account_addr} " | jq -r .onl)
451
452
453
+ # # This step is late in the process and does require a restart of the service to take effect.
454
+ # # Container ID from verify_node_running will have to be re-fetched if any use of the node is to be done after this point.
455
+ # # Intentionally not doing this here to avoid confusion.
456
+ migrate_host_based_voi_setup
457
+
452
458
if [[ ${account_status} -eq 1 ]]; then
453
459
display_banner " Welcome to Voi! You are now online!"
454
460
else
@@ -487,6 +493,12 @@ set_telemetry_name() {
487
493
return
488
494
fi
489
495
496
+ detect_existing_host_based_voi_setup
497
+
498
+ if [[ ${migrate_host_based_setup} -eq 1 ]]; then
499
+ return
500
+ fi
501
+
490
502
display_banner " Telemetry"
491
503
492
504
if [[ -z ${VOINETWORK_TELEMETRY_NAME} && ! -f " /var/lib/voi/algod/data/logging.config" ]]; then
@@ -513,6 +525,35 @@ set_telemetry_name() {
513
525
fi
514
526
}
515
527
528
+ detect_existing_host_based_voi_setup () {
529
+ if [[ -f /var/lib/algorand/logging.config && ! -f /var/lib/voi/algod/data/logging.config ]]; then
530
+ echo " An existing Voi installation has been detected on your system."
531
+ echo " We can migrate your existing telemetry configuration to Voi Swarm."
532
+ echo " As part of this process, we will also stop the existing service."
533
+ echo " This is necessary to prevent conflicts and ensure that your node can join Voi Swarm as a healthy node."
534
+ echo " "
535
+ echo " Do you want to migrate your existing setup to Voi Swarm? (yes/no)"
536
+ # shellcheck disable=SC2162
537
+ read -p " Migrate existing setup: " prompt
538
+ while [[ ${prompt} != " yes" && ${prompt} != " no" ]]
539
+ do
540
+ # shellcheck disable=SC2162
541
+ read -p " Type either yes or no: " prompt
542
+ done
543
+ if [[ ${prompt} == " yes" ]]; then
544
+ migrate_host_based_setup=1
545
+ fi
546
+ fi
547
+ }
548
+
549
+ migrate_host_based_voi_setup () {
550
+ if [[ ${migrate_host_based_setup} -eq 1 ]]; then
551
+ display_banner " Migrating from host based setup"
552
+ VOINETWORK_TELEMETRY_NAME=$( execute_sudo " cat /var/lib/algorand/logging.config" | jq -r ' .Name' )
553
+ bash -c " env VOINETWORK_TELEMETRY_NAME=\" ${VOINETWORK_TELEMETRY_NAME} \" ${voi_home} /bin/migrate-from-d13-setup"
554
+ fi
555
+ }
556
+
516
557
if [ -z " ${BASH_VERSION:- } " ]; then
517
558
abort " Bash is required to interpret this script."
518
559
fi
@@ -548,6 +589,8 @@ if [[ -n ${VOINETWORK_SKIP_WALLET_SETUP} && ${VOINETWORK_SKIP_WALLET_SETUP} -eq
548
589
headless_install=1
549
590
fi
550
591
592
+ display_banner " Welcome to Voi Swarm. Let's get started!"
593
+
551
594
get_telemetry_name
552
595
553
596
set_telemetry_name
@@ -669,6 +712,8 @@ if [[ ${skip_account_setup} -eq 0 ]]; then
669
712
else
670
713
generate_participation_key
671
714
715
+ migrate_host_based_voi_setup
716
+
672
717
display_banner " Welcome to Voi!"
673
718
674
719
joined_network_instructions
0 commit comments