-
Notifications
You must be signed in to change notification settings - Fork 5
/
upgrade.sh
executable file
·137 lines (114 loc) · 4.87 KB
/
upgrade.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
131
132
133
134
135
136
137
#!/bin/bash
function createFolder() {
mkdir -p "$@"
}
function downloadFile() {
wget https://raw.githubusercontent.com/bosagora/agora-chain/v0.x.x/"$*" -q -O "$*"
}
echo "Starts upgrade..."
echo "Stops BOSagora nodes ..."
./agora.sh docker-compose-monitoring down
echo "Creating folds ..."
createFolder networks
createFolder networks/mainnet
createFolder networks/testnet
createFolder networks/devnet
createFolder networks/mainnet/monitoring
createFolder networks/mainnet/monitoring/dashboard
createFolder networks/mainnet/monitoring/prometheus
createFolder networks/mainnet/root
createFolder networks/mainnet/root/config
createFolder networks/mainnet/root/config/cl
createFolder networks/mainnet/root/config/el
createFolder networks/testnet/monitoring
createFolder networks/testnet/monitoring/dashboard
createFolder networks/testnet/monitoring/prometheus
createFolder networks/testnet/root
createFolder networks/testnet/root/config
createFolder networks/testnet/root/config/cl
createFolder networks/testnet/root/config/el
createFolder networks/devnet/monitoring
createFolder networks/devnet/monitoring/dashboard
createFolder networks/devnet/monitoring/prometheus
createFolder networks/devnet/root
createFolder networks/devnet/root/config
createFolder networks/devnet/root/config/cl
createFolder networks/devnet/root/config/el
echo "Downloading files used on the main network ..."
downloadFile networks/mainnet/monitoring/dashboard/agora-chain-dashboard.json
downloadFile networks/mainnet/monitoring/prometheus/config.yml
downloadFile networks/mainnet/root/config/cl/chain-config.yaml
downloadFile networks/mainnet/root/config/cl/config.yaml
downloadFile networks/mainnet/root/config/el/config.toml
downloadFile networks/mainnet/root/config/el/genesis.json
downloadFile networks/mainnet/agora.bat
downloadFile networks/mainnet/agora.sh
downloadFile networks/mainnet/docker-compose.yml
downloadFile networks/mainnet/docker-compose-monitoring.yml
echo "Downloading files used on the test network ..."
downloadFile networks/testnet/monitoring/dashboard/agora-chain-dashboard.json
downloadFile networks/testnet/monitoring/prometheus/config.yml
downloadFile networks/testnet/root/config/cl/chain-config.yaml
downloadFile networks/testnet/root/config/cl/config.yaml
downloadFile networks/testnet/root/config/el/config.toml
downloadFile networks/testnet/root/config/el/genesis.json
downloadFile networks/testnet/agora.bat
downloadFile networks/testnet/agora.sh
downloadFile networks/testnet/docker-compose.yml
downloadFile networks/testnet/docker-compose-monitoring.yml
echo "Downloading files used on the development network ..."
downloadFile networks/devnet/monitoring/dashboard/agora-chain-dashboard.json
downloadFile networks/devnet/monitoring/prometheus/config.yml
downloadFile networks/devnet/root/config/cl/chain-config.yaml
downloadFile networks/devnet/root/config/cl/config.yaml
downloadFile networks/devnet/root/config/el/config.toml
downloadFile networks/devnet/root/config/el/genesis.json
downloadFile networks/devnet/agora.bat
downloadFile networks/devnet/agora.sh
downloadFile networks/devnet/docker-compose.yml
downloadFile networks/devnet/docker-compose-monitoring.yml
downloadFile agora.bat
downloadFile agora.sh
chmod 755 networks/mainnet/agora.sh
chmod 755 networks/testnet/agora.sh
chmod 755 networks/devnet/agora.sh
chmod 755 agora.sh
FILENAME=root/config/el/genesis.json
if [ -f "$FILENAME" ]
then
echo "Starts migration ..."
if find . | grep -q "2151" "$FILENAME"
then
sudo cp -rf root/chain networks/mainnet/root/
sudo cp -rf root/wallet networks/mainnet/root/
sudo cp -f root/config/cl/password.txt networks/mainnet/root/config/cl/password.txt
sudo cp -f root/config/cl/proposer_config.json networks/mainnet/root/config/cl/proposer_config.json
sudo mv -f root .root
rm docker-compose.yml
rm docker-compose-monitoring.yml
./agora.sh network mainnet
elif find . | grep -q "2019" "$FILENAME"
then
sudo cp -rf root/chain networks/testnet/root/
sudo cp -rf root/wallet networks/testnet/root/
sudo cp -f root/config/cl/password.txt networks/testnet/root/config/cl/password.txt
sudo cp -f root/config/cl/proposer_config.json networks/testnet/root/config/cl/proposer_config.json
sudo mv -f root .root
rm docker-compose.yml
rm docker-compose-monitoring.yml
./agora.sh network testnet
elif find . | grep -q "1337" "$FILENAME"
then
sudo cp -rf root/chain networks/devnet/root/
sudo cp -rf root/wallet networks/devnet/root/
sudo cp -f root/config/cl/password.txt networks/devnet/root/config/cl/password.txt
sudo cp -f root/config/cl/proposer_config.json networks/devnet/root/config/cl/proposer_config.json
mv -f root .root
rm docker-compose.yml
rm docker-compose-monitoring.yml
./agora.sh network devnet
fi
echo "Completed migration ..."
fi
./agora.sh el-node upgrade
echo "Completed upgrade..."