node.jsgitdeploymentpassengerplesk

Additional GIT Deployment NPM scripts is not working on Plesk Panel


i'm running node application on Plesk.

However, I need to execute npm run build on my Plesk GIT additional action.

I've tested with solution on this question however is not good to go

enter image description here

My Plesk additional deployment action

/opt/plesk/node/10/bin/npm run build 2>&1 | tee npm.txt && touch tmp/restart.txt

I've check and ensure that my Plesk node.js path is /opt/plesk/node/10/bin/node

May I know what am i missing here?


Solution

  • Our production server is powered via Plesk with Node.js (Passenger/Phusion)

    1. You need to login to Plesk Control Panel > Websites & Domains > Web Hosting Access > System User > Ensure that "Access to the server over SSH" is selected as /bin/bash

    2. Link your GIT with Plesk (Guide at here)

    3. On additional deployment action you may paste in below codes

    (PATH=/opt/plesk/node/10/bin:$PATH; npm install && npm run build &> npm.log) touch tmp/restart.txt

    Notes

    If you're using node.js version 12 you may change to /opt/plesk/node/12/bin instead

    touch tmp/restart.txt is a way to restart your Phusion Node.js App since I couldn't restart via passenger-config restart-app command