Skip to content

Commit 2929026

Browse files
committed
Added more comprehensive steps to describe same-storage migration.
- Updated the terrad service script to include the prioritisations. - Updated the scripts to show the correct versions.
1 parent aac19e6 commit 2929026

File tree

4 files changed

+71
-42
lines changed

4 files changed

+71
-42
lines changed

terra/README.md

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ This script is to be run as a user in server. It downloads and sets up the softw
2929

3030
At a high-level, this script downloads and installs the following
3131

32-
- Go 1.16.3
33-
- Terra 0.4.6
34-
- Node.js 14.16.1
35-
- Oracle Feeder - Price Server 1.10
36-
- Oracle Feeder - Feeder 1.10
32+
- Go 1.17.5
33+
- Terra 0.5.12-oracle
34+
- Node.js 16.13.1
35+
- Oracle Feeder - Price Server (latest in main)
36+
- Oracle Feeder - Feeder (latest in main)
3737

3838
## Post setup
3939

@@ -72,9 +72,9 @@ bash checksum.sh {SNAPSHOT_FILE} check
7272

7373
If the checksum passes, it means the file was downloaded properly. The next step is to extract it.
7474

75-
lz4 -d {SNAPSHOT_FILE} | tar xf - -C /mnt/columbus4
75+
lz4 -d {SNAPSHOT_FILE} | tar xf - -C /mnt/columbus5a
7676

77-
This command extracts the files into /mnt/columbus4/data (assuming /mnt/columbus4 is a separate storage disk). This can also take a long while (hours) to complete depending on the size and the speed of the disk.
77+
This command extracts the files into /mnt/columbus5a/data (assuming /mnt/columbus5a is a separate storage disk). This can also take a long while (hours) to complete depending on the size and the speed of the disk.
7878

7979
## Initialize the node
8080

@@ -114,7 +114,7 @@ Reference: https://discord.com/channels/566086600560214026/566126728578072586/84
114114

115115
Make sure that the data folder points to the actual files by creating a symbolic link to the folder.
116116

117-
ln -s /mnt/columbus4/data ~/.terrad/data
117+
ln -s /mnt/columbus5a/data ~/.terrad/data
118118

119119
The daemon can now be started to run through the blocks.
120120

@@ -159,7 +159,7 @@ To do the migration:
159159

160160
### Commands
161161

162-
Sync the client data over:
162+
~~Sync the client data over:~~
163163

164164
```bash
165165
rsync server-a:.terracli ~/ -e 'ssh -p 22' -vzrc
@@ -179,11 +179,11 @@ mv -i /tmp/staging/priv_validator_state.json ~/.terrad/data/
179179

180180
## Replacement server with existing data
181181

182-
Prepare the server by making the software components are in place. There is no need to download the blockchain snapshot since the data is already available for migration.
182+
Prepare the server by making sure that the software components are in place. There is no need to download the blockchain snapshot since the data is already available for migration.
183183

184184
What _needs_ to be done is to re-attach the block storage when doing the migration.
185185

186-
To do the migration:
186+
The steps for the migration:
187187

188188
1. Stop the old terrad server.
189189
2. Unmount the storage volume.
@@ -193,42 +193,53 @@ To do the migration:
193193

194194
### Commands
195195

196-
Sync the client data over:
196+
Before following the next steps, it is prudent to reboot the machine and re-run the SSH agent.
197197

198198
```bash
199-
rsync server-a:.terracli ~/ -e 'ssh -p 22' -vzrc
199+
sudo reboot
200+
# After rebooting,
201+
eval `ssh-agent`
202+
ssh-add ~/.ssh/id_ed25519.pub
203+
bash sync.sh
200204
```
201205

202-
Create the following sync script in Server B:
206+
Create the following sync script (sync.sh) in Server B:
203207

204208
```bash
205209
#!/bin/bash
206-
rsync server-a:.terrad ~/ -e 'ssh -p 22' -vzrc
207-
rsync server-a:.terracli ~/ -e 'ssh -p 22' -vzrc
210+
rsync server-a:.terra/config ~/.terra/ -e 'ssh -p 22' --delete --exclude=node_key.json -vzrc
211+
rsync server-a:oracle-feeder/price-server/config/default.js ~/oracle-feeder/price-server/config/ -e 'ssh -p 22' -vzrc
212+
rsync server-a:oracle-feeder/feeder/voter.json ~/oracle-feeder/feeder/ -e 'ssh -p 22' -vzrc
213+
rsync server-a:/etc/systemd/system/price-server.service ~/ -e 'ssh -p 22' -vzrc
214+
rsync server-a:/etc/systemd/system/feeder.service ~/ -e 'ssh -p 22' -vzrc
215+
rsync server-a:/etc/systemd/system/terrad.service ~/ -e 'ssh -p 22' -vzrc
208216
```
209217

210218
The following commands can be run prior to the stopping of the old server.
211219

212220
```bash
213-
sudo mkdir /mnt/columbus4
214-
sudo chown $USER:$USER -R /mnt/columbus4
215-
mkdir -p ~/columbus
216-
mv -i ~/.terrad ~/columbus
221+
sudo mkdir /mnt/columbus5a
222+
sudo chown $TERRA_USER:$TERRA_USER -R /mnt/columbus5a
217223
bash sync.sh
218-
ln -s /mnt/columbus4/data ~/.terrad/data
224+
ln -s /mnt/columbus5a/data ~/.terrad/data
219225
```
220226

221-
Before following the next steps, it is prudent to reboot the machine and re-run the SSH agent.
227+
Running the sync script will create three systemd service files in the home directory. They are to be moved to _/etc/systemd/system_ after checking for correctness.
228+
229+
The ownership of the files also need to be set to `root:root`
230+
231+
After doing so, the first service that can be executed with no problems is the price server.
222232

223233
```bash
224-
sudo reboot
225-
# After rebooting,
226-
eval `ssh-agent`
227-
ssh-add ~/.ssh/id_ed25519.pub
228-
bash sync.sh
234+
sudo systemctl daemon-reload
235+
sudo systemctl start price-server.service
229236
```
230237

231-
The sequence of commands below needs to be executed in quick succession.
238+
The service can be confirmed to be running by executing `journalctl -u price-server.service -f`
239+
240+
### Actual migration
241+
242+
The sequence of commands below needs to be **executed in quick succession**.
232243

233244
```bash
234245
# server-a
@@ -238,14 +249,30 @@ umount /dev/sda
238249

239250
# server-b
240251
bash sync.sh
241-
sudo mount -o discard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_columbus4e /mnt/columbus4
252+
# Check that the symbolic link works.
253+
sudo mount -o nodiscard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_columbus5a /mnt/columbus5a && ls -l ~/.terra/
254+
# Update ownership
255+
sudo chown -R $USER:$USER /mnt/columbus5a
242256
sudo systemctl start terrad
243257
```
244258

245-
Finally, the command to automatically mount the volume needs to be added to /etc/fstab
259+
The command to automatically mount the volume needs to be added to /etc/fstab so that the volume is auto-mounted on reboot.
246260

261+
```
262+
/dev/disk/by-id/scsi-0DO_Volume_columbus5a /mnt/columbus5a ext4 defaults,nofail,noatime 0 0
247263
```
248264

265+
After `terrad` is running as a service, the next service to run is the feeder.
266+
267+
```bash
268+
sudo systemctl start feeder.service
269+
journalctl -u feeder.service -f
270+
```
271+
272+
When the feeder is running smooth for a while, the monitoring script can be started to monitor the oracle feeder's performance.
273+
274+
```bash
275+
bash oracle-monitor.sh terravaloper1rjmzlljxwu2qh6g2sm9uldmtg0kj4qgyy9jx24 http://localhost:1317
249276
```
250277

251278
# Client

terra/configure.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ sudo cp sample/terrad.service /etc/systemd/system/
66
echo " done"
77

88
echo -n "Installing Price Server..."
9-
PRICE_SERVER_PATH=/home/terrau/oracle-feeder/price-server
9+
PRICE_SERVER_PATH=/home/$TERRA_USER/oracle-feeder/price-server
1010
cp sample/price-server-start.sh $PRICE_SERVER_PATH/
11-
chown terrau:terrau $PRICE_SERVER_PATH/price-server-start.sh
11+
chown $TERRA_USER:$TERRA_USER $PRICE_SERVER_PATH/price-server-start.sh
1212
chmod a+x $PRICE_SERVER_PATH/price-server-start.sh
1313
sudo cp sample/price-server.service /etc/systemd/system/
1414
echo " done"
1515

1616
echo -n "Installing Oracle Feeder..."
17-
FEEDER_PATH=/home/terrau/oracle-feeder/feeder
17+
FEEDER_PATH=/home/$TERRA_USER/oracle-feeder/feeder
1818
cp sample/feeder-start.sh $FEEDER_PATH/
19-
sudo chown terrau:terrau $FEEDER_PATH/feeder-start.sh
19+
sudo chown $TERRA_USER:$TERRA_USER $FEEDER_PATH/feeder-start.sh
2020
chmod a+x $FEEDER_PATH/feeder-start.sh
2121
sudo cp sample/feeder.service /etc/systemd/system/
2222
echo " done"

terra/sample/terrad.service

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ ExecStart=/home/$USER/go/bin/terrad start
99
Restart=on-failure
1010
RestartSec=5s
1111
LimitNOFILE=65537
12+
Nice=-20
13+
IOSchedulingPriority=0
14+
IOSchedulingClass=realtime
1215

1316
[Install]
1417
WantedBy=multi-user.target
15-

terra/user1.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ echo "====================="
2727
mkdir -p $HOME/Downloads
2828

2929
# Installation of Go
30-
VERSION_GO=1.17.3
30+
VERSION_GO=1.17.5
3131
echo "Installing Go"
3232
echo "-------------"
3333
cd $HOME/Downloads
@@ -38,7 +38,7 @@ echo -n "Installed "
3838
go version
3939

4040
# Installation of terrad
41-
VERSION_CORE=v0.5.10-oracle
41+
VERSION_CORE=v0.5.12-oracle
4242
echo "Installing terrad"
4343
echo "-----------------"
4444
mkdir -p $HOME/go
@@ -59,7 +59,7 @@ source ~/.profile
5959
echo " done."
6060

6161
# Install the Price Server
62-
VERSION_NODE=v14.18.0
62+
VERSION_NODE=v16.13.1
6363
echo "Downloading Node.js"
6464
echo "-------------------"
6565
cd $HOME/Downloads
@@ -89,10 +89,10 @@ echo "-------------------------"
8989
cd $HOME
9090
git clone https://github.com/terra-project/oracle-feeder.git
9191

92-
VERSION_FEEDER=v2.0.0
93-
echo "Switching to version $VERSION_FEEDER"
94-
cd $HOME/oracle-feeder
95-
git checkout $VERSION_FEEDER
92+
# VERSION_FEEDER=v2.0.0
93+
# echo "Switching to version $VERSION_FEEDER"
94+
# cd $HOME/oracle-feeder
95+
# git checkout $VERSION_FEEDER
9696

9797
echo "- Installing Feeder."
9898
cd $HOME/oracle-feeder/feeder

0 commit comments

Comments
 (0)