This is a more advanced tutorial on how to run and deploy ATON. You must follow this tutorial and its steps first, in order to perform these additional steps and finally run your ATON instance on your production server, workstation, museum kiosk or raspberry pi.
We are going to use a process manager for NodeJS (see here a list) to manage ATON services – in our case PM2.
To install PM2 (on every OS) you should just type on command-line:
npm install pm2 -g
On debian-based systems (Linux OS servers) you should use sudo
before the command, in order to install PM2 globally.
Now, you can simply run and deploy all ATON services by typing (from main folder):
pm2 start
This will launch ATON services in cluster mode, so they will run on each CPU available on the system handling incoming requests, while PM2 will automatically take care of load balancing when needed. Furthermore, PM2 will manage services in background, so you can comfortably close the prompt/shell or logout from the device/server where you launched PM2.
You can check that everything is up and running in background by typing pm2 list
:
See how the main service is running independently on each CPU, ready to handle incoming requests. The watching options also allows to resurrect automatically the service if for some reason it goes down.
If you want to check what’s happening live, you can type pm2 monit
.
Finally, if you want to stop all services, you can type:
pm2 stop all
You can indeed also launch ATON services individually, depending on your scenarios or requirements. For instance you can run only the “main” service on a single CPU by typing:
pm2 start services/ATON.service.main.js -i 1
You can have a look at the official PM2 documentation for more options!