Node Upgrade
In this chapter, we will see the CLI command lines to install the necessary dependencies to upgrade a Mavryk node.
Upgrade a Mavkit node
Mavryk is an evolving blockchain. Through its on-chain governance mechanism, Mavryk smoothly evolves to become more secure and scalable over time.
The following commands help to upgrade your node to the latest Mavkit version.
Node software upgrades (Mavkit versions) are different from protocol amendments. Protocol changes are decided through Mavryk's on-chain governance and activate automatically. Mavkit upgrades ensure your node supports the latest protocol and includes bug fixes and performance improvements.
Major version upgrades may change the storage format. After upgrading, run mavkit-node upgrade storage if prompted. Once upgraded, the data directory cannot be used with the previous version. Always back up your data directory before upgrading.
Before you upgrade
- Check your current version:
mavkit-node --version - Verify your node is synced:
mavkit-client bootstrapped - Back up your data directory (default:
~/.mavkit-node) - Review the release notes for breaking changes
Docker and Docker Compose
Upgrade the docker image
Ensure you mount a persistent volume with -v when using docker run. Without it, a new container creates a fresh volume and your existing chain data will not be used.
To use the v19.1 image, execute the following command:
docker run -v node-data-volume:/var/run/mavryk/node mavrykdynamics/mavryk:v19.1 mavkit-node run --rpc-addr 127.0.0.1:8732
Docker Compose
If you deployed with Docker Compose, update the image version in your docker-compose.yml:
services:
mavryk-node:
image: mavrykdynamics/mavryk:v19.1
Then pull the new image and restart:
docker-compose pull
docker-compose down
docker-compose up -d
Your chain data is preserved in the mounted volume.
Serokell PPA with Mavryk packages
Upgrade mavryk packages
To fetch the latest node version, run the following command:
sudo apt-get update
sudo apt-get upgrade
From source
From scratch
Upgrade from scratch
Execute the following commands in your Mavryk repository:
git fetch
git checkout v19.1
opam switch remove .
rm -rf _opam _build
make build-deps
eval $(opam env)
make
opam switch remove . is only needed if you are updating an already compiled repository, not if you are compiling from a freshly cloned repository.
opam switch remove . destroys the entire local opam switch for the current directory. Verify you are in the correct Mavkit repository directory before running this command.
Mavryk opam packages
Upgrade using opam
Run the following commands:
opam update
opam depext
opam upgrade
After upgrading
- Verify the new version:
mavkit-node --version - Upgrade storage if needed:
mavkit-node upgrade storage - Confirm network connectivity:
mavkit-client bootstrapped - Monitor logs for errors during the first few minutes
Rolling back
If your storage was upgraded, rolling back to a previous version is not possible with the same data directory. You must restore from a backup or re-sync from a snapshot.
If you have a backup from before the upgrade:
- Stop the node
- Restore the backed-up data directory
- Install the previous version of Mavkit
- Restart the node
Be careful when closing terminal windows because this stops the node.