• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue CI/CD with GitHub: Additional deployment actions (React App)

timothy_K.

New Pleskian
Hey!

I am currently building multiple react apps and it'd be awesome to be able to continously deploy them from a github repo to a dev domain for the clients to be able to access them. I was able to setup a webhook whenever I merge pull requests to the master branch so that Plesk pulls the current code and deploys it. Now I thought I could simply add two additional deployment actions to the git repo settings in plesk to get it to work:

/opt/plesk/node/17/bin/npm install &> npm-install.log /opt/plesk/node/17/bin/npm run build &> npm-build.log

The first would obviously install NPM dependencies and the second would build a production bundle in the /build folder (both outputs were logged). I then setup a very simple .htaccess file to redirect traffic into that subdirectory (I was told this would be the easiest way to make routing work as well).

RewriteEngine on RewriteCond %{REQUEST_URI} !build/ RewriteRule (.*) /build/$1 [L]

Everything works like a charm, when I install dependencies on my local machine and upload them manually. Installing dependencies through Plesk works as well. Somehow, I can't get my system to build a production bundle though. The build log is as follows:

> [email protected] build > react-scripts build /var/www/vhosts/VIRTUALHOST/ROOTDIRECTORY/node_modules/universalify/index.js:15 }, 'name', { value: fn.name }) ^ TypeError: Cannot read property 'name' of undefined at exports.fromCallback (/var/www/vhosts/VIRTUALHOST/ROOTDIRECTORY/node_modules/universalify/index.js:15:26) at Object.<anonymous> (/var/www/vhosts/VIRTUALHOST/ROOTDIRECTORY/node_modules/fs-extra/lib/fs/index.js:57:27) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object.<anonymous> (/var/www/vhosts/VIRTUALHOST/ROOTDIRECTORY/node_modules/fs-extra/lib/index.js:5:6)

I then tried to run the build process through SSH, same outcome. Multiple different NPM/Node Versions, same outcome. I have been googling for an hour now without any luck but it'd really be worth it for me cause I see myself using that CI/CD Workflow a lot more often in the future if I can somehow get it to work.

If anyone has any different recommendations for CI/CD Workflows or thinks that my idea is not best practice, I am eager to learn!

Thanks for the feedback

System Specs:​

OS Release
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Plesk Version
18.0.41 Ubuntu 18.04 1800220207.23

Node Version
v17.7.2 (but tested on several other Versions as well)

NPM Version
8.5.2

Core bootstrapped with create-react-app (5.0.0).
 
Back
Top