In pm2 node app manager, what is the difference between stop and delete app. I know that delete app deletes the app, from the pm2:s control, but what does stop app do? They both will set node server to offline.
My problem is that during deployment, if I want to pull code, and then restart the node server, then which pm2 commands to use? What I have done now is first pm2 stop app -> pull code -> pm2 start app. But how do I know that the app.js is really updated? What if stop puts the app in memory, and loads it there? So after start, it will start the previous version, and not from the code that was pulled.
Stop command keeps the app in the Apps list, delete command not. You can see the Apps list with the command:
pm2 status
So if you stopped, you can restart your app just by its name.
I think the command you want is:
pm2 reload [AppName]
Just replace the files and then run the command.
Source: http://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/
You can handle the reload signal inside you app, what could be interesting in production. More info: http://pm2.keymetrics.io/docs/usage/signals-clean-restart/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With