Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandra Tran <alexandra.tran@consensys.net>
  • Loading branch information
Alexandra Tran committed Jan 27, 2025
1 parent 95f1c16 commit 0f4aee6
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 75 deletions.
2 changes: 1 addition & 1 deletion docs/private-networks/how-to/deploy/ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags:

To deploy Besu using Ansible, use the [Besu role](https://galaxy.ansible.com/consensys/hyperledger_besu) published on Galaxy.

For more information, see the "Read Me" button on the [Ansible Galaxy Besu page](https://galaxy.ansible.com/consensys/hyperledger_besu).
For more information, select **Documentation** on the [Ansible Galaxy Besu page](https://galaxy.ansible.com/consensys/hyperledger_besu).

:::tip

Expand Down
186 changes: 112 additions & 74 deletions docs/public-networks/how-to/upgrade-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
title: Upgrade Besu
sidebar_position: 11
description: Upgrade your Besu node to a new version.
toc_max_heading_level: 2
tags:
- public networks
- private networks
---

import Tabs from '@theme/Tabs';
Expand All @@ -13,73 +15,77 @@ import TabItem from '@theme/TabItem';

When upgrading your Besu node, we recommend:

- Preserving your node's data and configuration
<!--- - Using an orchestration method to keep all nodes in sync with your desired configuration. --->
- Preserving your node's data and configuration.
- Storing your configuration under version control.


<Tabs>
<TabItem value="binary" label="Linux" default>

### Upgrading on Linux

1. Stop your Besu node:

```bash
sudo systemctl stop besu
```

2. Back up your data directory and configuration:

```bash
sudo cp -r /var/lib/besu/data /var/lib/besu/data.backup
sudo cp /etc/besu/config.toml /etc/besu/config.toml.backup
```

3. Download and install the new version:

```bash
wget https://hyperledger.jfrog.io/artifactory/besu-binaries/besu/[VERSION]/besu-[VERSION].tar.gz
tar -xvf besu-[VERSION].tar.gz
sudo cp -r besu-[VERSION]/* /usr/local/bin/
```

4. Restart your node:

```bash
sudo systemctl start besu
```

:::note
Keep your data directory (`/var/lib/besu/data`) intact during upgrades to maintain chain sync status.
:::
## Upgrade on Linux

1. Run the following to automatically download the latest Linux release, un-tar, and clean up:

```bash
RELEASE_URL="https://api.github.com/repos/hyperledger/besu/releases/latest"
TAG=$(curl -s $RELEASE_URL | jq -r .tag_name)
BINARIES_URL="https://github.com/hyperledger/besu/releases/download/$TAG/besu-$TAG.tar.gz"

echo Downloading URL: $BINARIES_URL

cd $HOME
wget -O besu.tar.gz $BINARIES_URL
tar -xzvf besu.tar.gz -C $HOME
rm besu.tar.gz
sudo mv $HOME/besu-${TAG} besu
```

2. Stop your Besu node:

```bash
sudo systemctl stop execution
```

3. Remove old binaries, install new binaries, and restart Besu:

```bash
sudo rm -rf /usr/local/bin/besu
sudo mv $HOME/besu /usr/local/bin/besu
sudo systemctl start execution
```

:::tip note
Thank you to
[CoinCashew](https://www.coincashew.com/coins/overview-eth/guide-or-how-to-setup-a-validator-on-eth2-mainnet/part-ii-maintenance/updating-execution-client#besu)
for this upgrade script.
You can also see CoinCashew for instructions on upgrading Besu by building from source.
:::

</TabItem>
<TabItem value="docker" label="Docker">

### Upgrading with Docker
## Upgrade on Docker

1. Update your Docker image:

```bash
docker pull hyperledger/besu:latest
```
```bash
docker pull hyperledger/besu:latest
```

2. Stop current container:
2. Stop the current container:

```bash
docker stop besu-node
```
```bash
docker stop besu-node
```

3. Start new container with updated image:
3. Start a new container with the updated image:

```bash
docker run -d \
--name besu-node \
-v besu-data:/opt/besu/data \
-v besu-config:/etc/besu \
hyperledger/besu:latest
```
```bash
docker run -d \
--name besu-node \
-v besu-data:/opt/besu/data \
-v besu-config:/etc/besu \
hyperledger/besu:latest
```

Example `docker-compose.yml`:

Expand All @@ -102,22 +108,22 @@ volumes:
</TabItem>
<TabItem value="kubernetes" label="Kubernetes">

### Upgrading in Kubernetes
## Upgrade on Kubernetes

1. Update your deployment manifest with a new image version:

```yaml
spec:
containers:
- name: besu
image: hyperledger/besu:new-version
```
```yaml
spec:
containers:
- name: besu
image: hyperledger/besu:new-version
```

2. Apply the update:

```bash
kubectl apply -f besu-deployment.yaml
```
```bash
kubectl apply -f besu-deployment.yaml
```

Example PVC configuration:

Expand All @@ -134,43 +140,75 @@ spec:
storage: 1Ti
```

</TabItem>
<TabItem value="Ansible">

## Upgrade on Ansible

You can use the [Ansible role on Galaxy](https://galaxy.ansible.com/ui/standalone/roles/consensys/hyperledger_besu/)
directly or customize it to suit your needs.

Upgrade the Besu version on nodes by running the play with the new version.
For more information, select **Documentation** on the [Ansible Galaxy Besu page](https://galaxy.ansible.com/ui/standalone/roles/consensys/hyperledger_besu/).

The playbook:

1. Stops Besu.
2. Downloads the updated version.
3. Applies any new configuration.
4. Starts Besu.

</TabItem>
</Tabs>

## Post-upgrade verification
## Verify post-upgrade

1. Check node status:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' localhost:8545
```
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' localhost:8545
```

2. Verify peer connections:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' localhost:8545
```
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' localhost:8545
```

## Find peers on restarting

Nodes store known peers in the peer table. The peer table is not persisted to disk. When a node restarts, the node connects to the specified bootnodes and discovers other nodes through the peer discovery process. The node continues collecting data from where it left off before the restart (assuming there was no data corruption in a failure scenario).
Nodes store known peers in the peer table.
The peer table is not persisted to disk.
When a node restarts, the node connects to the specified bootnodes and discovers other nodes through the peer discovery process.
The node continues collecting data from where it left off before the restart (assuming there was no data corruption in a failure scenario).

Before the node restarted, connected peers saved the node details in their peer tables. These peers can reconnect to the restarted node. The restarted node uses these peers and the bootnodes, to discover more peers. To ensure that the restarted node successfully rejoins the network, ensure you specify at least one operational bootnode.
Before the node restarted, connected peers saved the node details in their peer tables.
These peers can reconnect to the restarted node.
The restarted node uses these peers and the bootnodes, to discover more peers.
To ensure that the restarted node successfully rejoins the network, ensure you specify at least one operational bootnode.

## Troubleshooting
## Troubleshoot

### Sync not progressing

Verify that the node is properly connected to the bootnodes. Check the node logs to ensure that the connections are being established correctly.
Verify that the node is properly connected to the bootnodes.
Check the node logs to ensure that the connections are being established correctly.

### Low peer count

Ensure that your network connection is stable and that the required ports for peer discovery and communication are open and correctly forwarded.

### API unavailable

Check the configuration of your RPC endpoint to ensure it is set up correctly and accessible. Verify that the API service is running and the correct ports are being used.
Check the configuration of your RPC endpoint to ensure it is set up correctly and accessible.
Verify that the API service is running and the correct ports are being used.

### Data corruption

If you encounter data corruption, restore the node data from a known good backup. Ensure regular backups are in place to avoid data loss.
If you encounter data corruption, restore the node data from a known good backup.
Ensure regular backups are in place to avoid data loss.

:::note
As a last resort, you can delete the database to resync the node.
This can solve corruption issues, but it might suffer significant downtime depending on the size of the network.
:::

0 comments on commit 0f4aee6

Please sign in to comment.