Our step-by-step guide for production deployments on Windows machines
Learn how we at reelyActive use node-windows to run Pareto Anywhere in production on Windows machines.
Create the app.js file that defines how Pareto Anywhere will run as a Windows service.
In the root of the pareto-anywhere folder, create a file called app.js, copy Ctrl+C and paste Ctrl+V in the following contents:
const Service = require('node-windows').Service; // Create a new service object let svc = new Service({ name: "Pareto Anywhere", description: "The open source IoT middleware by reelyActive", script: require('path').join(__dirname, 'bin//pareto-anywhere'), nodeOptions: [ '--harmony', '--max_old_space_size=4096' ], workingDirectory: require('path').join(__dirname) }); // The "install" event indicates that the process is available as a service. svc.on('install', () => { svc.start(); }); // The "start" event indicates that process has actually started working. svc.on('start', () => { console.log('Pareto Anywhere is running as a Windows Service.'); }); svc.install();
Edit the app.js file as required for the target environment.
For instance, to start Pareto Anywhere with a different script than the default, edit the bin//pareto-anywhere path of the script property (ex: bin//pareto-anywhere-influxdb2).
Install node-windows using npm and link from Pareto Anywhere.
From a terminal on the Windows machine, install the node-windows package globally with the command npm install -g node-windows
.
From a terminal on the Windows machine, browse to the pareto-anywhere folder and create a symlink to the installed node-windows package with the command npm link node-windows
.
Confirm that Pareto Anywhere is running consistently as a Windows service.
From a terminal on the Windows machine, browse to the pareto-anywhere folder and run the app.js script with the command node app.js
.
Open the Services app on the Windows machine and confirm that Pareto Anywhere is indeed running.
Open a web browser on the Windows machine and browse to http://localhost:3001 to observe the Pareto Anywhere home page.
Reboot the Windows machine and confirm, as above, that Pareto Anywhere continues to run as a Windows service.
Continue exploring our open architecture and all its applications.