This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-new-dockerless-server.sh
executable file
·130 lines (104 loc) · 3.81 KB
/
install-new-dockerless-server.sh
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
#!/bin/bash
# This script assumes that:
# you are running a fresh server on Ubuntu 18.04
# you are running this from /root/OT-DockSucker
# you want to install otnode without using docker
VERSION=$(lsb_release -sr)
if [ $VERSION != 18.04 ]; then
echo "OT-DockSucker requires Ubuntu 18.04. Destroy this VPS and remake using Ubuntu 18.04."
exit 1
fi
echo "apt install -y build-essential gcc python-dev ccze ncdu"
apt install -y build-essential gcc python-dev ccze ncdu
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "cd"
cd
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "cd /root/OT-DockSucker/data"
cd /root/OT-DockSucker/data
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "./install-otnode.sh"
./install-otnode.sh
echo "apt-mark hold arangodb3 nodejs"
apt-mark hold arangodb3 nodejs
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "mkdir -p /ot-node && mv /root/OT-DockSucker/data/ot-node/ /ot-node/5.1.0"
mkdir -p /ot-node && mv /root/OT-DockSucker/data/ot-node/ /ot-node/5.1.0
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "ln -s /ot-node/5.1.0 /ot-node/current && cd /ot-node/current"
ln -s /ot-node/5.1.0 /ot-node/current && cd /ot-node/current
if [[ $? -ne 0 ]]; then
exit 1
fi
echo NODE_ENV=mainnet >> .env
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "cp /root/origintrail_noderc /ot-node/current/"
cp /root/.origintrail_noderc /ot-node/current/.origintrail_noderc
if [[ $? -ne 0 ]]; then
exit 1
fi
ADDRESS=$(hostname -I | cut -f 1 -d ' ')
echo "******************************************"
echo "******************************************"
echo "******************************************"
echo $ADDRESS
echo "Writing IP address $ADDRESS value to /root/dockerless-install-settings."
echo "You can delete this file at any time."
echo $ADDRESS >> dockerless-install-settings
echo "******************************************"
echo "******************************************"
echo "******************************************"
#sed -i -E 's|"hostname": "[[:digit:]]+.[[:digit:]]+.[[:digit:]]+.[[:digit:]]+",|"hostname": "'"$ADDRESS"'",|g' /ot-node/current/.origintrail_noderc
ADDRESS=$(hostname -I | cut -f 1 -d ' ')
cat /ot-node/current/.origintrail_noderc | jq ".network.hostname = \"$ADDRESS\"" >> /ot-node/current/origintrail_noderc
mv /ot-node/current/origintrail_noderc /ot-node/current/.origintrail_noderc
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "cd /ot-node/current"
cd /ot-node/current
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "npm run setup"
npm run setup
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "/root/OT-DockSucker/data/update-arango-password.sh /root/.origintrail_noderc/mainnet"
/root/OT-DockSucker/data/update-arango-password.sh /root/.origintrail_noderc/mainnet
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "cp /root/OT-DockSucker/data/otnode.service /lib/systemd/system"
cp /root/OT-DockSucker/data/otnode.service /lib/systemd/system
if [[ $? -ne 0 ]]; then
exit 1
fi
echo "Adding firewall rules 22, 3000, 5278, and 8900, and enabling the firewall"
ufw allow 22/tcp && ufw allow 3000 && ufw allow 5278 && ufw allow 8900 && ufw enable
echo "The IP address used to configure .origintral_noderc is $ADDRESS."
echo "Setting the logs to have a hard limit of 50 meg. Log deletions/clearing will not be required..."
sed -i 's|#SystemMaxUse=|SystemMaxUse=50M|' /etc/systemd/journald.conf
systemctl restart systemd-journald
echo "Enabling the node to start on server boot"
systemctl enable otnode
echo "Your Dockerless otnode is ready to run ! Please configure your otnode with nano /ot-node/current/.origintrail_noderc to continue.
Once you are done, run systemctl start otnode to start the node and journalctl -u otnode -f | ccze -A to check the logs"
#nano /ot-node/current/.origintrail_noderc
#echo "Starting the node"
#systemctl start otnode
#echo "Displaying the logs on startup. Exit using ctrl+c at any time. The node will continue to run."
#journalctl -u otnode -f | ccze -A