verita84 2020-12-19 22:07:14 +00:00
parent c18f16032c
commit 1a0d5d9934

18
PM2.md

@ -4,18 +4,32 @@ Using pm2 to init PiCluster on systemd
0. Login as root to install pm2
sudo -i
1. Install pm2
```
npm install -g pm2
```
2. Install the pm2 systemd unit file
```
pm2 startup systemd
```
3. Export the PiCluster config path (change the path accordingly)
```
export PICLUSTER_CONFIG='/opt/picluster/config.json'
```
4. 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
5. Save the pm2 session to restart at boot
```
6. 5. Save the pm2 session to restart at boot
```
pm2 save
```
6. Enable pm2 at boot:
```
systemctl enable pm2-root
```
7. Reboot for the services to be started properly
Reboot
```
reboot
```