diff --git a/doc/pm2.md b/doc/pm2.md index 7fed26d..c54a4d7 100644 --- a/doc/pm2.md +++ b/doc/pm2.md @@ -1,25 +1,21 @@ # Setup pm2 * configure pm2 like [this](https://pm2.io/docs/runtime/guide/installation/) to start API on system startup + +//OPTION: * with npm ``` npm install pm2 -g -apt update && apt install sudo curl && curl -sL https://raw.githubusercontent.com/Unitech/pm2/master/packager/setup.deb.sh | sudo -E bash - +``` + +//OPTION: * with GNU/Debian +``` +sudo apt update && sudo apt install sudo curl && curl -sL https://raw.githubusercontent.com/Unitech/pm2/master/packager/setup.deb.sh | sudo -E bash - ``` * logout and login in again to make the instructions above available ``` exit -ssh api-data.vbn.de@srv-web-01.vbn-gmbh.local -``` - -* install pm2 autocompletion -``` -pm2 completion install -``` - -* Update pm2 -``` -npm install pm2 -g && pm2 update +ssh @ ``` * verify installation of pm2 @@ -30,11 +26,19 @@ pm2 --version * initialize pm2 as a startup service ``` pm2 startup +//ON-DEMAND: sudo env PATH=$PATH:/home/api-data.vbn.de/.nvm/versions/node/v18.17.1/bin /home/api-data.vbn.de/.nvm/versions/node/v18.17.1/lib/node_modules/pm2/bin/pm2 startup systemd -u api-data.vbn.de --hp ``` -* to setup the Startup Script, copy/paste the following command: +# Options + +* update pm2 with npm ``` -sudo env PATH=$PATH:/home/api-data.vbn.de/.nvm/versions/node/v18.17.1/bin /home/api-data.vbn.de/.nvm/versions/node/v18.17.1/lib/node_modules/pm2/bin/pm2 startup systemd -u api-data.vbn.de --hp /home/api-data.vbn.de +npm install pm2 -g && pm2 update +``` + +* install pm2 autocompletion +``` +pm2 completion install ``` * start the service as npm start script with PM2 @@ -49,7 +53,7 @@ pm2 start --name api-data.vbn.de npm -- start --watch pm2 save ``` -* OPTION: restart/logout/login your system, and check if all the serviceis running under PM2 +* restart/logout/login your system, and check if all the serviceis running under PM2 ``` pm2 ls ```