Skip to content

Commit

Permalink
bash code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
racollette committed Apr 27, 2023
1 parent 50abe6b commit cda82ba
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion docs/2.learn/mainchain/bpos.md
Expand Up @@ -86,7 +86,7 @@ Stakers should consider the following factors when selecting a validator:

1. **Mining reward**

The higher the total staking rights, the lower the staking return. Stakers should select validators with relatively low staking rights.
Mining rewards are only paid out on nodes with at least 80,000 staking rights, however the higher the total staking rights, the lower the staking return. Stakers should select validators with relatively low staking rights.

2. **Critical value of the validator's total staking rights**

Expand Down
44 changes: 22 additions & 22 deletions docs/5.nodes/advanced.md
Expand Up @@ -20,26 +20,26 @@ node.sh supports:
- **Elastos Network**: Mainnet
- [**Chains**](/nodes/overview): Elastos mainchain, sidechains, oracles, and the arbitrator

To begin, create a folder in your $HOME to hold executable files, config files, and data files.
To begin, create a folder in your HOME to hold executable files, config files, and data files.

```bash
$ mkdir ~/node
$ cd ~/node
mkdir ~/node
cd ~/node
```

Download the current version of the script and make it executable.

```bash
$ curl -O https://raw.githubusercontent.com/elastos/Elastos.Node/master/build/skeleton/node.sh
$ chmod a+x node.sh
curl -O https://raw.githubusercontent.com/elastos/Elastos.Node/master/build/skeleton/node.sh
chmod a+x node.sh
```

## Run node.sh

Run the script without any arguments to display the usage.

```bash
$ ~/node/node.sh
~/node/node.sh
```

If the output is similar to the following, then the installation is good.
Expand Down Expand Up @@ -103,7 +103,7 @@ The binary releases are listed for reference. Normally you don't need to manuall
The `init` command without specifying the chain program name will process the following programs (chains) in one go.

```bash
$ ~/node/node.sh init
~/node/node.sh init
```

As an alternative, you can also run the init command one by one.
Expand All @@ -113,7 +113,7 @@ As an alternative, you can also run the init command one by one.
Starting a single program.

```bash
$ ~/node/node.sh ela start
~/node/node.sh ela start
Starting ela...
ela v0.8.3 Running
...
Expand All @@ -124,7 +124,7 @@ Please note that it takes some time to validate the database.
Checking program status.

```bash
$ ~/node/node.sh ela status
~/node/node.sh ela status
ela v0.8.3 Running
Disk: 360M
PID: 120480
Expand Down Expand Up @@ -160,14 +160,14 @@ Please note that not all chains/programs have the same set of status items. For
By running the **start** command without chain/program name. All installed chains/programs will be started in a predefined order.

```bash
$ ~/node/node.sh start
~/node/node.sh start
[ ... many messages follow ... ]
```

If you wish to check processes status, the resources usage and other metrics.

```
$ ~/node/node.sh status
~/node/node.sh status
[ ... many messages follow ... ]
```

Expand All @@ -176,7 +176,7 @@ $ ~/node/node.sh status
Now you can check all chain **versions** under Available Chains.

```bash
$ ~/node/node.sh status
~/node/node.sh status
```

```bash
Expand Down Expand Up @@ -270,7 +270,7 @@ Disk: 5.2M
Enter the command to open the user-level crontab editor. You may be asked to select an editing program. 

```bash
$ crontab -e
crontab -e
```

Append the following entry to the existing crontab, save and exit.
Expand All @@ -289,15 +289,15 @@ You may prefer to add multiple start commands if you have not install all the co
Checking the current crontab by running:

```bash
$ crontab -l
crontab -l
```

## Stopping nodes

Stopping a single chain or programs:

```bash
$ ~/node/node.sh esc stop
~/node/node.sh esc stop
esc 84b1c5e Stopped
```

Expand All @@ -306,7 +306,7 @@ Some chains, especially a busy ESC node, may take a pretty long time to fully ex
Stopping all programs or chains have been installed.

```bash
$ ~/node/node.sh stop
~/node/node.sh stop
[ ... many messages follow ... ]
```

Expand All @@ -317,14 +317,14 @@ Different chains and programs share similar output formats after being stopped.
Installing **tree** utility to list contents of directories in a tree-like format.

```bash
$ sudo apt-get install -y tree
sudo apt-get install -y tree
[ ... many outputs ... ]
```

If all things work well, you should have the following directory.

```bash
$ tree -L 2 ~/node
tree -L 2 ~/node
~/node # root
├── arbiter # arbiter folder
│ ├── arbiter # arbiter program
Expand Down Expand Up @@ -379,7 +379,7 @@ Please some directories marked with asterisks are running data and logs files, w
If you had already installed the script several weeks ago, it is better to update to get the latest fixes or features.

```bash
$ ~/node/node.sh script_update
~/node/node.sh script_update
```

It will fetch the latest script from the repository, overwrite the old file, and make it executable.
Expand All @@ -393,15 +393,15 @@ OK: $HOME/node/node.sh updated
Run the new node.sh to see if there are any updates on command-line options.

```bash
$ ~/node/node.sh
~/node/node.sh
```

## Updating an individual node

We can **update a single program** (chain). For example, to update Elastos ELA, please run the following command.

```bash
$ ~/node/node.sh ela update
~/node/node.sh ela update
```

Step 1: The script will contact the [download server](https://download.elastos.io/elastos-ela/) to find the **latest version**.
Expand Down Expand Up @@ -457,7 +457,7 @@ Please check the **version** to make sure of a successful program update.
The **compress_log** will gzip the old log files to save disk space. It will not touch the latest log files, because they are opened by the corresponding daemon programs.

```
$ ./node/node.sh esc compress_log
./node/node.sh esc compress_log
Compressing log files in /home/ubuntu/node/esc/data/geth/logs/dpos...
Compressing log files in /home/ubuntu/node/esc/data/logs-spv...
Compressing log files in /home/ubuntu/node/esc/logs...
Expand Down
34 changes: 17 additions & 17 deletions docs/5.nodes/faq.md
Expand Up @@ -7,8 +7,8 @@ title: Supernode FAQ
jq is required to parse JSON config files. Install it by running the following commands:

```bash
$ sudo apt-get update -y
$ sudo apt-get install -y jq
sudo apt-get update -y
sudo apt-get install -y jq
```

### Do I need to install all chains or programs?
Expand All @@ -21,29 +21,29 @@ If you just wish to run a normal BPoS supernode, only ELA is required.

```bash
# Show ELA wallet address and public key
$ cd ~/node/ela
$ cat ~/.config/elastos/ela.txt | ./ela-cli wallet account
cd ~/node/ela
cat ~/.config/elastos/ela.txt | ./ela-cli wallet account
```

or you can check with:

```bash
$ ~/node/node.sh ela status
~/node/node.sh ela status
```

### How to check the current height of an ELA node?

```bash
$ ~/node/node.sh ela status | grep Height
~/node/node.sh ela status | grep Height
```

ELA daemon will verify the database when booting, this may take several minutes. The height will be shown as N/A before the verification is completed.

To check the progress of the verification, you can run:

```bash
$ cd ~/node/ela/elastos/logs/node
$ tail -f *.log | grep 'BLOCKCHAIN INITIALIZE'
cd ~/node/ela/elastos/logs/node
tail -f *.log | grep 'BLOCKCHAIN INITIALIZE'
[ ========== BLOCKCHAIN INITIALIZE STARTED ========== ]
[ ========== BLOCKCHAIN INITIALIZE FINISHED ========== ]
# CTRL+C to stop
Expand All @@ -56,8 +56,8 @@ The ELA BPoS supernode did not have normal consensus work within 1440 blocks, an
**Activate Node**

```bash
$ ~/node/ela/ela-cli wallet buildtx activate --nodepublickey nodepublickey
$ ~/node/ela/ela-cli --rpcuser user123 --rpcpassword pass123 wallet sendtx -f ready_to_send.txn
~/node/ela/ela-cli wallet buildtx activate --nodepublickey nodepublickey
/node/ela/ela-cli --rpcuser user123 --rpcpassword pass123 wallet sendtx -f ready_to_send.txn
```

### How to check node normal consensus? How to verify all daemons are working properly?
Expand Down Expand Up @@ -98,15 +98,15 @@ The possible reasons may include:
Check versions and issue an [update](/nodes/advanced/#updating-an-individual-node) if required.

```bash
$ node/node.sh status
node/node.sh status
```

- [x] **The disk space is not sufficient.**

Check the disk usage and increase it if required.

```bash
$ df -h
df -h
```

- [x] **The database is corrupted**.
Expand All @@ -126,18 +126,18 @@ This error may occur because of abnormal shutting down of the server or daemon p
Take ELA as an example, you need to stop the daemon, purge the database related folder, and restart it.

```bash
$ ~/node/node.sh ela stop
$ rm -rf ~/node/ela/elastos/data
$ ~/node/node.sh ela start
~/node/node.sh ela stop
rm -rf ~/node/ela/elastos/data
~/node/node.sh ela start
```

### What to do if a chain daemon is not started?

Check the free memory and disk space:

```bash
$ free -h
$ df -h
free -h
df -h
```

### Can't find what you're looking for?
Expand Down
2 changes: 1 addition & 1 deletion docs/5.nodes/hive/direct-deploy.md
Expand Up @@ -9,7 +9,7 @@ Hive Node also supports installation in normal installation mode.
At present, Hive Node automatically installs all Hive Node sub-services through scripted operation:

```bash
$ ./run.sh direct
./run.sh direct
```

This command will do the following:
Expand Down
16 changes: 8 additions & 8 deletions docs/5.nodes/hive/docker-deploy.md
Expand Up @@ -12,9 +12,9 @@ In principle, Hive Node can be deployed in any Linux system, but currently, the
Assumed the Docker and Python3 already shipped on your system. Otherwise, you need to install them manually. Generally, there is python3.6 already built inside Ubuntu 22.04. To Docker, you can run the following commands to install it:

```bash
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo usermod -aG docker your-userid
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker your-userid
```

:::info Notice
Expand All @@ -25,22 +25,22 @@ You will need to sign out from the target server and log in again to make Docker
Download the latest version of packages and untar it onto your server. At the time of this writing, you can run the commands as below:

```bash
$ curl -fsL https://github.com/elastos/Elastos.NET.Hive.Node/archive/release-v2.0.1.tar.gz -o release.tar.gz
$ tar -xzvf release.tar.gz
curl -fsL https://github.com/elastos/Elastos.NET.Hive.Node/archive/release-v2.0.1.tar.gz -o release.tar.gz
tar -xzvf release.tar.gz
```

3. Start the Installation

Enter into the source code folder and directly run the command to install the Hive node service:

```bash
$ /bin/bash -c "$(curl -fsSL https://www.trinity-tech.io/hivenode/scripts/run.sh)" -s docker
/bin/bash -c "$(curl -fsSL https://www.trinity-tech.io/hivenode/scripts/run.sh)" -s docker
```

After the above steps have been finished, use the following command to check whether the Hive Node functions or not. If successful, it will display two container instances. One is hive-node, and the other is MongoDB.

```bash
$ docker ps
docker ps
```

4. Run the test-cases
Expand All @@ -56,7 +56,7 @@ Run the next command to launch test-cases to verify the deployed node at the sam
At present, Hive Node automatically installs all Hive Node sub-services through scripted operation, and this script comes from the source code root directory of Hive Node.

```bash
$ ./run.sh docker
./run.sh docker
```

This command will do the following:
Expand Down
18 changes: 9 additions & 9 deletions docs/5.nodes/quick-setup.md
Expand Up @@ -31,10 +31,10 @@ echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab
The following shell command will **download** the current version of the **script** and make it **executable**.

```bash
$ mkdir ~/node
$ cd ~/node
$ curl -O https://raw.githubusercontent.com/elastos/Elastos.Node/master/build/skeleton/node.sh
$ chmod a+x node.sh
mkdir ~/node
cd ~/node
curl -O https://raw.githubusercontent.com/elastos/Elastos.Node/master/build/skeleton/node.sh
chmod a+x node.sh
```

### 3. Initialize the ELA Program
Expand All @@ -46,7 +46,7 @@ The **init** command will do the following jobs automatically:
3. Writes the config files required

```bash
$ ~/node/node.sh ela init
~/node/node.sh ela init
```

```
Expand Down Expand Up @@ -75,29 +75,29 @@ OK: ela initialized
The `init` command will try to find the server's public IP automatically, and record the result in ela config file. You can check it by running:

```bash
$ cat ~/node/ela/config.json | jq .Configuration.DPoSConfiguration.IPAddress
cat ~/node/ela/config.json | jq .Configuration.DPoSConfiguration.IPAddress
```

### 4. Start the ELA Program

The **start** command will start the `ELA` program in the background. This will begin synchronizing block data on the mainchain. This may take several hours to complete.

```bash
$ ~/node/node.sh ela start
~/node/node.sh ela start
```

### 5. Check the Status

The **status** command will show all programs (chains) that are currently running. Watch the **height** to make sure the chain(s) is synchronized.

```bash
$ ~/node/node.sh status
~/node/node.sh status
```

To check the **status** of only the mainchain, use:

```bash
$ ~/node/node.sh ela status
~/node/node.sh ela status
```

Now the initial **setup is complete**.
Expand Down

0 comments on commit cda82ba

Please sign in to comment.