4
PM2
verita84 edited this page 2020-12-19 22:08:45 +00:00
Using pm2 to init PiCluster on systemd
- Login as root
sudo su
- Install pm2
npm install -g pm2
- Install the pm2 systemd unit file
pm2 startup systemd
- Export the PiCluster config path (change the path accordingly)
export PICLUSTER_CONFIG='/opt/picluster/config.json'
- Start the server, agent, and webconsole scripts (change the path accordingly)
pm2 start /opt/picluster/server/server.js
pm2 start /opt/picluster/agent/agent.js
pm2 start /opt/picluster/web/webconsole.js
- Save the pm2 session to start at boot
pm2 save
- Enable pm2 at boot:
systemctl enable pm2-root
- Reboot for the services to be started properly
reboot