Search code examples
node.jsubuntupm2process-management

Correct way to restar/reload application for a different release


I have following folder structure:

current
releases
  2192091029019/
  1029012901920/

Latest release gets pushed to current folder, and I afterwards start it wiht pm2 start, however If I upload new release with different folder name and do pm2 reload from new folder it still trys to reference original release from where application was started. Is there a way to restart application respecting new code?


Solution

  • I have same problem with this release structure but with supervisord+Rails instead pm2 + node. In my case i need to completely restart supervisord every deploy to fix that. So in your case it may work like this:

    pm2 stop
    kill -SIGTERM {pm2_pid}
    pm2 startup
    

    It's hackish but working solution.