DOT.News » Moonbeam

All the latest news about Polkadot, Kusama and its strong ecosystem

How to Upgrade your Moonbeam Node in 5 Minutes

Published date: November 19 2021
Share:

Running a Moonbeam full node not only boosts the decentralization of the network but also grants you a variety of benefits such as local access to RPC endpoints. To maintain a high performant and healthy node, it’s important to keep it up-to-date. With this guide, you’ll learn how to quickly update your Moonbeam node.

This guide assumes you’re running a full node on Moonriver but it is applicable for all networks. To adapt this guide to a different network, all you need to do is change the names of the moonriver-data folder and the moonriver_service names to reflect the correct network.

Updating Nodes running via Docker

If you’re running your node with Docker, updating your node is as simple as stopping the running container and restarting it with the new version tag.

First, get the container ID of your Moonbeam node by running docker ps -a. The container ID is the first column and if you’re running multiple docker containers, you can identify it by the image name that begins with purestake/moonbeam. Second, run docker stop <YOUR CONTAINER ID here>.

You’ll then use the same command you used to initially start the node, replacing the old version tag with the new one. To get the new version tag, head to the Moonbeam github repo. In this example, we replace the placeholder text with v0.15.1 The full docker command to start a node is reproduced below for Linux users and can also be found at the Moonbeam docs site for MacOS Users. Remember to replace the two instances of your node name and the version tag.

docker run --network="host" -v "/var/lib/moonriver-data:/data" \
-u $(id -u ${USER}):$(id -g ${USER}) \
purestake/moonbeam:<NEW VERSION TAG HERE>\
--base-path=/data \
--chain moonriver \
--name="YOUR-NODE-NAME" \
--execution wasm \
--wasm-execution compiled \
--pruning archive \
--state-cache-size 1 \
-- \
--pruning archive \
--name="YOUR-NODE-NAME (Embedded Relay)"

Updating Nodes running via Systemd Service (Binary)

To update your Moonbeam node running via the systemd service, take the following steps:

  • Stop the running service
  • Navigate to the folder where the Moonbeam binary is located
  • Remove the old version of the Moonbeam binary
  • Fetch the new binary from the Moonbeam github repo— be sure to get the new version tag first
  • Make the Moonbeam binary executable
  • Give ownership of the Moonbeam binary to the --no-create-homeuser you created specifically to run it (your user may have a different name)
  • Restart the Moonbeam systemctl service

The exact commands are reproduced below. Note: you’ll need to replace the new version tag first before copying the commands one-by-one.

systemctl stop moonbeam
cd /var/lib/moonriver-data
rm moonbeam
wget https://github.com/PureStake/moonbeam/releases/download/<NEW VERSION TAG HERE>/moonbeam
chmod +x moonbeam
chown moonriver_service moonbeam
systemctl start moonbeam

For added security, you can verify the hash of the downloaded binary by running sha256sum on the download binary and comparing it to the published one on the Moonbeam docs site.

To check the status of your updated node, you can run systemctl status moonbeam.service or run journalctl -f -u moonbeam.service to tail the logs of the Moonbeam node.

And that’s it! Reach out to us on Discord if you have any questions.

This Moonriver node was successfully updated to v0.15.0

How to Upgrade your Moonbeam Node in 5 Minutes was originally published in Moonbeam Network on Medium, where people are continuing the conversation by highlighting and responding to this story.