Node Setup with Automatic Updates and Restarts

These commands will provide the following benefits:

Node Ninja
  • Keep your Node running, even after a system reboot.
  • Automatically update your node to the latest version so you don’t have to.

NOTE: My Nodes all run on Debian Linux so all my instruction will be for a Linux setup.

Make sure you have Docker Installed first.

Instructions:
NOTE: Do not include the “$” when you cut and paste. I’m just showing that this code get’s input at the command prompt.
1) If you have previously run a presearch node, run the following commands to stop the node:

$ sudo docker stop presearch-node
$ sudo docker rm presearch-node

If you’ve ever run the auto-updater, you can stop it too by using these commands:

$ sudo docker stop presearch-auto-updater
$ sudo docker rm presearch-auto-updater

2) Install the new Presearch Node Auto-Updater service
It uses a third party app called Watchtower to auto-update the presearch-node when updates are published. This configures your system to automatically check for updates every 5 minutes (300 seconds).

$ sudo docker run -d --name presearch-auto-updater --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --cleanup --interval 300 presearch-node

3) Install the Presearch Node as a service, so it is always running on your computer (no need to manually start/stop anymore):

$ sudo docker pull presearch/node
$ sudo docker run -dt --name presearch-node --restart=unless-stopped -v presearch-node-storage:/app/node -e REGISTRATION_CODE=YOUR_REGISTRATION_CODE_HERE presearch/node

Congratulations, you just configured your node to always run as a service, even after system restart.

4) If you would like to see the output from your node at any time, just run the following command. You can close the window and your node will keep running.

$ docker logs -f presearch-node

IF you are feeling brave, here is a one-line command to install everything, the following works on Linux / Mac:

sudo docker stop presearch-node ; docker rm presearch-node ; docker stop presearch-auto-updater ; docker rm presearch-auto-updater ; sudo docker run -d --name presearch-auto-updater --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --cleanup --interval 300 presearch-node ; docker pull presearch/node ; docker run -dt --name presearch-node --restart=unless-stopped -v presearch-node-storage:/app/node -e REGISTRATION_CODE=YOUR_REGISTRATION_CODE_HERE presearch/node ; docker logs -f presearch-node

On Windows 10, it’s the same command, but replace the “;” semicolons with “&” ampersands:


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 containrrr/watchtower --interval 300 presearch-node & docker pull presearch/node & docker run -dt --name presearch-node --restart=unless-stopped -v presearch-node-storage:/app/node -e REGISTRATION_CODE=YOUR_REGISTRATION_CODE_HERE presearch/node & docker logs -f presearch-node

You should only need to do this once to install the node and keep it running, but if anything ever breaks you should be able to run this again to fix it and “reinstall everything clean”. You can safey run that command as many times as you want to reinstall the node running as a service. It will remember your node identity (public/private key) between installs, so there’s no loss of data when you do this.