How to migrate a Presearch Node in Docker on Windows OS

This guide is in the scope of Presearch Nodes which are running in Docker on the Windows Operating System (OS) If you’re setting up your first node you should follow our previous guide or those provided by Presearch here.

For various reasons, you may want or need to migrate your Presearch Node to a new host. Retaining your node identity, nodes stats and grandfathered collateral status. Thankfully the process is straightforward and well documented by Presearch themselves here.

This guide aims to make the process even simpler and is guided specifically for Docker on Windows OS. This follows the Presearch guide but details any changes from the original guide, in some steps the original commands have been left which will fail. These are simply to demonstrate the changes to the guide versus this one and have no impact on the migration scoped to Docker on Windows OS. We have also specified at each step if this is likely to fail but you proceed.

Steps Taken

This guide will follow the following main steps:

  1. Backup the current node security keys
  2. Copy keys to the new node and stop the old node
  3. Presearch restore process
  4. Start your new node
  5. Confirm your new node is migrated

*Throughout this guide we will refer to the old node, being the currently running instance, this is the node you wish to move and shut down. The new node is the freshly installed and migrated instance.

Prior to Migrate – Backup the current node security keys

Within the Presearch guide commands are provided for you to SSH into your instance to make a copy however this guide assumes you have access to the OS and therefore we will simply identify the location of the keys and then copy them.

a. Firstly, identify and confirm the location of the volume mount for your Presearch node in Docker to do this run the following command.

docker inspect presearch-node

b. This will list all the information regarding your docker Presearch instance. Specifically, we want to locate the information provided under ‘Mounts’ which will look this the following. (TCG)

c. You can now see the location of your data under ‘Source’ which is /var/lib/docker/volumes/presearch-node-stroage/_data our security keys are located here so we need to next find them in file explorer.

d. To view files within docker you will have to use either of the following in Windows Filer Explorer depending on your version:

Docker Engine v20.10.16 \\wsl$\docker-desktop-data\data\docker\volumes

Docker Engine v19.03 \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\

e. You will see one directory for each volume you have, we need to then drill down the file structure as follows: presearch-node-storage / _data / .keys

Once here you will see that you have two files which look like the following screenshot. (TCG)

f. Copy both keys and then move them onto the new node. I placed them at the following location within a new folder named presearch-node-keys on the C Drive {C:\presearch-node-keys}

g. Now shutdown the old node running Presearch with the following command:

docker stop presearch-node ; docker rm presearch-node ; docker stop presearch-auto-updater ; docker rm presearch-auto-updater

*You can check this node has stopped within Docker but also it should now be disconnected in your Presearch Node Dashboard

Migrate – Presearch restore process

a. Now we run the Node restore command given in the Presearch migration document, the only difference here is that we will execute these commands separately and in stages taking manual intervention to move the key files into place and therefore removing part of the file copy step. First, run the following command:

docker run -dt --rm -v presearch-node-storage:/app/node --name presearch-restore presearch/node

b. Once executed you need to move the original keys from the old node to the correct file location in docker volume. To find this we again use either the following depending on your docker version to view the volumes.

Docker Engine v20.10.16 \\wsl$\docker-desktop-data\data\docker\volumesDocker Engine v19.03 \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\

c. Then drill down into the Presearch node storage, _data, .keys as performed on the old node you need to delete the keys which are here and replace them with your old keys. You can simply cut and paste as we no longer need them stored elsewhere (you should also back them up separately)

d. Then execute the following command once the key files have been swapped.

docker stop presearch-restore

Start your new node

a. Start your new node, we will break down the commands given in the Presearch documentation to execute them one by one. Some will fail which is not an issue and we can progress to the next stage without issues.

1st command likely to fail but proceed to the next

docker stop presearch-node

2nd command likely to fail but proceed to the next

docker rm presearch-node

3rd command likely to fail but proceed to the next

docker stop presearch-auto-updater

4th command likely to fail but proceed to the next

docker rm presearch-auto-updater

5th command should execute

docker run -d --name presearch-auto-updater --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock presearch/auto-updater --cleanup --interval 900 presearch-auto-updater presearch-node && docker pull presearch/node && docker run -dt --name presearch-node --restart=unless-stopped -v presearch-node-storage:/app/node presearch/node && sleep 10 && docker logs presearch-node

Confirm your new node is migrated

As per the Presearch documentation, you should not see ‘node is listening for searches,’ you should also see that your node is back running in Docker and also connected to your Presearch dashboard.

You can now follow the remaining guide to manage your keys such as backing them up etc. That’s it, hopefully, this guide has helped you with successfully migrate your Presearch Node.