Skip to content

Commit

Permalink
Livepeer.Cloud SPE Milestone #1 Deliverables: Add Gateway Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikezupper committed Apr 26, 2024
1 parent 85569c6 commit de30783
Show file tree
Hide file tree
Showing 9 changed files with 574 additions and 1 deletion.
176 changes: 176 additions & 0 deletions gateways/guides/docker-install.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
---
title: Docker Install
icon: download
---

# Install & Configure Docker

## Key folder structure

Livepeer will require files to be placed on the host and within the docker
container. Here is a list of the key folders used by the docker install.

### Host Folders

By default, docker will store all volumes in the `/var/lib/docker/volumes`
directory

This installation will create a volume called: `gateway-lpData` and it will
be located at `/var/lib/docker/volumes/gateway-lpData/_data`

### Container Folders

Within the docker container, the volume `gateway-lpData` will be mounted at
`/root/.lpData`

## Install Prerequisites

If docker is already installed, you can skip this step. The installation assumes
you are running Docker 20.10.x. If an older version of docker is installed
remove it with the following command:

As the root user (or sudo), run the following:

```
apt remove docker*
```

Install Docker

```
curl https://releases.rancher.com/install-docker/20.10.sh | sh
```

Create a Docker volume

```
docker volume create gateway-lpData
```

Create Docker Compose file from the root user's home directory _/root/_

```
nano docker-compose.yml
```

Copy and paste the following and save the following

```
version: '3.9'
services:
gateway:
image: livepeer/go-livepeer:<RELEASE_VERSION>
container_name: "gateway"
hostname: "gateway"
ports:
- 1935:1935
- 8935:8935
volumes:
- gateway-lpData:/root/.lpData
command: '-ethUrl=https://arb1.arbitrum.io/rpc/
-ethKeystorePath=/root/.lpData
-network=arbitrum-one-mainnet
-cliAddr=gateway:5935
-broadcaster=true
-monitor=true
-v=99
-blockPollingInterval=20
-maxPricePerUnit=300
-pixelsPerUnit=1
-rtmpAddr=0.0.0.0:1935
-httpAddr=0.0.0.0:8935
'
volumes:
gateway-lpData:
external: true
```

# Create Livepeer Gateway ETH account

In this step we need to start the Gateway in order to create an Ethereum
account.

```
docker compose run -it gateway
```

When prompted for the ETH password, enter a strong password to secure your
Ethereum account. This password is used to decrypt and access the ETH private
key. **Make sure to never share or lose access to either the password or the
keystore file.**

**Note:** _Keep this password handy, we will use it in the following steps._

After you see the message that the Ethereum account has been unlocked, CTRL+C to
exit the Livepeer docker instance.

Using the previously created ETH password, create the eth-secret file

```
nano -p /var/lib/docker/volumes/gateway-lpData/_data/eth-secret.txt
```

# Modify Docker compose file to include eth-secret.txt

```
nano docker-compose.yml
```

Add the following line below the `-ethKeystorePath` and save

```
-ethPassword=/root/.lpData/eth-secret.txt
```

Here is the full modified version of the docker-compose.yml file

```
version: '3.9'
services:
gateway:
image: livepeer/go-livepeer:<RELEASE_VERSION>
container_name: "gateway"
hostname: "gateway"
ports:
- 1935:1935
- 8935:8935
volumes:
- gateway-lpData:/root/.lpData
command: '-ethUrl=<YOUR ARB APC>
-ethKeystorePath=/root/.lpData
-ethPassword=/root/.lpData/eth-secret.txt
-network=arbitrum-one-mainnet
-cliAddr=gateway:5935
-broadcaster=true
-monitor=true
-v=99
-blockPollingInterval=20
-maxPricePerUnit=300
-pixelsPerUnit=1
-rtmpAddr=0.0.0.0:1935
-httpAddr=0.0.0.0:8935
'
volumes:
gateway-lpData:
external: true
```

Start Livepeer in the background

```
docker compose up -d
```

Launch the livepeer_cli

```
docker exec -it gateway /bin/bash
livepeer_cli -host gateway -http 5935
```

Jump to
[Configure Transcoding Options](/gateways/guides/transcoding-options) to
finish configuring the Gateway

57 changes: 57 additions & 0 deletions gateways/guides/fund-gateway.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Fund The Livepeer Gateway
icon: ethereum
description:
The following steps will walk you through adding funds to the newly created
ETH account. This includes funding the ETH account on Ethereum Mainnet,
bridging the funds to Arbritrum's L2 Network, and finally using the Livepeer
CLI to allocate the proper deposit and reserve amounts.
---

# Add Funds to Gateway Wallet

In order to use the Gateway you need to send ETH to your Gateway address
on Ethereum Mainnet and then bridged to Arbitrum's L2 Network.

**_Note:_**

- _if you have ETH on the Arbitrum L2 Network, you can simply transfer the funds
to the newly created Gateway ETH Account._
- _Livepeer runs on the Arbitrium's L2 Network and requires the funds to be
bridged._

# Bridge Funds to Arbitrum

If you need to bridge ETH you can use the official bridge
https://bridge.arbitrum.io/ or use an exchange that supports L2 transfers. For additonal
information on bridging view the [Livepeer bridging guide.](/delegators/guides/bridge-lpt-to-arbitrum)

Once you have ETH on the Arbitrum network, transfer it to your newly created
Gateway address.

# Deposit Gateway Funds via Livepeer CLI

We now need to divide the Gateway funds into a **Deposit** and **Reserve**

In this guide we are using a total of 0.1 ETH. This is minimum recommended and
best suited for testing.

To calculate the price your Gateway will pay for transcoding, divide the
_Reserve_ amount by 100. In our example each payment will be 0.0003 ETH (0.03
/ 100)

As you pay for transcoding the amount paid is subtracted from your _Deposit_, so
make sure to monitor your _Deposit_ balance and top it off to keep your
Gateway transcoding.

## Open the Livepeer CLI

Open the Livepeer CLI by following the instructions for your platform.

Choose **Option 11. Invoke "deposit broadcasting funds" (ETH)**

- Enter 0.065 for the **Deposit** and 0.03 for the **Reserve** amounts when
prompted.

Choose **Option 1. Get node status** and confirm that the correct amounts are
visible in the **BROADCASTER STATS** section.
53 changes: 53 additions & 0 deletions gateways/guides/gateway-overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Overview
description:
This guide will walk you through the Livepeer Gateway installation and
setup. Steps to install for Ubuntu Linux, Docker, and Windows are provided.
Choose the environment you want, follow install instructions, then continue to
the configuration section.


icon: Rocket
---
*Note the Livepeer Gateway was previously called the Livepeer Broadcaster so you will see some commands and labels still use the Broadcaster name that haven't been updated in the code.*
# Quick Links

[Docker Installation](/gateways/guides/docker-install)

[Linux Installation](/gateways/guides/linux-install)

[Windows Installation](/gateways/guides/windows-install)

[Configure Transcoding Options](/gateways/guides/transcoding-options)

[Fund the Livepeer Gateway](/gateways/guides/fund-gateway)

[Publish Content](/gateways/guides/publish-content)

[Playback Content](/gateways/guides/playback-content)

## Prerequisites

This guide assumes you are familiar with installing software on unix-based
systems. You should be comfortable with command-line syntax, Networking,
Firewalls, and containerized environments. You should have a basic understanding
of the Livepeer protocol. You dont have to be an expert, but troubleshooting
skills will come in handy. For more information view the go Livepeer [installation guide.](//orchestrators/guides/install-go-livepeer)



This guide was developed using:

- Ubuntu Linux 22.04
- Docker 20.10.14
- Windows
- Livepeer 0.7.2
- root user access (sudo is ok)

Have access to an Arbitrum RPC URL. This is required to run Livepeer.
Popular services include [Infura](https://www.infura.io/) and
[Alchemy](https://www.alchemy.com/). Be aware that these services have their
own pricing plans. That being said, the latest versions of livepeer should be able
to stay within the request limit for these provider's free tier at least for a single
node. As an alternative, you can self-host your own Arbitrum node, see the
[instructions from Offchain Labs](https://docs.arbitrum.io/node-running/how-tos/running-a-full-node).
77 changes: 77 additions & 0 deletions gateways/guides/linux-install.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: Linux Install
icon: download
---

# Download the Livepeer binary
```
sudo wget https://github.com/livepeer/go-livepeer/releases/download/<RELEASE_VERSION>/livepeer-linux-amd64.tar.gz
```
Unpack and remove the compressed file
```
sudo tar -zxvf livepeer-linux-amd64.tar.gz
sudo rm livepeer-linux-amd64.tar.gz
sudo mv livepeer-linux-amd64/* /usr/local/bin/
```
# Generate a new keystore file
```
/usr/local/bin/livepeer -network arbitrum-one-mainnet -ethUrl <ARBITRUM RPC URL> -gateway
exit
```
**When generating a new keystore file, the program will prompt you for a password. This password is used to decrypt the keystore file and access the private key. Make sure to never share or lose access to either the password or the keystore file**


# Create a file containing your Gateway Ethereum password
```
sudo mkdir /usr/local/bin/lptConfig
sudo nano /usr/local/bin/lptConfig/node.txt
```
Enter your password and save the file

# Create a system service

```
sudo nano /etc/systemd/system/livepeer.service
```
Paste and update the following startup script with your personal info:

```
[Unit]
Description=Livepeer
[Service]
Type=simple
User=root
Restart=always
RestartSec=4
ExecStart=/usr/local/bin/livepeer -network arbitrum-one-mainnet \
-ethUrl=<YOUR ARB RPC URL> \
-cliAddr=127.0.0.1:5935 \
-ethPassword=/usr/local/bin/lptConfig/node.txt \
-maxPricePerUnit=300 \
-broadcaster=true \
-serviceAddr=<INSERT YOUR IP ADDRESS>:8935 \
-transcodingOptions=/usr/local/bin/lptConfig/transcodingOptions.json \
-rtmpAddr=0.0.0.0:1935 \
-httpAddr=0.0.0.0:8935 \
-monitor=true \
-v 6
[Install]
WantedBy=default.target
```

Start the system service

```
sudo systemctl daemon-reload
sudo systemctl enable --now livepeer
```

Open the Livepeer CLI

```
livepeer_cli -host 127.0.0.1 -http 5935
```

Jump to [Configure Transcoding Options](/gateways/guides/transcoding-options) to finish configuring the Gateway
19 changes: 19 additions & 0 deletions gateways/guides/playback-content.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Playback Content
icon: circle-play
---

# Playback using VLC Media Player

This section explains how to view content from the Livepeer Gateway.
We will be using [VLC Media Player](https://videolan.org/).

1. Download and install [VLC Media Player](https://www.videolan.org/vlc/index.html)

2. Launch VLC Media Player

3. Select Media > Open Network Stream... (Ctrl-N)

4. Enter `http://<GATEWAY IP ADDRESS>:8935/stream/<YOUR STREAM KEY>.m3u8` as the network URL

5. Click "Play", and view the content from the `obs-studio` stream:

0 comments on commit de30783

Please sign in to comment.