Skip to content

Commit

Permalink
Made the docs better and fixed the port in validator systemd (#147)
Browse files Browse the repository at this point in the history
* Add copy button

* Add copy button

* Add Copy button

* Add Copy button and fix port on validator systemd

* add daemon-reload on systemd validator

* add copy button

* add copy button and simplify creating services

* add copy button and simplify creating services

* add copy button

* add copy button and label

* add copy button

* add copy button

* add copy button
  • Loading branch information
Megumiiiiii authored Oct 4, 2023
1 parent 1c228d6 commit ee6b6e9
Show file tree
Hide file tree
Showing 22 changed files with 340 additions and 371 deletions.
2 changes: 1 addition & 1 deletion pages/docs/ecosystem-roles/relayer/anchor-update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ An example configuration file for the Goerli network that is configured for gove
You will need to update the linked-anchors and contract addresses for the applicable chains.
</Callout>

```
```sh filename="config file" copy
[[evm.goerli.contracts]]
contract = "VAnchor"
address = "0x03b88eD9Ff9bE84e4baD3F55D67AE5ABA610523C"
Expand Down
2 changes: 1 addition & 1 deletion pages/docs/ecosystem-roles/relayer/data-querying.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ An example configuration file for the Goerli network that is configured for gove
You will need to update the linked-anchors and contract addresses for the applicable chains.
</Callout>

```
```sh filename="config file" copy
[[evm.goerli.contracts]]
contract = "VAnchor"
address = "0x03b88eD9Ff9bE84e4baD3F55D67AE5ABA610523C"
Expand Down
2 changes: 1 addition & 1 deletion pages/docs/ecosystem-roles/relayer/private-tx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ An example configuration file for the goerli network and VAnchor contract should
You will need to update the linked-anchors and contract addresses for the applicable chains.
</Callout>

```
```sh filename="config file" copy
[[evm.goerli.contracts]]
contract = "VAnchor"
address = "0x03b88eD9Ff9bE84e4baD3F55D67AE5ABA610523C"
Expand Down
18 changes: 9 additions & 9 deletions pages/docs/ecosystem-roles/relayer/running-relayer/cli-usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ to the end of the command. The command will vary depending on how you choose to
<Tabs items={["docker", "systemd"]} storageKey="selected-binary">
<Tab>

```
```sh filename="docker run" copy
docker run --platform linux/amd64 ghcr.io/webb-tools/relayer:0.5.0-rc1 --help
```

</Tab>
<Tab>

```
```sh filename="help" copy
# If you used the release binary from github
./webb-relayer --help

Expand All @@ -37,13 +37,13 @@ to the end of the command. The command will vary depending on how you choose to

Start the relayer from a config file:

```
```sh filename="config file" copy
webb-relayer -vvv -c <CONFIG_FILE_PATH>
```

USAGE:

```
```sh filename="usage" copy
webb-relayer [FLAGS] [OPTIONS]
```

Expand All @@ -55,31 +55,31 @@ The below lists outlines the available flags for your convienance.

Prints help information

```sh
```sh filename="help" copy
webb-relayer --help
```

#### `--tmp`

Create the Database Store in a temporary directory and will be deleted when the process exits

```sh
```sh filename="tmp" copy
webb-relayer --tmp
```

#### `--version`

Prints relayer version information

```sh
```sh filename="version" copy
webb-relayer --version
```

#### `--verbose`

A level of verbosity, and can be used multiple times

```sh
```sh filename="vvvv" copy
webb-relayer --vvvv
```

Expand All @@ -89,6 +89,6 @@ webb-relayer --vvvv

Directory that contains configration files

```sh
```sh filename="config-dir" copy
webb-relayer --config dir ./config
```
53 changes: 27 additions & 26 deletions pages/docs/ecosystem-roles/relayer/running-relayer/cloud-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ Following the instructions below, you will be able to run the relayer as a syste

**Update Ubuntu packages**

```
```sh filename="apt update" copy
# Update ubuntu packages
sudo apt update && sudo apt upgrade
```

**Update Snap package**

```
```sh filename="apt install" copy
# Update snap packages
sudo apt install -y snapd
sudo snap install core; sudo snap refresh core
```

**Install dependencies**

```
```sh filename="apt install" copy
# Install dependencies
sudo apt install gcc cmake pkg-config libssl-dev git clang libclang-dev
sudo apt install build-essential
```

**Install Rust**

```
```sh filename="rust" copy
# Install rust
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH=~/.cargo/bin:$PATH
Expand All @@ -59,14 +59,14 @@ source ~/.cargo/env

**Install Certbot**

```
```sh filename="certbot" copy
# Install certbot
sudo snap install --classic certbot && sudo ln -s /snap/bin/certbot /usr/bin/certbot
```

**Build Relayer from source**

```
```sh filename="build" copy
# Build from source
git clone https://github.com/webb-tools/relayer.git
cd relayer && cargo build --release --features cli
Expand All @@ -78,17 +78,13 @@ cd relayer && cargo build --release --features cli

Let's first create a service file for the relayer:

```
# Create the service file
sudo touch /etc/systemd/system/webb-relayer.service
```

Next, we will paste the following into the service file, and replace the `<user>` with the user that will be running the relayer:

```
# This assumes the repo has been cloned in the home directory of the user
# Paste the following into the service file, and replace the <user>:
- This assumes the repo has been cloned in the home directory of the user
- Paste the following into the service file, and replace the `<user>`:

```
sudo tee /etc/systemd/system/webb-relayer.service > /dev/null << EOF
[Unit]
Description=WebbRelayer
Expand All @@ -99,11 +95,12 @@ ExecStart=cargo run --features cli --bin webb-relayer -- -c /home/<user>/relayer
[Install]
WantedBy=multi-user.target
EOF
```

2. Enable and start the system service:

```
```sh filename="enable & start" copy
sudo systemctl enable webb-relayer && sudo systemctl start webb-relayer
```

Expand All @@ -113,15 +110,15 @@ sudo systemctl enable webb-relayer && sudo systemctl start webb-relayer

2. Install nginx if it isn't already on your machine:

```
```sh filename="nginx" copy
sudo apt install nginx
```

**First, we will configure the endpoint linked to your domain name at port 80 for certificate generation**

3. Create nginx site files for your domain:

```
```sh filename="site files" copy
cd /etc/nginx/sites-available &&

sudo cp default <domain name> &&
Expand All @@ -131,7 +128,7 @@ sudo ln -s /etc/nginx/sites-available/<domain name> /etc/nginx/sites-enabled/

4. Modify the nginx sites-available file to:

```
```console filename="default" copy
server {
listen 80;
listen [::]:80;
Expand All @@ -149,27 +146,27 @@ server {

5. Check the nginx configuration

```
```sh filename="status nginx" copy
sudo nginx -t
```

6. If no issues exist, restart the nginx service:

```
```sh filename="restart nginx" copy
sudo systemctl restart nginx
```

**Next we will create the self-signed certificate and reconfigure for https and wss support**

7. Create the self-signed certificate:

```
```sh filename="certonly" copy
sudo certbot certonly --nginx
```

8. Modify the nginx site file:

```
```sh filename="site file" copy
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
Expand Down Expand Up @@ -207,19 +204,23 @@ server {

9. Check Nginx configuration and restart the service:

```
```sh filename="restart nginx" copy
sudo nginx -t && sudo systemctl restart nginx
```

### Monitoring Setup

Relayers will want to setup monitoring to ensure maximum uptime and automatic restarts when things go awry.

1. `sudo apt install -y monit`
1. Install monit

```sh filename="install monit" copy
sudo apt install -y monit
```

2. modify the monitrc file at: `/etc/monit/monitrc`

```
```sh filename="monitrc" copy
set httpd port 2812 and
use address localhost
allow localhost
Expand All @@ -243,7 +244,7 @@ check process webb-relayer matching target/release/webb-relayer
3. restart monit and validate:
```
```sh filename="restart & validate" copy
sudo monit reload && sudo monit validate
```
Expand Down
24 changes: 12 additions & 12 deletions pages/docs/ecosystem-roles/relayer/running-relayer/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Before you begin, ensure that you have the following prerequisites:

1. Open your terminal and run the following command to download the latest version of the relayer:

```bash
```sh filename="download latest version" copy
curl -fsSL https://git.io/get-webb-relayer.sh | sh
```

The script will download the relayer binary (or update it if it already exists) and place it in your `$HOME/.webb` directory. The script will also suggest adding the directory to your `PATH` environment variable.

Alternatively, if you wish to download a specific version of the relayer, run the following command:

```bash
```sh filename="download specific version" copy
curl -fsSL https://git.io/get-webb-relayer.sh | sh -s <version>
```

Expand All @@ -48,7 +48,7 @@ will also suggest adding the directory to your `PATH` environment variable.

2. Verify that the relayer was installed successfully by running the following command:

```bash
```sh filename="verify version" copy
~/.webb/webb-relayer --version
```

Expand All @@ -71,14 +71,14 @@ To download the example configuration file, run the following command:
<Tabs items={["Linux/WSL", "macOS"]} storageKey="selected-binary">
<Tab>

```bash
```sh filename="download" copy
curl -fsSL https://raw.githubusercontent.com/webb-tools/relayer/main/config/example/config.toml -o ~/.config/webb-relayer/config.toml
```

</Tab>
<Tab>

```bash
```sh filename="download" copy
curl -fsSL https://raw.githubusercontent.com/webb-tools/relayer/main/config/example/config.toml -o ~/Library/Application\ Support/tools.webb.webb-relayer/config.toml
```

Expand All @@ -100,7 +100,7 @@ For example, if you want to override the `port` value in the configuration file,

For example, to modify the `port` value using the environment variable, you can do the following:

```bash
```sh filename="export" copy
export WEBB_PORT=9955
```

Expand All @@ -110,7 +110,7 @@ For our example configuration file, the following environment variables are requ

create a new file called `.env` in the same directory as your current directory and add the following line:

```bash
```sh filename="PRIVATE_KEY" copy
# Hex-encoded private for the relayer (64 characters) prefixed with 0x
PRIVATE_KEY="0x..."
```
Expand All @@ -121,7 +121,7 @@ save the file and exit the editor.

To run the relayer, run the following command:

```bash
```sh filename="vvv" copy
~/.webb/webb-relayer -vvv
```

Expand All @@ -131,7 +131,7 @@ To run the relayer, run the following command:

You should see the following output:

```rust
```rust filename="output"
2023-03-14T14:13:08.315804Z DEBUG webb_relayer_config::cli: Getting default dirs for webb relayer
at crates/relayer-config/src/cli.rs:61

Expand Down Expand Up @@ -177,14 +177,14 @@ To verify that the relayer is running, you can use the `/api/v1/ip` endpoint:
<Tabs items={["Local", "Server"]} storageKey="selected-binary">
<Tab>

```bash
```sh filename="local" copy
curl http://localhost:9955/api/v1/ip
```

</Tab>
<Tab>

```bash
```sh filename="server" copy
curl http://<your-server-ip>:9955/api/v1/ip
```

Expand All @@ -193,7 +193,7 @@ To verify that the relayer is running, you can use the `/api/v1/ip` endpoint:

You should see the following output:

```json
```json filename="public-ip" copy
{"ip":"<your-public-ip>"}
```

Expand Down
Loading

0 comments on commit ee6b6e9

Please sign in to comment.