PM2
Tips and Tricks
Configuration
Great article on basic config - logs, memory etc. (mr_ali3n - dev.to)
Reload and Restart
From docs
As opposed to restart, which kills and restarts the process, reload achieves a 0-second-downtime reload.
bash
pm2 reload <app_name>PM2 in Production
Update ENV variables in production
From GitHub issue
bash
pm2 restart ecosystem.config.js --update-envSetup startup script
Keep process and configuration after reboot - docs
bash
# Save current process list and configuration
pm2 save
# Generate startup script
pm2 startup
[PM2] You have to run this command as root. Execute the following command:
sudo su -c "env PATH=$PATH:/home/unitech/.nvm/versions/node/v14.3/bin pm2 startup <distribution> -u <user> --hp <home-path>