-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebianchainnode.sh
More file actions
125 lines (104 loc) · 2.65 KB
/
debianchainnode.sh
File metadata and controls
125 lines (104 loc) · 2.65 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
#!/usr/bin/env sh
[ $SUDO_USER ] && _user=$SUDO_USER || _user=`whoami`
echo ''
echo ''
echo ''
echo '**************************'
echo 'Installing misc dependencies'
echo '**************************'
echo ''
echo ''
echo ''
# install dependencies
sudo apt-get update && sudo apt-get install systemd unzip wget -y
echo ''
echo ''
echo ''
echo '**************************'
echo 'Installing XERO Chain Node binary'
echo '**************************'
echo ''
echo ''
echo ''
# Clean up environment and stage install
mkdir -p /tmp/xerom
cd /tmp/xerom
rm -rf geth-linux.zip
rm -rf dashboard
# Download node binary
wget https://github.com/xero-official/go-xerom/releases/download/2.1.0/geth-linux.zip
unzip geth-linux.zip
# Make node executable
chmod +x geth
echo ''
echo ''
echo ''
echo '**************************'
echo 'Creating and setting up XERO Chain Node system service'
echo '**************************'
echo ''
echo ''
echo ''
cat > /tmp/xerom/xerochainnode.service << EOL
[Unit]
Description=XERO Chain Node
After=network.target
[Service]
User=$_user
Group=$_user
Type=simple
Restart=always
ExecStart=/usr/sbin/geth --syncmode=fast -node --cache=512 --datadir=$HOME/.xerom
[Install]
WantedBy=default.target
EOL
sudo systemctl stop xerochainnode
sudo \mv /tmp/xerom/xerochainnode.service /etc/systemd/system
sudo \rm /usr/sbin/geth
sudo \mv geth /usr/sbin/
sudo systemctl daemon-reload
sudo systemctl enable xerochainnode && systemctl start xerochainnode
sudo systemctl restart xerochainnode
sudo systemctl status xerochainnode --no-pager --full
echo ''
echo ''
echo ''
echo '**************************'
echo 'Setting Up Node dashboard'
echo '**************************'
echo ''
echo ''
echo ''
# Download node Dashboard
wget https://github.com/xero-official/node-deployment-dashboard/raw/master/build/dashboard
# Make Dashboard executable
chmod +x dashboard
sleep 3s
echo ''
echo ''
echo ''
echo '**************************'
echo 'Printing your Node ID - Please save this somewhere you might need it'
echo '(note: The script will pause for 1 minute to allow you to copy the Node ID, after 1 minute it will resume.)'
echo '**************************'
echo ''
echo ''
echo ''
#Grab the Node ID
/usr/sbin/geth --exec "admin.nodeInfo.enode" attach ipc://./$HOME/.xerom/geth.ipc
sleep 1m
# Make Dashboard executable
chmod +x dashboard
echo ''
echo ''
echo ''
echo '**************************'
echo 'If you are going to setup your node manually - you can exit the dashboard by using option 5 - It is recommend you wait for the node to complete syncing before activating the dasboard'
echo '**************************'
echo ''
echo ''
echo ''
sleep 10s
# Activate Dashboard
./dashboard
echo 'Done.'