Skip to content

Commit 007d8d6

Browse files
committed
Updated the README file.
- Added a backup script. - Made some minor corrections to the sample migrate script. - Removed some outdated files.
1 parent 73ac365 commit 007d8d6

File tree

10 files changed

+221
-188
lines changed

10 files changed

+221
-188
lines changed

terra/README.md

Lines changed: 32 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ At a high-level, this script downloads and installs the following
3535
- Oracle Feeder - Price Server (latest in main)
3636
- Oracle Feeder - Feeder (latest in main)
3737

38-
> As the script isn't very robust, it is preferable to copy each command and run it line by line.
39-
4038
## Post setup
4139

4240
After the script has completed running and the applications are downloaded, be sure to update the following:
@@ -65,7 +63,7 @@ Regardless of the scenarios, the steps described in Phase 1 and Phase 3 should b
6563

6664
## Phase 1
6765

68-
### SSH keys ###
66+
### SSH keys
6967

7068
Regardless of whether the data is migrated or is generated from a snapshot, the replacement server (Server B) should be able to access the origin server (Server A) via SSH.
7169

@@ -86,10 +84,9 @@ eval `ssh-agent`
8684
ssh-add ~/.ssh/id_ed25519.pub
8785
```
8886

89-
### Sync script ###
87+
### Sync script
9088

91-
Create the following sync script (sync.sh) in Server B:
92-
Use the script _sample/sync.sh_ in Server B to get the files over for the initial sync.
89+
Update _sample/sync.sh_ by specifying the user and the host, and use it in Server B to get the files over for the initial sync.
9390

9491
(No need to move .terra/config/node_key.json - [https://discord.com/channels/566086600560214026/566126867686621185/842673595117207573])
9592

@@ -127,11 +124,11 @@ The service can be confirmed to be running by executing
127124
journalctl -u price-server.service -f
128125
```
129126

130-
## Phase 2A: Migration with no pre-existing blockchain data ##
127+
## Phase 2A: Migration with no pre-existing blockchain data
131128

132129
For a new server, a snapshot of the blockchain needs to be downloaded for quick sync.
133130

134-
### Download a snapshot ###
131+
### Download a snapshot
135132

136133
DO THIS FIRST AS THIS CAN TAKE A LONG TIME.
137134

@@ -189,9 +186,9 @@ Once it is caught up:
189186

190187
(Reference: https://discord.com/channels/566086600560214026/566126867686621185/806929605629968396)
191188

192-
Use the file _sample/migrate.sh_ to copy the file from the old server to the new server **after stopping both servers**.
189+
Modify _sample/migrate.sh_ by specifying the user and the host, and use it to copy the file from the old server to the new server **after stopping both servers**.
193190

194-
### Actual migration ###
191+
### Actual migration
195192

196193
The sequence of commands below needs to be **excuted in quick succession**.
197194

@@ -206,7 +203,7 @@ bash $HOME/validator-script/terra/sample/migrate.sh -t
206203
sudo systemctl start terrad
207204
```
208205

209-
## Phase 2B: Migration with blockchain data available ##
206+
## Phase 2B: Migration with blockchain data available
210207

211208
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.
212209

@@ -280,9 +277,9 @@ When the feeder is running smooth for a while, the monitoring script can be star
280277
bash oracle-monitor.sh terravaloper1rjmzlljxwu2qh6g2sm9uldmtg0kj4qgyy9jx24 http://localhost:1317
281278
```
282279

283-
# Tips #
280+
# Tips
284281

285-
## Continuous TRIM ##
282+
## Continuous TRIM
286283

287284
One performance tip for SSD storage technologies is the removal of continuous [TRIM](https://www.digitalocean.com/community/tutorials/how-to-configure-periodic-trim-for-ssd-storage-on-linux-servers).
288285

@@ -296,124 +293,51 @@ _If_ there are drives that have this option, they can be remounted in place with
296293

297294
In the _/etc/fstab_ file, the `discard` property needs to be removed so that when the drives get mounted on boot, continuous TRIM will not be enabled.
298295

299-
## Periodic TRIM ##
296+
## Auto-mounting
300297

301-
If continuous TRIM is disabled, periodic TRIM needs to be performed.
298+
To prepare for the case that the server reboots, the external volume needs to be automatically mounted. This can be done by modifying the _/etc/fstab_ file.
302299

303-
Create the cron script _/etc/cron.weekly/fstrim_:
300+
Before doing so, check for the UUID of the drive that is mounted. The UUID is used instead of the path is because the mapping can be different.
304301

305-
```
306-
#!/bin/sh
307-
/usr/sbin/fstrim --all || true
308-
```
309-
310-
Then make the script executable:
302+
First determine which is the drive that is mapped to the mount point:
311303

312304
```bash
313-
sudo chmod a+x /etc/cron.weekly/fstrim
305+
mount
314306
```
315307

316-
## Hostname ##
317-
318-
Some distributions may not set the hostname to match the name set in the dashboard.
319-
320-
The name can be permanently changed using `hostnamectl`:
308+
Then list the drives:
321309

322310
```bash
323-
sudo hostnamectl set-hostname validator-terra
324-
```
325-
326-
# Fresh new setup
327-
328-
### Initialize the node
329-
330-
A new node needs to be initialized with a moniker. E.g.
331-
332-
terrad init "Validator A"
333-
334-
This will create a ".terrad" directory in the home folder. It comes with a file that needs to be replaced by one from Mainnet.
335-
336-
mv -i ~/.terrad/config/genesis.json
337-
curl {GENESIS_FILE} > ~/.terrad/config/genesis.json
338-
curl {ADDRBOOK} > ~/.terrad/config/addrbook.json
339-
340-
For the Mainnet (columbus-4), the genesis file can be downloaded from https://columbus-genesis.s3-ap-northeast-1.amazonaws.com/columbus-4-genesis.json (reference [docs.terra.money](https://docs.terra.money/node/join-network.html#download-the-genesis-file)).
341-
342-
~~The address book can be found at https://network.terra.dev/addrbook.json (reference [docs.terra.money](https://docs.terra.money/node/join-network.html#picking-a-network)).~~ The address book is not actually required.
343-
344-
For the Testnet (tequila-0004), the genesis file can be downloaded from https://raw.githubusercontent.com/terra-project/testnet/master/tequila-0004/genesis.json (reference [github.com](https://github.com/terra-project/testnet)).
345-
346-
For Bombay testnet, the genesis file is at https://raw.githubusercontent.com/terra-project/testnet/master/bombay-0007/genesis.json
347-
348-
Update the seeds (~/.terrad/config/config.toml) to begin running the blockchain. The seeds for Mainnet are (reference: [docs.terra.money](https://docs.terra.money/node/join-network.html#define-seed-nodes)):
349-
311+
ls -l /dev/disk/by-uuid
350312
```
351-
seeds = "87048bf71526fb92d73733ba3ddb79b7a83ca11e@public-seed.terra.dev:26656,b5205baf1d52b6f91afb0da7d7b33dcebc71755f@public-seed2.terra.dev:26656,5fa582d7c9931e5be8c02069d7b7b243c79d25bf@seed.terra.de-light.io:26656"
352-
```
353-
354-
Update the minimum gas prices to prevent spamming (~/.terrad/config/app.toml).
355-
356-
```
357-
minimum-gas-prices = "0.01133uluna,0.15uusd,0.104938usdr,169.77ukrw,428.571umnt,0.125ueur,0.98ucny,16.37ujpy,0.11ugbp,10.88uinr,0.19ucad,0.14uchf,0.19uaud,0.2usgd,4.62uthb,1.25usek"
358-
```
359-
360-
Reference: https://discord.com/channels/566086600560214026/566126728578072586/842861299012468756
361-
362-
Make sure that the data folder points to the actual files by creating a symbolic link to the folder.
363-
364-
ln -s /mnt/columbus-a/data ~/.terrad/data
365313

366-
The daemon can now be started to run through the blocks.
314+
The IDs are symbolic links to the disk paths. Locate the correct value then modify _/etc/fstab_ by adding the following line:
367315

368-
terrad start
316+
UUID=<uuid> /mnt/col5 ext4 defaults,nofail,noatime 0 2
369317

370-
# Client
318+
## Periodic TRIM
371319

372-
## Create the keys
373-
374-
This usually just needs to be done the first time the validator is being set up.
375-
376-
terracli keys add <keyName>
320+
If continuous TRIM is disabled, periodic TRIM needs to be performed.
377321

378-
## Configure the client
322+
Create the cron script _/etc/cron.weekly/fstrim_:
379323

380324
```
381-
terracli config node tcp://localhost:26657
382-
terracli config trust-node true
325+
#!/bin/sh
326+
/usr/sbin/fstrim --all || true
383327
```
384328

385-
Run just one of the following commands:
329+
Then make the script executable:
386330

387-
```
388-
terracli config chain-id columbus-4 # Mainnet
389-
terracli config chain-id tequila-0004 # Testnet
331+
```bash
332+
sudo chmod a+x /etc/cron.weekly/fstrim
390333
```
391334

392-
## Create the validator
335+
## Hostname
393336

394-
```
395-
terracli tx oracle set-feeder terra139ycju27xcek7n2ulew308p28pdh6a6mdqac5a --from=terra1rjmzlljxwu2qh6g2sm9uldmtg0kj4qgyy27m6x --fees 33954000ukrw
396-
```
397-
398-
## Configure the oracle feeder
337+
Some distributions may not set the hostname to match the name set in the dashboard.
399338

400-
terracli tx oracle set-feeder terra139ycju27xcek7n2ulew308p28pdh6a6mdqac5a --from=terra1rjmzlljxwu2qh6g2sm9uldmtg0kj4qgyy27m6x --fees 33954000ukrw
339+
The name can be permanently changed using `hostnamectl`:
401340

341+
```bash
342+
sudo hostnamectl set-hostname validator-terra
402343
```
403-
cd $FEEDER_PATH
404-
npm start update-key
405-
```
406-
407-
Requires the mnemonic.
408-
409-
This creates a file voter.json
410-
411-
cd /home/terrau/oracle-feeder/feeder
412-
/usr/local/bin/npm start vote --\
413-
--source http://localhost:8532/latest \
414-
--lcd https://lcd.terra.dev \
415-
--chain-id "${CHAIN_ID}" \
416-
--denoms sdr,krw,usd,mnt,eur,cny,jpy,gbp,inr,cad,chf,hkd,aud,sgd,thb \
417-
--validator "${VALIDATOR_KEY}" \
418-
--password "${ORACLE_PASS}" \
419-
--gas-prices 169.77ukrw

terra/archive/OLDREADME.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Fresh new setup
2+
3+
### Initialize the node
4+
5+
A new node needs to be initialized with a moniker. E.g.
6+
7+
terrad init "Validator A"
8+
9+
This will create a ".terrad" directory in the home folder. It comes with a file that needs to be replaced by one from Mainnet.
10+
11+
mv -i ~/.terrad/config/genesis.json
12+
curl {GENESIS_FILE} > ~/.terrad/config/genesis.json
13+
curl {ADDRBOOK} > ~/.terrad/config/addrbook.json
14+
15+
For the Mainnet (columbus-4), the genesis file can be downloaded from https://columbus-genesis.s3-ap-northeast-1.amazonaws.com/columbus-4-genesis.json (reference [docs.terra.money](https://docs.terra.money/node/join-network.html#download-the-genesis-file)).
16+
17+
~~The address book can be found at https://network.terra.dev/addrbook.json (reference [docs.terra.money](https://docs.terra.money/node/join-network.html#picking-a-network)).~~ The address book is not actually required.
18+
19+
For the Testnet (tequila-0004), the genesis file can be downloaded from https://raw.githubusercontent.com/terra-project/testnet/master/tequila-0004/genesis.json (reference [github.com](https://github.com/terra-project/testnet)).
20+
21+
For Bombay testnet, the genesis file is at https://raw.githubusercontent.com/terra-project/testnet/master/bombay-0007/genesis.json
22+
23+
Update the seeds (~/.terrad/config/config.toml) to begin running the blockchain. The seeds for Mainnet are (reference: [docs.terra.money](https://docs.terra.money/node/join-network.html#define-seed-nodes)):
24+
25+
```
26+
seeds = "87048bf71526fb92d73733ba3ddb79b7a83ca11e@public-seed.terra.dev:26656,b5205baf1d52b6f91afb0da7d7b33dcebc71755f@public-seed2.terra.dev:26656,5fa582d7c9931e5be8c02069d7b7b243c79d25bf@seed.terra.de-light.io:26656"
27+
```
28+
29+
Update the minimum gas prices to prevent spamming (~/.terrad/config/app.toml).
30+
31+
```
32+
minimum-gas-prices = "0.01133uluna,0.15uusd,0.104938usdr,169.77ukrw,428.571umnt,0.125ueur,0.98ucny,16.37ujpy,0.11ugbp,10.88uinr,0.19ucad,0.14uchf,0.19uaud,0.2usgd,4.62uthb,1.25usek"
33+
```
34+
35+
Reference: https://discord.com/channels/566086600560214026/566126728578072586/842861299012468756
36+
37+
Make sure that the data folder points to the actual files by creating a symbolic link to the folder.
38+
39+
ln -s /mnt/columbus-a/data ~/.terrad/data
40+
41+
The daemon can now be started to run through the blocks.
42+
43+
terrad start
44+
45+
# Client
46+
47+
## Create the keys
48+
49+
This usually just needs to be done the first time the validator is being set up.
50+
51+
terracli keys add <keyName>
52+
53+
## Configure the client
54+
55+
```
56+
terracli config node tcp://localhost:26657
57+
terracli config trust-node true
58+
```
59+
60+
Run just one of the following commands:
61+
62+
```
63+
terracli config chain-id columbus-4 # Mainnet
64+
terracli config chain-id tequila-0004 # Testnet
65+
```
66+
67+
## Create the validator
68+
69+
```
70+
terracli tx oracle set-feeder terra139ycju27xcek7n2ulew308p28pdh6a6mdqac5a --from=terra1rjmzlljxwu2qh6g2sm9uldmtg0kj4qgyy27m6x --fees 33954000ukrw
71+
```
72+
73+
## Configure the oracle feeder
74+
75+
terracli tx oracle set-feeder terra139ycju27xcek7n2ulew308p28pdh6a6mdqac5a --from=terra1rjmzlljxwu2qh6g2sm9uldmtg0kj4qgyy27m6x --fees 33954000ukrw
76+
77+
```
78+
cd $FEEDER_PATH
79+
npm start update-key
80+
```
81+
82+
Requires the mnemonic.
83+
84+
This creates a file voter.json
85+
86+
cd /home/terrau/oracle-feeder/feeder
87+
/usr/local/bin/npm start vote --\
88+
--source http://localhost:8532/latest \
89+
--lcd https://lcd.terra.dev \
90+
--chain-id "${CHAIN_ID}" \
91+
--denoms sdr,krw,usd,mnt,eur,cny,jpy,gbp,inr,cad,chf,hkd,aud,sgd,thb \
92+
--validator "${VALIDATOR_KEY}" \
93+
--password "${ORACLE_PASS}" \
94+
--gas-prices 169.77ukrw

terra/configure.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

terra/gcloud/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Note: This will require the Compute API to be turned on. Before it can be turned
5555
```bash
5656
GCP_PROJECT_NAME=terra-col-1 #gcloud config get-value project
5757
GCP_ZONE=asia-southeast1-b
58-
GCP_NODE_VAL=validator1-terra
58+
GCP_NODE_VAL=terra-validator
5959
GCP_DISK_VALIDATOR=columbus-a
6060
GCP_IAM_EMAIL=$(gcloud iam service-accounts list --format="value(email)")
6161
MOINT_POINT=/mnt/columbus-a

terra/includes.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

terra/root1.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
if [[ -z "${TERRA_USER}" ]]; then
44
echo "ERROR: Environment variable 'TERRA_USER' must be defined first. E.g."
5-
echo " export TERRA_USER=terrau"
5+
echo " export TERRA_USER=terra"
66
exit
77
fi
88

terra/root2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ echo -n "> Changing default SSH port, password login, and root configurations...
3535

3636
sed -i'.bak1' -e 's/^PasswordAuthentication /#PasswordAuthentication /' /etc/ssh/sshd_config
3737
sed -i'.bak2' -e 's/^PermitRootLogin /#PermitRootLogin /' /etc/ssh/sshd_config
38-
echo "Port 9560" >> /etc/ssh/sshd_config
38+
echo "Port 9876" >> /etc/ssh/sshd_config
3939
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
4040
echo "PermitRootLogin no" >> /etc/ssh/sshd_config
4141
systemctl restart sshd

0 commit comments

Comments
 (0)