NodeUpdate / BatchUpdate

NodeUpdate / BatchUpdate

With this script, you can easily update 1 or more Klever Nodes at the same time.
The script installs jq if necessary.

klever_update

Tested on two machines under Ubuntu 22 and 24.Instructions:

  1. Download the Script:Open a terminal and use wget or curl to download the script.

If you don’t have wget installed, you might need to install it or use curl instead.

  • Using wget:

    bash

    wget https://klever-radar.de/software/nodes/update_nodes.sh
    
  • Using curl:

    bash

    curl -O https://klever-radar.de/software/nodes/update_nodes.sh
    

    This will save the script in your current directory.

2. Make the Script Executable:After downloading, change the script’s permissions to allow execution:

bash

chmod +x update_nodes.sh

3. Run the Script:Since the script requires sudo for operations like Docker management and permission changes, run it with elevated privileges:

bash

sudo ./update_nodes.sh

If you’re not in the directory where you downloaded the script, navigate there first or provide the full path:

bash

sudo /path/to/downloaded/script/update_nodes.sh

What the Script Does:

  • Automatic Detection: The script automatically detects all running Klever Nodes (based on the kleverapp/klever-go image) and captures the parameters and ports of each validator.

  • Overview: It compiles a clear overview of the current configuration (path, container, REST API port, redundancy level, and display name) for each node.

  • Update Process: Upon confirmation, it downloads the latest configuration from https://backup.mainnet.klever.org/config.mainnet.108.tar.gz, stops and removes existing containers, sets permissions to 999:999, pulls the kleverapp/klever-go:latest image, and restarts the nodes with their original parameters.

  • Confirmation: After displaying the overview, it prompts you to choose yes (y) or no (n) to proceed with the update.

Example Output (Excerpt):

Current Node Configuration:
Node node1:
  Path: /opt/node1
  Container: klever-node1
  REST API Port: 8080
  Redundancy Level: --redundancy-level=1
  Display Name: CryptoJaeger#1

Node node2:
  Path: /opt/node2
  Container: klever-node2
  REST API Port: 8081
  Redundancy Level: --redundancy-level=1
  Display Name: CryptoJaeger#2

[... other nodes ...]

Update Details:
• REST API Ports: 8080 (node1), 8081 (node2), 8082 (node3), 8083 (node4), 8084 (node5)
• Redundancy Level: --redundancy-level=1 (for all nodes)
• Display Names: CryptoJaeger#1 (node1), CryptoJaeger#2 (node2), ...
• Configuration: Downloaded from https://backup.mainnet.klever.org/config.mainnet.108.tar.gz
• Docker Image: kleverapp/klever-go:latest
• User Permissions: 999:999 for all directories

Do you want to proceed with the update for these nodes? (y/n)

Additional Notes:
Review: It’s good practice to review the script content before execution, especially with sudo. View it with:

bash

cat update_nodes.sh
  1. Environment: Ensure Docker is installed. The script installs jq if needed and requires tools like curl, tar, and sudo.
  2. Security: Be cautious with scripts from the internet. This script requires sudo privileges for Docker and file operations, so only proceed if you trust the source.
6 Likes

@Validators how easy do you want to have it. Just use this tool…

1 Like

Used this script on one of the nodes and it updated great but now I can’t run the unjail command. Seems its not able to load the wallet key even though the key file is in the same spot it has always been and I’ve verified its correct:

INFO [2025-11-06 13:44:52.260] Loading keyFile = ./walletKey.pem
WARN [2025-11-06 13:44:52.260] KeyLoaded not found
commit: v1.7.15-0-gc1de9106, error: owner and signer key does not match XXXXXXXXX

Any idea if the script would have changed permissions or expected location of the key file? Prior to this commands like unjail fired correctly. Also this is just a single klever node on its own VPS.

First check whether you are in the correct folder when executing the command.

The update script does not delete any files.

What command did you enter?

update script went fine, but now trying to run unjail in the base folder for the validator (same spot I ran the update script and contains the wallet folder with .pem in it) it cant seem to load the walletKey.pem

If I run this on my other node:

docker run -it --rm
-v $(pwd)/wallet:/opt/klever-blockchain
–entrypoint=/usr/local/bin/operator
kleverapp/klever-go:latest account address

in the same address, it will return the loaded key and operator info, but now running it on the updated node I get:

-v $(pwd)/wallet:/opt/klever-blockchain \
--entrypoint=/usr/local/bin/operator \
kleverapp/klever-go:latest account address

INFO [2025-11-06 14:04:41.092]   Loading                                  keyFile = ./walletKey.pem
WARN [2025-11-06 14:04:41.092]   KeyLoaded not found
Wallet address:

Ive been checking permissions on the wallet folder and walletKey.pem to see if something might have changed but I dont see it. Trying to figure out how to confirm the exact path these docker scripts are wanting to find the .pem to see if it somewhow changed.

EDIT: I may have sorted it. When I run that command it was generating an empty wallet folder inside the node folder, so clearly thats where its looking for the walletKey.pem now. Unsure why previously it was fine with that folder outside of the node folder but, moving the key seems to have got it to load correctly. Unjail command seems to have worked. So Ill just move the pem on the other nodes as well.

1 Like

To be sure:
you loaded the command in the root folder and not in the node folder right?

New node uses user 999 you will need to change wallet ownership first with
chown -R 999 wallet

2 Likes

I have published a new complete script here with permissions for /wallet.

The CreateNodes and UpdateNodes scripts are no longer necessary.

2 Likes