Moving a Presearch Node to Another Server

In order to move your Presearch node to a new server, and retain any grandfathered status and node stats, you need to backup the security keys of the node while it’s still running, copy them local, upload them to the new server, run the Presearch Node Restore command, then start the node up on the new server.

For the steps below, old-server is the old server your node was running on, and new-server is the new server you are moving the node onto. Text surrounded by {} should be replaced with the proper actual value.

  1. Follow the Backup Presearch Node Security Keys directions to copy all of your nodes’ backup keys locally to your computer.

  2. If your node is still running on old-server, you have to stop it first. Login to old-server via SSH (using the Terminal on macOS/Linux or PuTTY if you are on Windows), then run

    docker stop presearch-node ; docker rm presearch-node ; docker stop presearch-auto-updater ; docker rm presearch-auto-updater
    
  3. Upload the node security keys to new-server from your local computer. Assuming you followed the above-mentioned Presearch Node Backup Directions:

    cd ~/node-keys/
    scp -r -P {new-server-SSH-PORT} presearch-node-keys-{old-server-HOSTNAME} root@${new-server-IP}:
    
  4. Now login to new-server:

    ssh -p {new-server-SSH-PORT} root@{new-server-IP}
    
  5. Run ls to confirm that you see the folder you uploaded in step 3

  6. Let’s now run the Node restore command:

    docker run -dt --rm -v presearch-node-storage:/app/node --name presearch-restore presearch/node ; docker cp presearch-node-keys-{old-server-HOSTNAME}/. presearch-restore:/app/node/.keys/ ; docker stop presearch-restore
    

    You’ll see docker launch the restore code, which takes about 10 seconds to complete.

  7. Once that’s done, you can launch the node just like you would a new node (note: do not change the variables near the end of this command [${REGCODE}, ${HOST}, ${IP}] as those are bash variables here):

    REGCODE="{PUT YOUR REGISTRATION CODE HERE}" IP="$(dig +short myip.opendns.com @resolver1.opendns.com)" HOST="$(hostname)" ; docker stop presearch-node ; docker rm presearch-node ; docker stop presearch-auto-updater ; docker rm presearch-auto-updater ; 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 -e REGISTRATION_CODE=${REGCODE} -e DESCRIPTION="${HOST} ${IP}" presearch/node && sleep 10 && docker logs presearch-node
    

    You should see the message info: Node is listening for searches... if all was started properly.

  8. Refresh your dashboard, and you should see that your node is online, with an updated description of the new server’s IP address and hostname.

I recommend removing the uploaded security key files from new-server and renaming your local copy of the security key files to match the new server’s details.

On new-server:

rm -rf ~/presearch-node-keys-{old-server-HOSTNAME}

On your local computer:

cd ~/node-keys/
mv presearch-node-keys-{old-server-HOSTNAME} presearch-node-keys-{new-server-HOSTNAME}

Enjoy!

This article was updated on 2022-08-17

I'm nabeards.

I'm a full stack JavaScript developer.

I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.