• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question NodeJS and Yarn in chrooted environment

chapterjason

New Pleskian
Hey, I followed this instructions to configure my chrooted env for the domain user, like it is written here.

I currently use this script to configure the env.
Code:
echo reset
./update_chroot.sh --rebuild

echo add php
./update_chroot.sh --add /opt/plesk/php/7.1/bin/php
mkdir /var/www/vhosts/chroot/usr/share
cp -a /usr/share/zoneinfo /var/www/vhosts/chroot/usr/share
for i in /opt/plesk/php/7.1/lib/php/modules/*.so ; do ./update_chroot.sh --add $i ; done
cp -a /opt/plesk/php/7.1/etc/ /var/www/vhosts/chroot/opt/plesk/php/7.1/
sed -i.bkp 's/;date.timezone =/date.timezone = Europe\/Berlin/' /var/www/vhosts/chroot/opt/plesk/php/7.1/etc/php.ini

echo add composer
php -r "copy('https://getcomposer.org/installer ', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
cp -a composer.phar /var/www/vhosts/chroot/usr/bin

echo add node
echo add yarn

echo apply to all
./update_chroot.sh --apply all

And I use this actions to update the project after deployment.
Code:
/opt/plesk/php/7.1/bin/php /usr/bin/composer.phar update

It's working great! Now I need Yarn and NodeJS to rebuild the assets after deployment. I already tried to add Yarn and NodeJS but it doesn't work. Is there any clean solution for this?
 
I made it work using the following updated script:

Bash:
echo reset
./update_chroot.sh --rebuild

echo add php
./update_chroot.sh --add /opt/plesk/php/7.2/bin/php
mkdir /var/www/vhosts/chroot/usr/share
cp -a /usr/share/zoneinfo /var/www/vhosts/chroot/usr/share
for i in /opt/plesk/php/7.2/lib64/php/modules/*.so ; do ./update_chroot.sh --add $i ; done
cp -a /opt/plesk/php/7.2/etc/ /var/www/vhosts/chroot/opt/plesk/php/7.2/
sed -i.bkp 's/;date.timezone =/date.timezone = Europe\/Amsterdam/' /var/www/vhosts/chroot/opt/plesk/php/7.2/etc/php.ini

echo add composer
wget https://getcomposer.org/composer-stable.phar
chmod +x composer-stable.phar
cp -a composer-stable.phar /var/www/vhosts/chroot/usr/bin/composer

echo add node
./update_chroot.sh --add /opt/plesk/node/8/bin/node

echo 'add env (necessary for gulp and composer)'
./update_chroot.sh --add env

echo 'add npm + gulp (assuming `/opt/plesk/node/8/bin/npm install -g gulp-cli` has been run) and other globally installed modules'
cp -a /opt/plesk/node/8/lib /var/www/vhosts/chroot/opt/plesk/node/8

echo make aliases
ln -s ../../opt/plesk/php/7.2/bin/php /var/www/vhosts/chroot/usr/bin
ln -s ../../opt/plesk/node/8/bin/node /var/www/vhosts/chroot/usr/bin
ln -s ../../opt/plesk/node/8/lib/node_modules/npm/bin/npm-cli.js /var/www/vhosts/chroot/usr/bin/npm
ln -s ../../opt/plesk/node/8/lib/node_modules/gulp-cli/bin/gulp.js /var/www/vhosts/chroot/usr/bin/gulp

echo apply to all
./update_chroot.sh --apply all

Now I can use npm, node, gulp, php, composer directly.

When I tried using node 12, I came across this error: node: ../deps/uv/src/unix/core.c:544: uv__close_nocheckstdio: Assertion `fd > -1' failed. · Issue #2099 · nodejs/help. Maybe it's fixed in node 14, I don't know.

I use this for the additional git deployment actions. Instead of using this script I feel like it would be better to be able to somehow start the same actions you can trigger in the ui by using the Plesk Composer plugin (to install) and the Plesk Nodejs plugin (to run scripts).
 
Back
Top