[BUG] Unable to execute additional deployment action for Git

Follow

Comments

19 comments

  • Avatar
    John Karamatsoukas

    If I just want to run 'yarn' after each push what exactly should I write in the field?

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @John Karamatsoukas
    Use "/usr/bin/yarn" with the needed options

    0
    Comment actions Permalink
  • Avatar
    Motaz Elshazly

    Alisa Kasyanova I did that and it still won't work, I can run the command from the terminal and it works. but it doesn't run from the git extension, additionally I wrote it into a bash script but same, nothing happens.

     

    Maxim Krasikov When will this be fixed, it's very important now to have a smooth CI/CD workflow and the additional SSH commands are critical to make that usable, specially when we need process special processes after the automatic sync, thank you.

    0
    Comment actions Permalink
  • Avatar
    Anton Maslov

    Motaz Elshazly we don't have any ETA for new for the fix.


    Try changing Domains > example.com > Web Hosting Access > Access to the server over SSH to /bin/bash

    2
    Comment actions Permalink
  • Avatar
    Walter Jansen

    Had the same issue, with the commands not working. Changing the "Access to the server over SSH" to "/bin/bash" fixed the problem. You don't even have to say /usr/bin/yarn. You can directly call yarn from additional command. Thank you so much!

    1
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Walter Jansen,

    Thank you for sharing your user experience.

    0
    Comment actions Permalink
  • Avatar
    DanielVagg

    Anton Maslov's answer should be added as an alternative to the resolutions as an alternative fix.

    0
    Comment actions Permalink
  • Avatar
    Alexey Lapshin

    Hello @DanielVagg

    Thank you. Added.

    0
    Comment actions Permalink
  • Avatar
    Mark

    neither cp, nor rm works - any workaround?

    http://prntscr.com/qyydkx

    0
    Comment actions Permalink
  • Avatar
    Francisco Garcia

    Hi Mark,

    You need to use the full path to cp and rm binaries. Please check your Linux distribution in order to know where they are located.

    Also, specify the whole path for your domain (for example /var/www/vhosts/example.com/httpdocs/folder).

    0
    Comment actions Permalink
  • Avatar
    Hiromichi Suzuki

    I am trying to deploy Docusaurus on a Plesk server. After pulling the latest code, I would like to run these commands to build html files:

    cd /var/www/vhosts/example.com/docs.example.com/website
    npm install
    npm run build

    As hitting the commands above from SSH returned an error because of a non existence of `node` command globally, I created symbolic links:

    ln -s /opt/plesk/node/12/bin/node /bin/node
    ln -s /opt/plesk/node/12/bin/npm /bin/npm

    And even after modifying the original commands to include full paths, they don't seem to be working.

    /bin/cd /var/www/vhosts/example.com/docs.example.com/website
    /opt/plesk/node/12/bin/npm install
    /opt/plesk/node/12/bin/npm run build

    I tried allowing SSH access to `/bin/bash` but this did not help either.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Hiromichi Suzuki

    To deploy Node.js app with the help of Plesk, follow this guide: https://www.plesk.com/blog/product-technology/node-js-plesk-onyx/

    0
    Comment actions Permalink
  • Avatar
    Clemens Mol (Edited )

    Hi Hiromichi Suzuki, I use this in the additional deployment action:

    (PATH=/opt/plesk/node/12/bin/:$PATH; npm i; npm run build)

    Works like a charm. Also needs SSH access set to `/bin/bash` 

    1
    Comment actions Permalink
  • Avatar
    Hiromichi Suzuki

    Thank you Ivan and Clemens. I tried the command below too but this somehow does not work either. SSH access is set to `/bin/bash`. Without access to logs it is very difficult to further investigate the issue..

    cd /var/www/vhosts/example.com/docs.example.com/website
    (PATH=/opt/plesk/node/12/bin/:$PATH; npm i; npm run build)

    1
    Comment actions Permalink
  • Avatar
    Hiromichi Suzuki

    After hours of trying, I finally got it work.

    In short, the commands must come in one line, like so:

    cd /var/www/vhosts/example.com/docs.example.com/website; PATH=/opt/plesk/node/12/bin/:$PATH; npm i; npm run build;

    I found that `touch test.txt` places the file under `/var/www/vhosts/example.com/docs.example.com` when the command is in the next line after `cd`. It appears that every line starts from the root directory, which kind of makes sense. So never really trust "Type each command on a new line." under the textbox.

    0
    Comment actions Permalink
  • Avatar
    Mario Peters (Edited )

    npm is working, but i can't copy files from build to another folder.

    Are there any logs? Maybe it's a permission problem. 

    rm -r /var/www/vhosts/xyz/build/;
    /opt/plesk/node/12/bin/npm ci --scripts-prepend-node-path;
    /opt/plesk/node/12/bin/npm run build --scripts-prepend-node-path;
    rm -r /var/www/vhosts/xyz2/*;
    /bin/cp -R /var/www/vhosts/xyz/build/* /var/www/vhosts/xyz2/;

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Hiromichi Suzuki

    Thank you for the feedback. Glad to hear it finally worked.

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Mario Peters

    You may enable Plesk debug as per https://support.plesk.com/hc/en-us/articles/213408889-How-to-enable-disable-Plesk-debug-mode (do not enable sql_query) and check /var/log/plesk/panel.log to see why exactly actions fail.

    I have tested the mentioned behaviour and noticed two things:

    1) At the beginning of the additional action, cd to deploy path is executed (e.g. cd '/var/www/vhosts/example.com/httpdocs'). So if you want to copy all files from /var/www/vhosts/example.com/httpdocs/build/, simply write "/bin/cp -R build/*" without the full path.

    2) The command is executed on behalf of the example.com sysuser, so make sure it has permissions to write to the destination path.

    0
    Comment actions Permalink
  • Avatar
    lostadmin

    Hiromichi Suzuki thank you so much. You just helped me so much by giving your brilliant one line of command. I was lost again but your answer was my remedy.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request