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

feat: add a guide for running a node with a docker #311

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions apps/core/.vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ const SIDEBAR = {
{
text: "Node Guides",
items: [
{
text: "Run Testnet Node With Docker",
link: "/nodes/guides/docker",
},
{
text: "Run Local Devnet With Kurtosis",
link: "/nodes/guides/kurtosis",
Expand Down
132 changes: 132 additions & 0 deletions apps/core/content/nodes/guides/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
head:
- - meta
- property: og:title
content: Berachain Docker Node Quickstart
- - meta
- name: description
content: Setup a Berachain testnet node with Docker
- - meta
- property: og:description
content: Setup a Berachain testnet node with Docker
---

# Berachain Run A Node With Docker 🐳

This quickstart guide will walk you through an even easier and faster way to run testnet bArtio RPC node using [Docker](https://docs.docker.com/engine/install/) instead of [Build & Run From Source](../quickstart.md#build-run-from-source-🛠%EF%B8%8F). We'll use [berachain-docker-node](https://github.com/upnodedev/berachain-docker-node) tool for this purpose.

## Requirements

Before we begin, please make sure to have the following installed on your computer:

- [Docker](https://docs.docker.com/engine/install/) `version 27.1.1` or greater
- [Docker Compose](https://docs.docker.com/compose/install/) `v2.29.1` or greater

## Step 1 - Clone Repo & Configure Node

First, start off by cloning the berachain-docker-node repository.

```bash
git clone https://github.com/upnodedev/berachain-docker-node;
cd berachain-docker-node;
```

Then optionally change the configuration in the `.env` file, e.g., change `MONIKER_NAME` to your preferred one. The rest within this quickstart guide we can leave by default.

```bash
#########################################################################
# NODE CONFIGURATION #
#########################################################################

# Beacond
MONIKER_NAME=YourMonikerName
# ...
```

:::tip
**NOTE:**
Before the next step, we recommend to read the [Using Snapshots](#using-snapshots) section first.
:::

## Step 2 - Run Node

```bash
./run;

# [Expected Output]:
# [+] Running 1/1
# ✔ beacond Pulled
# [+] Building 1.7s (6/14)
# => [build internal] load build definition from Dockerfile
# => => transferring dockerfile: 1.05kB
# => [build internal] load metadata for docker.io/library/ubuntu:24.04
# => [build internal] load .dockerignore
# => => transferring context: 2B
# ...
```

This step may take some time.

After successfully starting the `beacond` and `reth` services, you can find the corresponding config files in `data/beacond/config/` and `/data/reth`.

:::warning
**IMPORTANT:** Make sure to securely backup your `data/beacond/config/priv_validator_key.json` file if running a validator node.
:::

## Using Snapshots

To avoid waiting for the long sync time, we can use `beacond` & `reth` snapshots in one of these two ways. Choose whichever one you like.

### Custom Snapshots

Download and decompress the pruned beacond (pebbledb) and full reth snapshots as described in [Quickstart: Run A Node - Step 4 (Download Snapshot)](../quickstart#step-4-download-snapshot-recommended).

But move the files to the shared `data` directory.

```bash
# FROM: ./berachain-docker-node

# beacond
mv ./snapshots/tmp/beacond/data ./data/beacond/config/data;

# reth
mv ./snapshots/tmp/reth/blobstore ./data/reth;
mv ./snapshots/tmp/reth/db ./data/reth;
mv ./snapshots/tmp/reth/static_files ./data/reth;
```

Go back to [step 2](#step-2-run-node).

### Auto Snapshots

Just set `true` for `BEACOND_SNAPSHOT_ENABLED` and `RETH_SNAPSHOT_ENABLED` in the `.env` file. In this case, snapshots will be downloaded and decompressed automatically.

```bash
#########################################################################
# ↓ SNAPSHOTS ↓ #
#########################################################################

# Snapshot source configuration (bera-snap)
SNAPSHOT_SOURCE="api" # Possible values: "gcs" or "api"
# SNAPSHOT_METADATA_URL="https://storage.googleapis.com/yourbucket/berachain/snapshots/metadata.json" # EXAMPLE GCS URL!
SNAPSHOT_METADATA_URL="http://bera-api.upnode.org/snapshots"

# Beacond
BEACOND_SNAPSHOT_ENABLED=true
BEACOND_SNAPSHOT_DATADIR_NAME="data/beacond/data"

# Reth
RETH_SNAPSHOT_ENABLED=true
RETH_SNAPSHOT_DATADIR_NAME="data/reth"
# ...
```

Go back to [step 2](#step-2-run-node).

## Check Logs

```bash
# FROM: ./berachain-docker-node

docker compose logs -f --tail 100;
```
3 changes: 0 additions & 3 deletions apps/core/content/nodes/guides/snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ head:
content: How to use node snapshots in Berachain
---

<script setup>
</script>

# Restoring Berachain Nodes from Snapshots

This guide will walk you through the process of using node snapshots to quickly restore a node.
Expand Down
8 changes: 1 addition & 7 deletions apps/core/content/nodes/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ head:
content: Setup a Berachain testnet node
---

<script setup>
import config from '@berachain/config/constants.json';
import AddNetwork from '@berachain/ui/AddNetwork';
import CopyToClipboard from '@berachain/ui/CopyToClipboard';
</script>

# Berachain Run A Node Quickstart ⚡

This will walk you through on setting up a testnet `bArtio` RPC archive node with `beacond` consensus client and a `reth` execution client.
Expand Down Expand Up @@ -48,7 +42,7 @@ Storage: 1TB
```

:::tip
If running as docker containers, make sure each docker container sufficient resources to add up to this total requirement
If running as [docker containers](./guides/docker), make sure each docker container sufficient resources to add up to this total requirement.
:::

## Build & Run From Source 🛠️
Expand Down