parent
f1dd1bcfe2
commit
58d8eef559
17
PM2.md
17
PM2.md
@ -1,37 +1,36 @@
|
|||||||
Using pm2 to init PiCluster on systemd
|
Using pm2 to init PiCluster on systemd
|
||||||
|
|
||||||
0. Login as root
|
* Login as root
|
||||||
```
|
```
|
||||||
sudo su
|
sudo su
|
||||||
```
|
```
|
||||||
|
* Install pm2
|
||||||
1. Install pm2
|
|
||||||
```
|
```
|
||||||
npm install -g pm2
|
npm install -g pm2
|
||||||
```
|
```
|
||||||
2. Install the pm2 systemd unit file
|
* Install the pm2 systemd unit file
|
||||||
```
|
```
|
||||||
pm2 startup systemd
|
pm2 startup systemd
|
||||||
```
|
```
|
||||||
3. Export the PiCluster config path (change the path accordingly)
|
* Export the PiCluster config path (change the path accordingly)
|
||||||
```
|
```
|
||||||
export PICLUSTER_CONFIG='/opt/picluster/config.json'
|
export PICLUSTER_CONFIG='/opt/picluster/config.json'
|
||||||
```
|
```
|
||||||
4. Start the server, agent, and webconsole scripts (change the path accordingly)
|
* Start the server, agent, and webconsole scripts (change the path accordingly)
|
||||||
```
|
```
|
||||||
pm2 start /opt/picluster/server/server.js
|
pm2 start /opt/picluster/server/server.js
|
||||||
pm2 start /opt/picluster/agent/agent.js
|
pm2 start /opt/picluster/agent/agent.js
|
||||||
pm2 start /opt/picluster/web/webconsole.js
|
pm2 start /opt/picluster/web/webconsole.js
|
||||||
```
|
```
|
||||||
6. 5. Save the pm2 session to restart at boot
|
* Save the pm2 session to start at boot
|
||||||
```
|
```
|
||||||
pm2 save
|
pm2 save
|
||||||
```
|
```
|
||||||
6. Enable pm2 at boot:
|
* Enable pm2 at boot:
|
||||||
```
|
```
|
||||||
systemctl enable pm2-root
|
systemctl enable pm2-root
|
||||||
```
|
```
|
||||||
7. Reboot for the services to be started properly
|
* Reboot for the services to be started properly
|
||||||
```
|
```
|
||||||
reboot
|
reboot
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user