doc: adjust doc/pm2.md

This commit is contained in:
dancingCycle 2023-09-13 10:25:41 +02:00
parent ca69a02987
commit fdf7d137d3
1 changed files with 1 additions and 49 deletions

View File

@ -1,4 +1,4 @@
# Setup pm2 (update Sep 2023)
# Setup pm2
* configure pm2 like [this](https://pm2.io/docs/runtime/guide/installation/) to start API on system startup
```
@ -95,51 +95,3 @@ $ sudo pm2 save #save current process list on reboot
$ sudo pm2 unstartup #disable PM2 from starting at system boot
$ sudo pm2 update #update PM2 package
```
# Setup PM2
* update Debian package repository cache
```
sudo apt update
```
* globally install the latest stable version of PM2 via npm
```
npm i -g pm2
```
* create group and user ```pm2```
following this [setup](grp-usr.md)
* generate the startup script\
**NOTE:** This instruction comes back with a reply like ```To setup the Startup Script, copy/paste the following command: sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u <pm2 system service> --hp <pm2 installation home path>```
```
pm2 startup systemd -u pm2
```
* confirm that the PM2 startup service is up and running under systemd, run the following command
```
systemctl status pm2-<pm2 system user>.service
```
# Helpful PM2 instructions
* list all node application (process/microservices)
```
pm2 list
```
* monitor logs, custom metrics, process information from all processes
```
pm2 monit
```
* view details of a single Node.js process using the process ID or name
```
pm2 show <process ID or name
```
* update PM2 package
```
pm2 update
```