forked from safenetwork-community/comnet-install
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomnet-install.sh
More file actions
executable file
·230 lines (184 loc) · 6.38 KB
/
comnet-install.sh
File metadata and controls
executable file
·230 lines (184 loc) · 6.38 KB
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
#!/usr/bin/env bash
# https://github.com/safenetwork-community
# safenetwork-community
##
# Color Variables
##
red='\e[31m'
green='\e[32m'
blue='\e[34m'
clear='\e[0m'
##
# Color Functions
##
ColorGreen(){
echo - $green$1$clear
}
ColorBlue(){
echo - $blue$1$clear
}
ColorRed(){
echo - $red$1$clear
}
clear
echo "********************** SAFE NODE INSTALLER *****************************************"
echo ""
echo ""
echo ""
echo ""
echo " This script will install everything needed to join the SAFE network testnets for "
echo " Ubuntu like machines"
echo " The programs lised below will be installed if required. Your root password will be required."
echo ""
echo ""
echo " - snap -assists in installin the dependencies"
echo " - curl -fetches the SAFE applications"
echo " - sn_cli -the SAFE client program "
echo " - safe_network -the SAFE network functionality "
echo " - moreutils -helper programs to assist in idenntifying your network settins"
echo " - build-essential -required to build vdash on top of rust "
echo " - rust -Rust is a systems programming lanuage "
echo " - vdash -vdash is a Rust program by @happybeing to monitor your SAFE node "
echo ""
echo ""
echo ""
echo -ne $(ColorRed " ################# Any existing SAFE installation will be DELETED ##################")
echo ""
echo ""
echo ""
echo ""
echo " Once everything is installed, your node will connect to the chosen testnet and vdash will be"
echo " configured to display network and node information"
echo ""
echo ""
echo " If you are happy with the above and have read the Readme, type 'y' to proceed [y,N]"
read -r input
if [[ $input == "Y" || $input == "y" ]]; then
echo " OK then, let's go."
else
echo "Bye now..."
exit
fi
echo " Which testnet do you want to connect to?"
echo ""
echo " None of these testnets are guaranteed or even likely to be running at any given time"
echo " Please refer to threads on https://safenetforum.org for current news on live testnets."
echo ""
echo " 1 sjefolaht"
echo " 2 comnet"
echo " 3 southsidenet"
echo " 4 playground"
echo ""
echo ""
echo " Please select 1, 2, 3 or 4"
read SAFENET_CHOICE
echo ""
case $SAFENET_CHOICE in
1)
SAFENET=sjefolaht
CONFIG_URL=https://link.tardigradeshare.io/s/julx763rsy2egbnj2nixoahpobgq/rezosur/koqfig/sjefolaht_node_connection_info.config?wrap=0
;;
2) SAFENET=comnet
CONFIG_URL=https://sn-comnet.s3.eu-west-2.amazonaws.com/node_connection_info.config
;;
3)
SAFENET=southsidenet
CONFIG_URL=https://comnet.snawaffadyke.com/southsidenet.config
;;
4)
SAFENET=playground
CONFIG_URL=https://safe-testnet-tool.s3.eu-west-2.amazonaws.com/public-node_connection_info.config
;;
*)
echo " Invalid selection, please choose 1-4 to select a testnet"
;;
esac
echo ""
echo " Your node will attempt to connect to "$SAFENET
echo ""
echo " For some testnets, it will be necessary to allocate a fixed size for your vault."
echo " Again please refer to threads on https://safenetforum.org for details. If no size"
echo " is specified, 5GB will be selected as default."
GB_ALLOCATED=5
read -e -i "$GB_ALLOCATED" -p ' How many GB do you want to allocate to your vault? [5]' GB_ALLOCATED
VAULT_SIZE=${GB_ALLOCATED}
echo " $VAULT_SIZE" "GB will be allocated for storing chunks"
echo ""
echo ""
echo ""
echo ""
echo " Certain setups may require the default port that SAFE uses to be changed"
echo " Most users will be OK with the default port at 12000 "
echo " Only change this if you know what you are doing."
echo ""
SAFE_PORT=12000
read -e -i "$SAFE_PORT" -p ' Press Enter to accept the default or edit it here [12000]' #SAFE_PORT
echo $SAFE_PORT
sleep 2
echo ""
echo ""
echo ""
echo ""
echo " Now installing SAFE and all necessary dependencies."
echo " This may take a few minutes depending on your download speed "
echo " Thank you for your patience "
echo ""
echo -ne $(ColorBlue " The world has waited a long time for SAFE - just a few seconds more....")
#exit
#sudo apt -qq update >/dev/null
#sudo apt -qq install -y snapd build-essential moreutils >/dev/null
sudo snap install curl
sudo snap install rustup --classic
rustup toolchain install stable
cargo install vdash
PATH=$PATH:/$HOME/.safe/cli:$HOME/.cargo/bin
ACTIVE_IF=$( ( cd /sys/class/net || exit; echo *)|awk '{print $1;}')
LOCAL_IP=$(echo $(ifdata -pa "$ACTIVE_IF"))
PUBLIC_IP=$(echo $(curl -s ifconfig.me))
SAFE_PORT=$SAFE_PORT
VAULT_SIZE=$((1024*1024*1024*$GB_ALLOCATED))
LOG_DIR=$HOME/.safe/node/local_node
SN_CLI_QUERY_TIMEOUT=3600
# Install Safe software and configuration
#rm -rf "$HOME"/.safe # clear out any old files
#get the CLI
curl -so- https://raw.githubusercontent.com/maidsafe/safe_network/master/resources/scripts/install.sh | bash
echo ""
echo ""
echo ""
echo $(safe --version) "install complete"
safe networks add $SAFENET "$CONFIG_URL"
safe networks switch $SAFENET
safe networks
sleep 2
safe node install
echo ""
echo ""
echo ""
echo $(safe node bin-version) "install complete"
# Join a node from home
echo "Attempting to join the '$SAFENET' network using the following parameters"
echo ""
echo "--max-capacity" $VAULT_SIZE
echo "--local-addr" "$LOCAL_IP"":"$SAFE_PORT
echo "--public-addr" "$PUBLIC_IP"":"$SAFE_PORT
echo "--log-dir" "$LOG_DIR"
echo "--skip-auto-port-forwarding"
RUST_LOG=safe_network=trace,qp2p=info \
~/.safe/node/sn_node \
--max-capacity $VAULT_SIZE \
--local-addr "$LOCAL_IP":$SAFE_PORT \
--public-addr "$PUBLIC_IP":$SAFE_PORT \
--skip-auto-port-forwarding \
--log-dir "$LOG_DIR"
#clear
echo "_____________________________________________________________________________________________________"
echo ""
echo " Now cofiguring vdash from @happybeing"
echo ""
echo ""
echo " press 'q' to quit vdash --- this will not interfere with your node ---"
echo ""
sleep 3
# Install or update vdash
vdash "$LOG_DIR"/sn_node.log