skip to Main Content

We are using Plesk to host our production services.

Basically when I deploy application to Plesk using Git, I need to press Restart application within Node page on Plesk GUI and that works well.

But in some cases I need to do that pragmatically, I need to automatically restart Node service. Does Plesk offer such functionality? Maybe, some kind of API that listens to calls or else within Linux shell itself.

4

Answers


  1. Chosen as BEST ANSWER

    Since there was no answer for a while, this is my old workaround that I used for PM2 scripts force reset:

    If it's a webserver application, e.g. Express.js, add protected route that can be accessed only within your privatae network (for security reasons) which basically kills main process via process.exit(0) and your webserver will get reseted automatically by PM2 or whichever service you use for it. However, I wouldn't recommend this method for anything above staging.


  2. I have this issue too, and Plesk support don’t have an answer for me either.

    According to the Plesk blog here: “Moreover, if your app is running in the “development” mode, you don’t need to restart the app every time you modify the contents of a file.”

    I’m very new to Node so I don’t fully understand the implications but I guess if you run the app in development mode, then you won’t need to manually restart the Node Application.

    Login or Signup to reply.
  3. When you click Restart App you’ll notice a message state Information: The restart.txt file was touched. Application will be restarted after the first request.

    You can emulate this action after the deploy by checking Enable additional deploy actions in the git repository options, and touching the same file here (I also run npm install too). Screenshot attached.

    enter image description here

    Login or Signup to reply.
  4. The only way I have found that consistently works on Plesk is this command:

    touch tmp/restart.txt
    

    Even in development mode, Node does not seem to automatically restart.

    What’s worse is that it takes about 5-6 seconds before Node finishes restarting, using the touch method.

    My takeaway is that a Plesk server is the wrong place to do Node development or testing.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search