Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update detailed-instructions.md #87

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Open Libra Documentation

This is the source for the documentation hosted here:

👇👇👇👇👇👇👇👇👇👇
Expand All @@ -10,9 +11,8 @@ https://docs.openlibra.io
alternatively here:
https://0lnetworkcommunity.github.io/documentation/



# Maintainers

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

## Previewing pull requests
Expand All @@ -21,7 +21,9 @@ There's an automated build which happens on Pull Requests. For every current (no
`https://0lnetworkcommunity.github.io/documentation/pr-preview/pr-[YOUR PR ID]/`

### Installation

Open Libra core prefers Bun over NPM and Yarn (https://bun.sh/), but you can use any.

```
$ bun install
```
Expand All @@ -39,10 +41,12 @@ This command starts a local development server and opens up a browser window. Mo
```
$ bun run build
```

This command generates static content into the `build` directory and can be
served using any static contents hosting service.

#### Errors

`build` will intentionally throw errors if links cannot be resolved. Note that
on mac/windows/linux, paths may resolve differently, so you may get no errors on
a MacOs but it will on CI (linux).
a MacOs but it will on CI (linux).
Original file line number Diff line number Diff line change
@@ -1,73 +1,71 @@
---
title: "Running a Validator"
sidebar_label: 'Running a Validator'
title: "Running a Validator Node"
sidebar_label: 'Running a Validator Node'
sidebar_position: 3
---

# Running a Validator
# **Running a Validator Node.**
Running a VFN-Validator Fullnode Network/Private Fullnode has a separate guide.

### Requirements
- TWO unix hosts, one for Validator Node, and one for the Private Fullnode ("VFN").
libra code targets Ubuntu 22.04.
### **Requirements**
- TWO unix hosts: one for Validator Node and one for the VFN.
- Recommended specs:
- Validator: 300GB SSD harddrive, 8 core CPU, 16G RAM
- Validator Node: 300GB SSD harddrive, 8 core CPU, 16G RAM
- VFN: 100G storage, 8 core CPU, 16G RAM
- Separate static IP addresses for the machines, or appropriate DNS mapping.

### **Libra code targets Ubuntu 22.04.**

### Firewall
:::note
During testnet and devnet operation, you will likely open port `8080` on your Validator to allow outside access to the RPC endpoint, which is an API that runs as part of the libra service.
During testnet and devnet operation, you will likely open port `8080` on your Validator Node to allow outside access to the RPC endpoint, which is an API that runs as part of the libra service.
VFNs and public fullnodes should by default serve port `8080` RPC for operability.
:::

#### Validator
#### **Validator Node**

The following ports must be open: `6180`, `6181`
The following ports must be open: `6180`, `6181`, meaning:

- `6180` should be open on all interfacess `0.0.0.0/0`, it's for consensus and uses noise encryption.
- `6181` is for the private validator fullnode network ("VFN"), the firewall should only allow the IP of the fullnode to access this port.
- `6181` is for the VFN, the firewall should only allow the **IP of the Validator node** to access this port.

#### VFN
#### **VFN**
:::note
This node does not serve transactions and does not participate in consensus, it relays data out of the validator node, and transactions into the validator.
:::

The following ports must be open: `6181`, `6182`, `8080`
The following ports must be open: `6181`, `6182`, `8080`, meaning:

- `6181` is for the private validator fullnode network ("VFN"), it should only allow traffic from the Validator node IP address above.
- `6181` is for the VFN, it should only allow traffic from the Validator Node IP address above.
- `6182` is for the the PUBLIC fullnode network. This is how the public nodes that will be serving JSON-RPC on the network will receive data and submit transactions to the network.
- `8080` is the RPC port and we suggest VFNs and public fullnodes to serve this port by default for operability.

## **Setting up a Validator**

## Setting up a Validator

These instructions target Ubuntu.
These instructions target Ubuntu 22.04.

1.1. Set up an Ubuntu host with `ssh` access, e.g. in a cloud service provider.

1.2. Associate a static IP with your host, this will be tied to you account. This address will be shared on the chain, so that other nodes will be able to find you through the peer discovery mechanism.

1.3. Libra binaries should be run in a linux user that has very narrow permissions. Before you can create binaries you'll need some tools installed probably by `sudo` and likely in root.
1.2. Associate a static IP with your host, this will be tied to you account. This address will be shared on the chain, so that other nodes will be able to find you through the peer discovery mechanism. Libra binaries should be run in a linux user that has **very narrow permissions**. Before you can create binaries you'll need some tools installed probably by `sudo` and likely in root.

1.4. Use `tmux` to persist the terminal session for build, as well as for running the nodes and tower app. Also this setup requires `git` and `make`, which might be installed already on your host. If not, perform the following steps now:
1.3. Use `tmux` to persist the terminal session for build, as well as for running the nodes and tower app. Also this setup requires `git` and `make`, which might be installed already on your host. If not, perform the following steps now:

```bash
sudo apt update
sudo apt install -y git tmux jq build-essential cmake clang llvm libgmp-dev pkg-config libssl-dev lld libpq-dev
```


1.5. Install Rust
1.4. Install Rust

```bash
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y

# restart your bash instance to pickup the cargo paths

source ~/.bashrc
```


### Create Binaries
1.5. Create Binaries

It is recommended to perform the steps from 1.7 onwards inside tmux. Short tmux instruction:

Expand All @@ -78,67 +76,72 @@ It is recommended to perform the steps from 1.7 onwards inside tmux. Short tmux
tmux new -t libra-setup
```

### TMUX basics

1. New session: `tmux new -t <SESSION_NAME>`
2. Detach from Session: press Ctrl-b and then d
3. rejoin unnamed session, if only one session exists: `tmux a`
4. rejoin unnamed session by id: `tmux ls` to get the ID and then `tmux a -t <SESSION_ID>`
5. rejoin named session: `tmux a -t <SESSION_NAME>`
6. kill session: attach to the session --> press Ctrl-b, then type `:kill-session` and press ENTER
# You can read more about tmux commands here: (https://github.com/tmux/tmux/wiki/Getting-Started).

1.7 Clone this repo:
```
git clone https://github.com/0LNetworkCommunity/libra-framework
# go to libra-framework directory
cd ~/libra-framework
```
1.8 Build the source and install binaries:
This takes a while, ensure your are still inside the `tmux` session to avoid your session gets disconnected.

```bash
cargo build --release -p libra
```
This takes a while, ensure your are still inside the `tmux` session to avoid your session gets disconnected.


1.9 Making the `libra` binary globally executable and persistent
1.9 Making the `libra` binary globally executable and persistent by copying libra binaries to cargo bins path

:::note
This assumes the `libra` binary is already built and located at `~/libra-framework/target/release/libra`.
:::
```
# Copy libra binaries to cargo bins path
sudo cp -f ~/libra-framework/target/release/libra* ~/.cargo/bin/

# Check libra execution and version

libra version
```



### You will now need [sync your validator to the latest block](/validators/restore) and [register your validator](/validators/register).

#### Start Node
## Start Node

`libra node --config-path ~/.libra/validator.yaml`

### Setup as a service(optional)


**Install Service**
:::note
use can this service template instead of running in tmux
:::
`sudo nano /lib/systemd/system/libra-node.service`


#### Systemd template

```
[Unit]
Description=Libra Node Service

[Service]
User=nodeuser
Group=nodeuser
User=`nodeuser`
Group=`nodeuser`

LimitNPROC=1048576
LimitNOFILE=1048576

#Environment="RUST_LOG=warn"
WorkingDirectory=/home/nodeuser/.libra
ExecStart=/home/nodeuser/libra-framework/target/release/libra node --config-path /home/nodeuser/.libra/validator.yaml
WorkingDirectory=/home/`nodeuser`/.libra
ExecStart=/`home/nodeuser`/libra-framework/target/release/libra node --config-path /`home/nodeuser`/.libra/validator.yaml

# Your `/libra-framework/target/release/libra node` and `/.libra/validator.yaml` may be different depending on Your setup location.

Restart=on-failure
RestartSec=3s
Expand All @@ -152,31 +155,24 @@ WantedBy=multi-user.target
Alias=libra-node.service

# config the service and start

sudo systemctl enable libra-node
sudo systemctl start libra-node
```

**Reload and start system service**
**Reload system service**

`sudo systemctl daemon-reload`

**Enable system service**

`sudo systemctl enable libra-node`

**Start system service**

`sudo systemctl start libra-node`

**Check the service is operating correctly**

`sudo systemctl status libra-node`



### TMUX basics

1. New session: `tmux new -t <SESSION_NAME>`
2. Detach from Session: press Ctrl-b and then d
3. rejoin unnamed session, if only one session exists: `tmux a`
4. rejoin unnamed session by id: `tmux ls` to get the ID and then `tmux a -t <SESSION_ID>`
5. rejoin named session: `tmux a -t <SESSION_NAME>`
6. kill session: attach to the session --> press Ctrl-b, then type `:kill-session` and press ENTER

---
Loading