Muon Network

Backing up & Restoring a Node

Transferring a Node to a Different Server
To move a node to another server, one needs to back it up and restore it on the new server. To do so, follow the instructions below.


To back up your node, run the following command on your server:
docker exec -it muon-node ./node_modules/.bin/ts-node ./src/cmd keys backup > backup.json
This command creates a file named backup.json. You can see the contents of this file using:
cat backup.json
The result will look like the following:
These contents should be copied and kept somewhere safe.
NB: When you run the above backup command (docker exec ...), if you encounter an error message or cannot get the json backup for any reason, you can follow the legacy backup routine to get a backup.envfile as shown below:
docker cp muon-node:/usr/src/muon-node-js/.env ./backup.env


To restore the node, follow the "Running the Node" instructions. After running the new node, instead of following "Adding the Node to the Network" section, transfer the backup.json file to your server and then run the following command:
docker exec -it muon-node ./node_modules/.bin/ts-node ./src/cmd keys restore "$(cat backup.json)"
Having run the above command, you should receive this message:
.env created successfully.
Now run this command to restart the container:
docker restart muon-node
If the restoration process is successful, querying the status of the node from the following link will return the address and peerId of the backed up node.
NB: If you have a legacy backup.env file, you should first transfer it into the server of the new node. Then run the following command to copy it into muon-node Docker container:
docker cp backup.env muon-node:/usr/src/muon-node-js/backup.env
Then run the following command to restore your node:
docker exec -it muon-node ./node_modules/.bin/ts-node ./src/cmd keys restore backup.env
And finally restart the node by running this command:
docker restart muon-node