This is no longer the recommended method of running your node tracker. Please follow to configure your service to run the nodetracker.

Greetings again, I hope that you are all getting something out of these blogs, it is always difficult finding great information when you are learning something new. And it can sometimes feel overwhelming.

This next blog entry is aimed at helping you launch the securenode tracker software as a service and allow for easy monitoring.

I hereby introduce you to PM2.

PM2 is a "Production Process Manager for Node.js apps with a built-in Load Balancer", that allows you to configure the securenode tracker software application as a service and easy monitoring.

Installation and application execution

PM2 can be installed by running:
sudo npm install pm2 -g
This will then installed the required software you system.

After you install PM2 head into the secnodetracker directory and after you have ran the setup for the secnodetracker (node setup.js) in the securenodetracker software directory, you can execute the following command:
pm2 start app.js --name secnodetracker
The above command initiates the pm2 service, tells the service to start the app.js, with the --name of securenodetracker. You can execute the process without the --name flag but the pm2 service will load the app.js with a name of app. Now this isn't really descriptive if you have other nodejs software running on your node and you are trying to identify which is which.

Then save the process:
pm2 save

Once the service is up and running you should see something similar to this:

Next you will want to add the securenodetracker application to run at boot. This is done by running:
pm2 startup
This will then give you a command line similar to the one in the next image that you need to execute to complete the configuration of the daemon for system bootup.

Monitoring and stopping the application

Monitoring of the service is very easy. There is an advance configuration where you can use a portal to monitor all of your nodes, this will be covered in a later blog post.

Monitoring of the securenodetracker service is done by running the following command:
pm2 logs secnodetracker or pm2 monit
The first command will give you an output similar to running the node software directly.

To exit the tail of the log press control c.

To check the status of the service you can run:
pm2 status secnodetracker

Stopping the securenodetracker service is just a easy as running the following command:
pm2 stop secnodetracker
This command should give you an output similar to this:

I hope this helps, and as always, if you have any questions or comments please drop them in below or hit me up in slack.

Log file location

I have a quick edit to add to this post, thanks devman, the log files for PM2 can be found in .pm2/logs.

Have a good on :)