This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.py
1664 lines (1507 loc) · 78.2 KB
/
install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
import json
import subprocess
import os
import platform
import time
import readline
import random
import argparse
import sys
from sys import argv
from os import remove
from urllib.request import urlopen
class CustomHelpFormatter(argparse.HelpFormatter):
def _format_action_invocation(self, action):
if not action.option_strings or action.nargs == 0:
return super()._format_action_invocation(action)
return ', '.join(action.option_strings)
def _split_lines(self, text, width):
if text.startswith('R|'):
return text[2:].splitlines()
# this is the RawTextHelpFormatter._split_lines
return argparse.HelpFormatter._split_lines(self, text, width)
cwd = os.getcwd()
def fmt(prog): return CustomHelpFormatter(prog, max_help_position=30)
umee_home = subprocess.run(
["echo $HOME/.umeed"], capture_output=True, shell=True, text=True).stdout.strip()
parser = argparse.ArgumentParser(
description="Umee Installer", formatter_class=fmt)
# automated commands ("auto" group)
auto = parser.add_argument_group('Automated')
auto.add_argument(
'-m',
'--mainnet-default',
action='store_true',
help='R|Use all default settings with no input for mainnet\n ',
dest="mainnetDefault")
auto.add_argument(
'-r',
'--releases',
help='R|Use all default settings with no input for mainnet\n ',
dest="releaseFile")
auto.add_argument(
'-t',
'--testnet-default',
action='store_true',
help='R|Use all default settings with no input for testnet\n ',
dest="testnetDefault")
# mainnet and testnet commands ("both" group)
both = parser.add_argument_group('Mainnet and Testnet')
both.add_argument(
'-s',
'--swap',
type=bool,
default=True,
help='R|Use swap if less than 32Gb RAM are detected \nDefault (bool): True\n ',
dest="swapOn")
both.add_argument(
'-i',
'--install-home',
type=str,
default=umee_home,
help='R|Umee installation location \nDefault: "'+umee_home+'"\n ',
dest="installHome")
both.add_argument(
'-na',
'--name',
type=str,
default="defaultNode",
help='R|Node name \nDefault: "defaultNode"\n ',
dest="nodeName")
portDefault = 'tcp://0.0.0.0:1317;0.0.0.0:9090;0.0.0.0:9091;tcp://127.0.0.1:26658;tcp://127.0.0.1:26657;tcp://0.0.0.0:26656;localhost:6060'
both.add_argument(
'-p',
'--ports',
type=lambda s: [str(item) for item in s.split(';')],
default=portDefault,
help='R|Single string seperated by semicolons of ports. Order must be api, grpc server, grpc web, abci app addr, rpc laddr, p2p laddr, and pprof laddr \nDefault: \"'+portDefault+'\"\n ',
dest="ports")
nodeTypeChoices = ['full', 'client', 'local']
both.add_argument(
'-ty',
'--type',
type=str,
choices=nodeTypeChoices,
default='full',
help='R|Node type \nDefault: "full" '+str(nodeTypeChoices)+'\n ',
dest="nodeType")
networkChoices = ['umee-1', 'umee-test-4']
both.add_argument(
'-n',
'--network',
type=str,
choices=networkChoices,
default='umee-1',
help='R|Network to join \nDefault: "umee-1" '+str(networkChoices)+'\n ',
dest="network")
pruningChoices = ['default', 'nothing', 'everything']
both.add_argument(
'-pr',
'--prune',
type=str,
choices=pruningChoices,
default='everything',
help='R|Pruning settings \nDefault: "everything" ' +
str(pruningChoices)+'\n ',
dest="pruning")
cosmovisorServiceChoices = ['cosmoservice', 'umeeservice', 'noservice']
both.add_argument(
'-cvs',
'--cosmovisor-service',
type=str,
choices=cosmovisorServiceChoices,
default='umeeservice',
help='R|Start with cosmovisor systemctl service, umeed systemctl service, or exit without creating or starting a service \nDefault: "umeeservice" ' +
str(cosmovisorServiceChoices),
dest="cosmovisorService")
# testnet only commands ("testnet" group)
testnet = parser.add_argument_group('Testnet only')
dataSyncTestnetChoices = ['snapshot', 'exit']
testnet.add_argument(
'-dst',
'--data-sync-test',
type=str,
choices=dataSyncTestnetChoices,
default='snapshot',
help='R|Data sync options \nDefault: "snapshot" ' +
str(dataSyncTestnetChoices)+'\n ',
dest="dataSyncTestnet")
snapshotTypeTestnetChoices = ['pruned', 'archive']
testnet.add_argument(
'-stt',
'--snapshot-type-test',
type=str,
choices=snapshotTypeTestnetChoices,
default='pruned',
help='R|Snapshot type \nDefault: "pruned" ' +
str(snapshotTypeTestnetChoices)+'\n ',
dest="snapshotTypeTestnet")
# mainnet only commands ("mainnet" group)
mainnet = parser.add_argument_group('Mainnet only')
dataSyncTypeChoices = ['snapshot', 'genesis', 'exit']
mainnet.add_argument(
'-ds',
'--data-sync',
type=str,
choices=dataSyncTypeChoices,
default='snapshot',
help='R|Data sync options \nDefault: "snapshot" ' +
str(dataSyncTypeChoices)+'\n ',
dest="dataSync")
snapshotTypeChoices = ['pruned', 'default', 'archive', 'infra']
mainnet.add_argument(
'-st',
'--snapshot-type',
type=str,
choices=snapshotTypeChoices,
default='pruned',
help='R|Snapshot type \nDefault: "pruned" '+str(snapshotTypeChoices)+'\n ',
dest="snapshotType")
snapshotLocationChoices = ['netherlands', 'singapore', 'sanfrancisco']
mainnet.add_argument(
'-sl',
'--snapshot-location',
type=str,
choices=snapshotLocationChoices,
default='netherlands',
help='R|Snapshot location \nDefault: "netherlands" ' +
str(snapshotLocationChoices)+'\n ',
dest="snapshotLocation")
replayDbBackendChoices = ['goleveldb', 'rocksdb']
mainnet.add_argument(
'-rdb',
'--replay-db-backend',
type=str,
choices=replayDbBackendChoices,
default='goleveldb',
help='R|Database backend when replaying from genesis\nDefault: "goleveldb" ' +
str(replayDbBackendChoices)+'\n ',
dest="replayDbBackend")
mainnet.add_argument(
'-es',
'--extra-swap',
type=bool,
default=True,
help='R|Use extra swap if less than 64Gb RAM are detected when syncing from genesis\nDefault (bool): True\n ',
dest="extraSwap")
mainnet.add_argument(
'-sr',
'--start-replay',
type=bool,
default=True,
help='R|Immediately start replay on completion\nDefault (bool): True\n ',
dest="startReplay")
parser._optionals.title = 'Optional Arguments'
if not len(sys.argv) > 1:
parser.set_defaults(mainnetDefault=False, testnetDefault=False, swapOn=None, installHome=None, nodeName=None, ports=None, nodeType=None, network=None, pruning=None, cosmovisorService=None,
dataSyncTestnet=None, snapshotTypeTestnet=None, dataSync=None, snapshotType=None, snapshotLocation=None, replayDbBackend=None, extraSwap=None, startReplay=None, releaseFile=None)
args = parser.parse_args()
if args.testnetDefault == True:
args.network = 'umee-test-4'
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def rlinput(prompt, prefill=''):
readline.set_startup_hook(lambda: readline.insert_text(prefill))
try:
return input(prompt)
finally:
readline.set_startup_hook()
def completeCosmovisor():
print(bcolors.OKCYAN +
"Congratulations! You have successfully completed setting up an Umee full node!")
print(bcolors.OKCYAN +
"The cosmovisor service is currently running in the background")
print(bcolors.OKCYAN + "To see the status of cosmovisor, run the following command: 'sudo systemctl status cosmovisor'")
print(bcolors.OKCYAN + "To see the live logs from cosmovisor, run the following command: 'journalctl -u cosmovisor -f'")
print(bcolors.OKCYAN + "In order to use umeed from the cli, either reload your terminal or refresh your profile with: 'source ~/.profile'" + bcolors.ENDC)
quit()
def completeUmeed():
print(bcolors.OKCYAN +
"Congratulations! You have successfully completed setting up an Umee full node!")
print(bcolors.OKCYAN + "The umeed service is currently running in the background")
print(bcolors.OKCYAN + "To see the status of the umee daemon, run the following command: 'sudo systemctl status umeed'")
print(bcolors.OKCYAN + "To see the live logs from the umee daemon, run the following command: 'journalctl -u umeed -f'")
print(bcolors.OKCYAN + "In order to use cosmovisor/umeed from the cli, either reload your terminal or refresh your profile with: 'source ~/.profile'" + bcolors.ENDC)
quit()
def complete():
print(bcolors.OKCYAN +
"Congratulations! You have successfully completed setting up an Umee full node!")
print(bcolors.OKCYAN + "The umeed service is NOT running in the background")
print(bcolors.OKCYAN + "In order to use umeed from the cli, either reload your terminal or refresh your profile with: 'source ~/.profile'")
print(bcolors.OKCYAN + "After reloading your terminal and/or profile, you can start umeed with: 'umeed start'" + bcolors.ENDC)
quit()
def partComplete():
print(bcolors.OKCYAN +
"Congratulations! You have successfully completed setting up the Umee daemon!")
print(bcolors.OKCYAN +
"The umeed service is NOT running in the background, and your data directory is empty")
print(bcolors.OKCYAN + "In order to use umeed from the cli, either reload your terminal or refresh your profile with: 'source ~/.profile'")
print(bcolors.OKCYAN + "If you intend to use umeed without syncing, you must include the '--node' flag after cli commands with the address of a public RPC node" + bcolors.ENDC)
quit()
def clientComplete():
print(bcolors.OKCYAN +
"Congratulations! You have successfully completed setting up an Umee client node!")
print(bcolors.OKCYAN + "DO NOT start the umee daemon. You can query directly from the command line without starting the daemon!")
print(bcolors.OKCYAN + "In order to use umeed from the cli, either reload your terminal or refresh your profile with: 'source ~/.profile'" + bcolors.ENDC)
quit()
def replayComplete():
print(bcolors.OKCYAN +
"Congratulations! You are currently replaying from genesis in a background service!")
print(bcolors.OKCYAN + "To see the status of cosmovisor, run the following command: 'sudo systemctl status cosmovisor'")
print(bcolors.OKCYAN + "To see the live logs from cosmovisor, run the following command: 'journalctl -u cosmovisor -f'")
print(bcolors.OKCYAN + "In order to use umeed from the cli, either reload your terminal or refresh your profile with: 'source ~/.profile'" + bcolors.ENDC)
quit()
def replayDelay():
print(bcolors.OKCYAN +
"Congratulations! Umee is ready to replay from genesis on your command!")
print(bcolors.OKCYAN +
"YOU MUST MANUALLY INCREASE ULIMIT FILE SIZE BEFORE STARTING WITH `ulimit -n 200000`")
print(bcolors.OKCYAN + "In order to use umeed from the cli, either reload your terminal or refresh your profile with: 'source ~/.profile'")
print(bcolors.OKCYAN + "Once reloaded, use the command `cosmosvisor start` to start the replay from genesis process")
print(bcolors.OKCYAN + "It is recommended to run this in a tmux session if not running in a background service")
print(bcolors.OKCYAN + "You must use `cosmosvisor start` and not `umeed start` in order to upgrade automatically" + bcolors.ENDC)
quit()
def localUmeeComplete():
print(bcolors.OKCYAN +
"Congratulations! You have successfully completed setting up a LocalUmee node!")
print(bcolors.OKCYAN + "To start the local network")
print(bcolors.OKCYAN + "Run 'source ~/.profile'")
print(bcolors.OKCYAN + "Ensure docker is running in the background if on linux or start the Docker application if on Mac")
print(bcolors.OKCYAN + "Run 'cd $HOME/LocalUmee'")
print(bcolors.OKCYAN + "Run 'docker-compose up'")
print(bcolors.OKCYAN +
"Run 'umeed status' to check that you are now creating blocks" + bcolors.ENDC)
quit()
def cosmovisorService():
print(bcolors.OKCYAN + "Creating Cosmovisor Service" + bcolors.ENDC)
subprocess.run(["echo '# Setup Cosmovisor' >> "+HOME +
"/.profile"], shell=True, env=my_env)
subprocess.run(["echo 'export DAEMON_NAME=umeed' >> " +
HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["echo 'export DAEMON_HOME="+umee_home +
"' >> "+HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["echo 'export DAEMON_ALLOW_DOWNLOAD_BINARIES=false' >> " +
HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["echo 'export DAEMON_LOG_BUFFER_SIZE=512' >> " +
HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["echo 'export DAEMON_RESTART_AFTER_UPGRADE=true' >> " +
HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["echo 'export UNSAFE_SKIP_BACKUP=true' >> " +
HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["""echo '[Unit]
Description=Cosmovisor daemon
After=network-online.target
[Service]
Environment=\"DAEMON_NAME=umeed\"
Environment=\"DAEMON_HOME=""" + umee_home+"""\"
Environment=\"DAEMON_RESTART_AFTER_UPGRADE=true\"
Environment=\"DAEMON_ALLOW_DOWNLOAD_BINARIES=false\"
Environment=\"DAEMON_LOG_BUFFER_SIZE=512\"
Environment=\"UNSAFE_SKIP_BACKUP=true\"
User =""" + USER+"""
ExecStart="""+HOME+"""/go/bin/cosmovisor start --home """+umee_home+"""
Restart=always
RestartSec=3
LimitNOFILE=infinity
LimitNPROC=infinity
[Install]
WantedBy=multi-user.target
' >cosmovisor.service
"""], shell=True, env=my_env)
subprocess.run(
["sudo mv cosmovisor.service /lib/systemd/system/cosmovisor.service"], shell=True, env=my_env)
subprocess.run(["sudo systemctl daemon-reload"], shell=True, env=my_env)
subprocess.run(["systemctl restart systemd-journald"],
shell=True, env=my_env)
subprocess.run(["clear"], shell=True)
def umeedService():
print(bcolors.OKCYAN + "Creating Umeed Service..." + bcolors.ENDC)
subprocess.run(["""echo '[Unit]
Description=Umee Daemon
After=network-online.target
[Service]
User =""" + USER+"""
ExecStart="""+HOME+"""/go/bin/umeed start --home """+umee_home+"""
Restart=always
RestartSec=3
LimitNOFILE=infinity
LimitNPROC=infinity
Environment=\"DAEMON_HOME="""+umee_home+"""\"
Environment=\"DAEMON_NAME=umeed\"
Environment=\"DAEMON_ALLOW_DOWNLOAD_BINARIES=false\"
Environment=\"DAEMON_RESTART_AFTER_UPGRADE=true\"
Environment=\"DAEMON_LOG_BUFFER_SIZE=512\"
[Install]
WantedBy=multi-user.target
' >umeed.service
"""], shell=True, env=my_env)
subprocess.run(
["sudo mv umeed.service /lib/systemd/system/umeed.service"], shell=True, env=my_env)
subprocess.run(["sudo systemctl daemon-reload"], shell=True, env=my_env)
subprocess.run(["systemctl restart systemd-journald"],
shell=True, env=my_env)
def cosmovisorInit():
print(bcolors.OKCYAN + """Do you want to use Cosmovisor to automate future upgrades?
1) Yes, install cosmovisor and set up background service
2) No, just set up an umeed background service (recommended)
3) Don't install cosmovisor and don't set up a background service
""" + bcolors.ENDC)
if args.cosmovisorService == "cosmoservice":
useCosmovisor = '1'
elif args.cosmovisorService == "umeeservice":
useCosmovisor = '2'
elif args.cosmovisorService == "noservice":
useCosmovisor = '3'
else:
useCosmovisor = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if useCosmovisor == "1":
subprocess.run(["clear"], shell=True)
print(bcolors.OKCYAN + "Setting Up Cosmovisor..." + bcolors.ENDC)
os.chdir(os.path.expanduser(HOME))
subprocess.run(["go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["mkdir -p "+umee_home+"/cosmovisor"],
shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/genesis"], shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/genesis/bin"], shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades"], shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades/v7/bin"], shell=True, env=my_env)
os.chdir(os.path.expanduser(HOME+"/umee"))
subprocess.run(["git checkout v10.0.1"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v7/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run([". "+HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["cp " + GOPATH + "/bin/umeed "+umee_home +
"/cosmovisor/genesis/bin"], shell=True, env=my_env)
cosmovisorService()
subprocess.run(["sudo systemctl start cosmovisor"],
shell=True, env=my_env)
subprocess.run(["clear"], shell=True)
completeCosmovisor()
elif useCosmovisor == "2":
umeedService()
subprocess.run(["sudo systemctl start umeed"], shell=True, env=my_env)
subprocess.run(["clear"], shell=True)
completeUmeed()
elif useCosmovisor == "3":
subprocess.run(["clear"], shell=True)
complete()
else:
subprocess.run(["clear"], shell=True)
cosmovisorInit()
def startReplayNow():
print(bcolors.OKCYAN + """Do you want to start cosmovisor as a background service?
1) Yes, start cosmovisor as a background service and begin replay
2) No, exit and start on my own (will still auto update at upgrade heights)
""" + bcolors.ENDC)
if args.startReplay == True:
startNow = '1'
elif args.startReplay == False:
startNow = '2'
else:
startNow = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if startNow == "1":
subprocess.run(["clear"], shell=True)
cosmovisorService()
subprocess.run(["sudo systemctl start cosmovisor"],
shell=True, env=my_env)
replayComplete()
if startNow == "2":
subprocess.run(["clear"], shell=True)
replayDelay()
else:
subprocess.run(["clear"], shell=True)
startReplayNow()
def replayFromGenesisLevelDb():
print(bcolors.OKCYAN + "Setting Up Cosmovisor..." + bcolors.ENDC)
os.chdir(os.path.expanduser(HOME))
subprocess.run(["go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["mkdir -p "+umee_home+"/cosmovisor"],
shell=True, env=my_env)
subprocess.run(["mkdir -p "+umee_home+"/cosmovisor/genesis"],
shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/genesis/bin"], shell=True, env=my_env)
subprocess.run(["mkdir -p "+umee_home+"/cosmovisor/upgrades"],
shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades/v4/bin"], shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades/v5/bin"], shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades/v7/bin"], shell=True, env=my_env)
os.chdir(os.path.expanduser(HOME+"/umee"))
print(bcolors.OKCYAN + "Preparing v4 Upgrade..." + bcolors.ENDC)
subprocess.run(["git checkout v4.2.0"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v4/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
print(bcolors.OKCYAN + "Preparing v5/v6 Upgrade..." + bcolors.ENDC)
subprocess.run(["git checkout v6.4.1"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v5/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
print(bcolors.OKCYAN + "Preparing v7/v8 Upgrade..." + bcolors.ENDC)
subprocess.run(["git checkout v8.0.0"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v7/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
print(bcolors.OKCYAN + "Preparing v9/v10 Upgrade..." + bcolors.ENDC)
subprocess.run(["git checkout v10.0.1"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v9/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["git checkout v3.1.0"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["make install"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run([". "+HOME+"/.profile"], shell=True, env=my_env)
subprocess.run(["cp " + GOPATH + "/bin/umeed "+umee_home +
"/cosmovisor/genesis/bin"], shell=True, env=my_env)
print(bcolors.OKCYAN + "Adding Persistent Peers For Replay..." + bcolors.ENDC)
subprocess.run(["sed -i -E 's/persistent_peers = \"\"/persistent_peers = \"" +
peers+"\"/g' "+umee_home+"/config/config.toml"], shell=True)
subprocess.run(["clear"], shell=True)
startReplayNow()
def replayFromGenesisRocksDb():
print(bcolors.OKCYAN + "Changing db_backend to rocksdb..." + bcolors.ENDC)
subprocess.run(["sed -i -E 's/db_backend = \"goleveldb\"/db_backend = \"rocksdb\"/g' "+umee_home +
"/config/config.toml"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
print(bcolors.OKCYAN + "Installing rocksdb..." + bcolors.ENDC)
print(bcolors.OKCYAN + "This process may take 15 minutes or more" + bcolors.ENDC)
os.chdir(os.path.expanduser(HOME))
subprocess.run(["sudo apt-get install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["git clone https://github.com/facebook/rocksdb.git"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
os.chdir(os.path.expanduser(HOME+"/rocksdb"))
subprocess.run(["git checkout v6.29.3"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["export CXXFLAGS='-Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=class-memaccess'"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo make shared_lib"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo make install-shared INSTALL_PATH=/usr"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo echo 'export LD_LIBRARY_PATH=/usr/local/lib' >> $HOME/.bashrc"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
my_env["LD_LIBRARY_PATH"] = "/usr/local/lib"
print(bcolors.OKCYAN + "Setting Up Cosmovisor..." + bcolors.ENDC)
os.chdir(os.path.expanduser(HOME))
subprocess.run(["go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["mkdir -p "+umee_home+"/cosmovisor"],
shell=True, env=my_env)
subprocess.run(["mkdir -p "+umee_home+"/cosmovisor/genesis"],
shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/genesis/bin"], shell=True, env=my_env)
subprocess.run(["mkdir -p "+umee_home+"/cosmovisor/upgrades"],
shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades/v4/bin"], shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades/v5/bin"], shell=True, env=my_env)
subprocess.run(
["mkdir -p "+umee_home+"/cosmovisor/upgrades/v7/bin"], shell=True, env=my_env)
os.chdir(os.path.expanduser(HOME+"/umee"))
print(bcolors.OKCYAN + "Preparing v4 Upgrade..." + bcolors.ENDC)
subprocess.run(["git stash"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["git checkout v4.2.0"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["sed '/gorocksdb.*/d' ./go.mod"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["echo \" \" >> ./go.mod"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["echo 'replace github.com/tecbot/gorocksdb => github.com/cosmos/gorocksdb v1.2.0' >> ./go.mod"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["go mod tidy"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["BUILD_TAGS=rocksdb make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v4/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
print(bcolors.OKCYAN + "Preparing v5/v6 Upgrade..." + bcolors.ENDC)
subprocess.run(["git stash"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["git checkout v6.4.1"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["BUILD_TAGS=rocksdb make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v5/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
print(bcolors.OKCYAN + "Preparing v7/v8 Upgrade..." + bcolors.ENDC)
subprocess.run(["git checkout v8.0.0"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["BUILD_TAGS=rocksdb make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v7/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
print(bcolors.OKCYAN + "Preparing v9/v10 Upgrade..." + bcolors.ENDC)
subprocess.run(["git checkout v10.0.1"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["BUILD_TAGS=rocksdb make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/upgrades/v9/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["git stash"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["git checkout v3.1.0"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["sed '/gorocksdb.*/d' ./go.mod"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["echo \" \" >> ./go.mod"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["echo 'require github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect' >> ./go.mod"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["echo 'replace github.com/tecbot/gorocksdb => github.com/cosmos/gorocksdb v1.2.0' >> ./go.mod"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["go mod tidy"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["BUILD_TAGS=rocksdb make build"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run([". "+HOME+"/.profile"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["cp build/umeed "+umee_home+"/cosmovisor/genesis/bin"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["BUILD_TAGS=rocksdb make install"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
subprocess.run(["sudo /sbin/ldconfig -v"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True, env=my_env)
print(bcolors.OKCYAN + "Adding Persistent Peers For Replay..." + bcolors.ENDC)
subprocess.run(["sed -i -E 's/persistent_peers = \"\"/persistent_peers = \"" +
peers+"\"/g' "+umee_home+"/config/config.toml"], shell=True)
subprocess.run(["clear"], shell=True)
startReplayNow()
def replayFromGenesisDb():
print(bcolors.OKCYAN + """Please choose which database you want to use:
1) goleveldb (Default)
2) rocksdb (faster but less support)
""" + bcolors.ENDC)
if args.replayDbBackend == "goleveldb":
databaseType = '1'
elif args.replayDbBackend == "rocksdb":
databaseType = '2'
else:
databaseType = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if databaseType == "1":
subprocess.run(["clear"], shell=True)
replayFromGenesisLevelDb()
elif databaseType == "2":
subprocess.run(["clear"], shell=True)
replayFromGenesisRocksDb()
else:
subprocess.run(["clear"], shell=True)
replayFromGenesisDb()
def extraSwap():
mem_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
mem_gib = mem_bytes/(1024.**3)
print(bcolors.OKCYAN + "RAM Detected: " +
str(round(mem_gib))+"GB" + bcolors.ENDC)
swapNeeded = 64 - round(mem_gib)
if round(mem_gib) < 64:
print(bcolors.OKCYAN + """
There have been reports of replay from genesis needing extra swap (up to 64GB) to prevent OOM errors.
Would you like to overwrite any previous swap file and instead set a """+str(swapNeeded)+"""GB swap file?
1) Yes, set up extra swap (recommended)
2) No, do not set up extra swap
""" + bcolors.ENDC)
if args.extraSwap == True:
swapAns = '1'
elif args.extraSwap == False:
swapAns = '2'
else:
swapAns = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if swapAns == "1":
print(bcolors.OKCYAN + "Setting up " +
str(swapNeeded) + "GB swap file..." + bcolors.ENDC)
subprocess.run(["sudo swapoff -a"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo fallocate -l " + str(swapNeeded)+"G /swapfile"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo chmod 600 /swapfile"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo mkswap /swapfile"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo swapon /swapfile"], stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["sudo cp /etc/fstab /etc/fstab.bak"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
subprocess.run(["clear"], shell=True)
print(bcolors.OKCYAN + str(swapNeeded) +
"GB swap file set" + bcolors.ENDC)
replayFromGenesisDb()
elif swapAns == "2":
subprocess.run(["clear"], shell=True)
replayFromGenesisDb()
else:
subprocess.run(["clear"], shell=True)
extraSwap()
else:
print(bcolors.OKCYAN + "You have enough RAM to meet the 64GB minimum requirement, moving on to system setup..." + bcolors.ENDC)
time.sleep(3)
subprocess.run(["clear"], shell=True)
replayFromGenesisDb()
# def stateSyncInit ():
# print(bcolors.OKCYAN + "Replacing trust height, trust hash, and RPCs in config.toml" + bcolors.ENDC)
# LATEST_HEIGHT= subprocess.run(["curl -s http://umee-sync.blockpane.com:26657/block | jq -r .result.block.header.height"], capture_output=True, shell=True, text=True, env=my_env)
# TRUST_HEIGHT= str(int(LATEST_HEIGHT.stdout.strip()) - 2000)
# TRUST_HASH= subprocess.run(["curl -s \"http://umee-sync.blockpane.com:26657/block?height="+str(TRUST_HEIGHT)+"\" | jq -r .result.block_id.hash"], capture_output=True, shell=True, text=True, env=my_env)
# RPCs = "umee-sync.blockpane.com:26657,umee-sync.blockpane.com:26657"
# subprocess.run(["sed -i -E 's/enable = false/enable = true/g' "+umee_home+"/config/config.toml"], shell=True)
# subprocess.run(["sed -i -E 's/rpc_servers = \"\"/rpc_servers = \""+RPCs+"\"/g' "+umee_home+"/config/config.toml"], shell=True)
# subprocess.run(["sed -i -E 's/trust_height = 0/trust_height = "+TRUST_HEIGHT+"/g' "+umee_home+"/config/config.toml"], shell=True)
# subprocess.run(["sed -i -E 's/trust_hash = \"\"/trust_hash = \""+TRUST_HASH.stdout.strip()+"\"/g' "+umee_home+"/config/config.toml"], shell=True)
# print(bcolors.OKCYAN + """
# Umee is about to statesync. This process can take anywhere from 5-30 minutes.
# During this process, you will see many logs (to include many errors)
# As long as it continues to find/apply snapshot chunks, it is working.
# If it stops finding/applying snapshot chunks, you may cancel and try a different method.
# Continue?:
# 1) Yes
# 2) No
# """+ bcolors.ENDC)
# stateSyncAns = input(bcolors.OKCYAN + 'Enter Choice: '+ bcolors.ENDC)
# if stateSyncAns == "1":
# subprocess.run(["umeed start"], shell=True, env=my_env)
# print(bcolors.OKCYAN + "Statesync finished. Installing required patches for state sync fix" + bcolors.ENDC)
# os.chdir(os.path.expanduser(HOME))
# subprocess.run(["git clone https://github.com/tendermint/tendermint"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
# os.chdir(os.path.expanduser(HOME+'/tendermint/'))
# subprocess.run(["git checkout callum/app-version"], shell=True, env=my_env)
# subprocess.run(["make install"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
# subprocess.run(["tendermint set-app-version 1 --home "+umee_home], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True, env=my_env)
# subprocess.run(["clear"], shell=True)
# if os_name == "Linux":
# cosmovisorInit()
# else:
# complete()
# elif stateSyncAns == "2":
# dataSyncSelection()
# else:
# subprocess.run(["clear"], shell=True)
# stateSyncInit()
# def testnetStateSyncInit ():
#print(bcolors.OKCYAN + "Replacing trust height, trust hash, and RPCs in config.toml" + bcolors.ENDC)
#LATEST_HEIGHT= subprocess.run(["curl -s http://143.198.139.33:26657/block | jq -r .result.block.header.height"], capture_output=True, shell=True, text=True, env=my_env)
#TRUST_HEIGHT= str(int(LATEST_HEIGHT.stdout.strip()) - 2000)
#TRUST_HASH= subprocess.run(["curl -s \"http://143.198.139.33:26657/block?height="+str(TRUST_HEIGHT)+"\" | jq -r .result.block_id.hash"], capture_output=True, shell=True, text=True, env=my_env)
#RPCs = "143.198.139.33:26657,143.198.139.33:26657"
#subprocess.run(["sed -i -E 's/enable = false/enable = true/g' "+umee_home+"/config/config.toml"], shell=True)
#subprocess.run(["sed -i -E 's/rpc_servers = \"\"/rpc_servers = \""+RPCs+"\"/g' "+umee_home+"/config/config.toml"], shell=True)
#subprocess.run(["sed -i -E 's/trust_height = 0/trust_height = "+TRUST_HEIGHT+"/g' "+umee_home+"/config/config.toml"], shell=True)
#subprocess.run(["sed -i -E 's/trust_hash = \"\"/trust_hash = \""+TRUST_HASH.stdout.strip()+"\"/g' "+umee_home+"/config/config.toml"], shell=True)
# if os_name == "Linux":
#subprocess.run(["clear"], shell=True)
# cosmovisorInit()
# else:
#subprocess.run(["clear"], shell=True)
# complete()
def infraSnapshotInstall():
print(bcolors.OKCYAN + "Downloading Decompression Packages..." + bcolors.ENDC)
if os_name == "Linux":
subprocess.run(["sudo apt-get install wget liblz4-tool aria2 -y"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)
else:
subprocess.run(["brew install aria2"], shell=True, env=my_env)
subprocess.run(["brew install lz4"], shell=True, env=my_env)
print(bcolors.OKCYAN + "Downloading Snapshot..." + bcolors.ENDC)
proc = subprocess.run(["curl https://umee-snapshot.sfo3.cdn.digitaloceanspaces.com/umee.json|jq -r '.[] |select(.file==\"umee-1-pruned\")|.url'"],
capture_output=True, shell=True, text=True)
os.chdir(os.path.expanduser(umee_home))
subprocess.run(["wget -O - "+proc.stdout.strip() +
" | lz4 -d | tar -xvf -"], shell=True, env=my_env)
subprocess.run(["clear"], shell=True)
if os_name == "Linux":
cosmovisorInit()
else:
complete()
def snapshotInstall():
print(bcolors.OKCYAN + "Downloading Decompression Packages..." + bcolors.ENDC)
if os_name == "Linux":
install_tools(["wget", "liblz4-tool", "aria2"])
else:
install_tools(["aria2", "lz4"])
print(bcolors.OKCYAN + "Downloading Snapshot..." + bcolors.ENDC)
proc = subprocess.run(["curl -L https://quicksync.io/umee.json|jq -r '.[] |select(.file==\"" + fileName +
"\")|select (.mirror==\"" + location + "\")|.url'"], capture_output=True, shell=True, text=True)
os.chdir(os.path.expanduser(umee_home))
subprocess.run(["wget -O - "+proc.stdout.strip() +
" | lz4 -d | tar -xvf -"], shell=True, env=my_env)
subprocess.run(["clear"], shell=True)
if os_name == "Linux":
cosmovisorInit()
else:
complete()
def mainNetLocation():
global location
print(bcolors.OKCYAN + """Please choose the location nearest to your node:
1) Netherlands
2) Singapore
3) SanFrancisco (WARNING: Location usually slow)
""" + bcolors.ENDC)
if args.snapshotLocation == "netherlands":
nodeLocationAns = "1"
elif args.snapshotLocation == "singapore":
nodeLocationAns = "2"
elif args.snapshotLocation == "sanfrancisco":
nodeLocationAns = "3"
else:
nodeLocationAns = input(
bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if nodeLocationAns == "1":
subprocess.run(["clear"], shell=True)
location = "Netherlands"
snapshotInstall()
elif nodeLocationAns == "2":
subprocess.run(["clear"], shell=True)
location = "Singapore"
snapshotInstall()
elif nodeLocationAns == "3":
subprocess.run(["clear"], shell=True)
location = "SanFrancisco"
snapshotInstall()
else:
subprocess.run(["clear"], shell=True)
mainNetLocation()
def testNetType():
global fileName
global location
print(bcolors.OKCYAN + """Please choose the node snapshot type:
1) Pruned (recommended)
2) Archive
""" + bcolors.ENDC)
if args.snapshotTypeTestnet == "pruned":
nodeTypeAns = "1"
elif args.snapshotTypeTestnet == "archive":
nodeTypeAns = "2"
else:
nodeTypeAns = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if nodeTypeAns == "1":
subprocess.run(["clear"], shell=True)
fileName = "umeetestnet-4-pruned"
location = "Netherlands"
snapshotInstall()
elif nodeTypeAns == "2":
subprocess.run(["clear"], shell=True)
fileName = "umeetestnet-4-archive"
location = "Netherlands"
snapshotInstall()
else:
subprocess.run(["clear"], shell=True)
testNetType()
def mainNetType():
global fileName
global location
print(bcolors.OKCYAN + """Please choose the node snapshot type:
1) Pruned (recommended)
2) Default
3) Archive
""" + bcolors.ENDC)
if args.snapshotType == "pruned":
nodeTypeAns = "1"
elif args.snapshotType == "default":
nodeTypeAns = "2"
elif args.snapshotType == "archive":
nodeTypeAns = "3"
elif args.snapshotType == "infra":
subprocess.run(["clear"], shell=True)
infraSnapshotInstall()
else:
nodeTypeAns = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if nodeTypeAns == "1":
subprocess.run(["clear"], shell=True)
fileName = "umee-1-pruned"
mainNetLocation()
elif nodeTypeAns == "2":
subprocess.run(["clear"], shell=True)
fileName = "umee-1-default"
mainNetLocation()
elif nodeTypeAns == "3":
subprocess.run(["clear"], shell=True)
fileName = "umee-1-archive"
location = "Netherlands"
snapshotInstall()
else:
subprocess.run(["clear"], shell=True)
mainNetType()
def dataSyncSelection():
print(bcolors.OKCYAN + """Please choose from the following options:
1) Download a snapshot from ChainLayer (recommended)
2) Start at block 1 and automatically upgrade at upgrade heights (replay from genesis, can also select rocksdb here)
3) Exit now, I only wanted to install the daemon
""" + bcolors.ENDC)
if args.dataSync == "snapshot":
dataTypeAns = "1"
elif args.dataSync == "genesis":
dataTypeAns = "2"
elif args.dataSync == "exit":
dataTypeAns = "3"
else:
dataTypeAns = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if dataTypeAns == "1":
subprocess.run(["clear"], shell=True)
mainNetType()
elif dataTypeAns == "2":
subprocess.run(["clear"], shell=True)
extraSwap()
# elif dataTypeAns == "2":
#subprocess.run(["clear"], shell=True)
#stateSyncInit ()
elif dataTypeAns == "3":
subprocess.run(["clear"], shell=True)
partComplete()
else:
subprocess.run(["clear"], shell=True)
dataSyncSelection()
def dataSyncSelectionTest():
print(bcolors.OKCYAN + """Please choose from the following options:
1) Download a snapshot from ChainLayer (recommended)
2) Exit now, I only wanted to install the daemon
""" + bcolors.ENDC)
if args.dataSyncTestnet == "snapshot":
dataTypeAns = "1"
elif args.dataSyncTestnet == "exit":
dataTypeAns = "2"
else:
dataTypeAns = input(bcolors.OKCYAN + 'Enter Choice: ' + bcolors.ENDC)
if dataTypeAns == "1":
subprocess.run(["clear"], shell=True)
testNetType()
# elif dataTypeAns == "2":
#subprocess.run(["clear"], shell=True)