Plesk Git additional deploy actions npm not executed - node.js

I've connected Plesk to GitHub. Plesk gives the opportunity to run additional deployment actions after a branch was pulled. Pulling the branch works fine.
But it seems, that these actions are not triggered.
I want to run the install:prod task from my package.json file.
I can run this successfully via ssh.
I've also tried to skip the prepending "npm run" part but without success.
My current configuration looks like this.
npm run install:prod
The logs are showing no error message. It seems to silently fail.

I had the same problem. The solution for me was to use the correct path on the additional deploy scripts, you can find out those by doing "which npm" and "pwd" for getting your website dir path. Once you have those you could use this lines on your deploy scripts, for example, assuming "httpdocs" is where your website is:
cd /var/www/vhosts/<your vhost>/httpdocs
/usr/bin/npm run install:prod

Related

prevent heroku from running "npm run build" on deployment

i have a MERN stack application that i wish to deploy to heroku, in my package.json file i have the "build" command in scripts, whenever i try to deploy heroku runs the build command automatically and fails, which fails everything else..i already use build on my local machine before deploying so i don't want the script to be run again.. i checked around and found this article in herokus dev logs
https://devcenter.heroku.com/changelog-items/1573
it says if i wish to stop that from happening i need to "specify a heroku-postbuild script in package.json file."
what is this postbuild script? how can i do that? can someone give me an example please?
Not familiar with Heroku but this link provides an explanation on why you might need to build again on a deploy to Heroku and also gives a sample build script.
If you're sure you don't have to do any build on Heroku and just uploading (deploying) your files is enough, then your heroku-postbuild could just display (log) a message. The example on Heroku's website for heroku-postbuild simply displays (logs) a message.

Cannot build / run test properly in travis. Permission denied

I have a simple node.js code/project. I write some test with jestjs. I run the test on my local machine with the command 'npm run test'. The test is able to pass.
I moved the project onto GitHub and wanted to tinker with Travis CI. But my build on travis ci fails. The error message on travis is shown below.
Below is the state of my Git repo:
I never committed the folder 'node_modules' into Git because I read somewhere that this folder should be excluded as Travis would have its 'own environment to run and build the project'.
Below is my .travis.yml :
Below is my package.json file:
I tried modifying this file as well. I am still stuck, Should I remove the lines that states the "build" ?
Appreciate any help!
Maybe try adding the following to travis.yml
before_script: chmod 0555 ./node_modules/.bin/travis
I resolved the situation by adding the below:
before_script: chmod 0555 ./node_modules/.bin/jest
I think this is trying to tell the machine running to allow the use of the jest library. Therefore the jests unit test is able to run properly.

How can I build front-end on AWS EC2 by CodeDeploy?

I am using Node.js, webpack, EC2, CodeDeploy with BitBucket.
In BeforeInstall script I put:
#!/bin/bash
cd /home/ec2-user/papirux/
sudo npm install
sudo NODE_ENV='production' webpack -p
Deploy was successful.
But folder built by webpack did not appear.
I don't resolve it about two days...
There's a couple things that come to mind.
1. Are you copying your source code to the right directory?
I would assume that your script would fail if you don't, but are you copying your code to the directory you want via your appspec? It should have a section like this:
files:
- source: /
destination: /home/ec2-user/papirux/
2. Look at the logging information for the deployment to see what happened with your script.
You can see the logging for deployments describe here. You should be able to see something useful at /opt/codedeploy-agent/deployment-root/deployment-logs/codedeploy-agent-deployments.log or /opt/codedeploy-agent/deployment-root/deployment-group-ID/deployment-ID/logs/scripts.log on your EC2 instance as to what happened with your script. If it failed or copied the files to an unexpected directory, you should see something useful there.
For convenience, you can also install the CloudWatch logs agent and have the logs uploaded to CloudWatch directly.

Set up an xcode bot to build and deploy a nodejs express server

I am attempting to set up a xcode project and bot that will build a nodejs application on commit from a github repository and restart the server after the build completes. The bot is currently picking up on the repository changes but fails to build correctly.
I am using a xcode external build tool project that uses /bin/bash as the tool path and the working directory is set to the local repository path.
The bot's after integration script is something like,
npm install --production
npm run build
npm run server:restart
I am getting errors like [npm|node] is not recognized.
Just looking for some clarity to what I might be missing or what could be going wrong.
Add this to the beginning of your script and review the output:
which node
set | grep PATH
This will happen if node is not in your path, which may happen because build scripts have a pretty basic environment - they're not running as a normal user. You may need to add it to your PATH at the start of your build script.

Temporary files on Travis

I have a Javascript project which uses Grunt for build process, QUnit for tests, Blanket for code coverage and a custom Grunt task to convert coverage results into LCOV files, sended to Coveralls. Everything running on TravisCI.
the project : https://github.com/mistic100/jQuery-QueryBuilder
my Grunt task : https://github.com/mistic100/grunt-qunit-blanket-lcov
So what should happen is that npm test runs QUnit+Blanket tests in a PhantomJS process and in the meanwhile, coverage results are saved in .coverage-results/all.lcov.
After a successfull build, grunt coveralls sends this file to Coveralls.
And my problem is here, the task does not find the file, although when I test on my computer it does.
see the last Travis log: https://travis-ci.org/mistic100/jQuery-QueryBuilder#L389
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
edit
so this has nothing to do with Travis but with my Grunt task where I use absolute paths thinking it's relative paths (I still don't know why it doesn't append on Windows though)
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
No, lifecycle-wise the build artefacts are still present, when running after_success commands.
The gruntfile.js configures force true and defines path - no issue here.
This should work.
I would suggest to throw in some commands to check the folders and files on Travis.
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/*
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/.coverage-results/*
Maybe you spot a permission issue during folder and file creation.
But that's my only guess.

Resources