I have an all-in-one npm script that:
Starts a React application
Starts Wiremock server in playback mode
Executes Cypress tests silently
For that I'm using concurrently:
"cypress:runner:one-shot": "concurrently npm:wiremock:playback npm:start:mock npm:cypress:execution:recorded",
After tests are executed I have to shut down the application and WireMock server.
For that, I added the following parameters to concurrently command:
--kill-others --success !command-0,!command-1
I need the all-in-one command to finish with an exit code 0.
For some reason is still finishing with a 1 (given that WireMock server is killed)
Is there any way to ignore the exit codes of any of those commands?
Just in case:
wiremock:playback is something like
"wiremock:playback": "npx wiremock --proxy-all '...' --verbose --port 3001 --enable-stub-cors --root-dir wiremock",
You can shut down WireMock by making a POST request to /__admin/shutdown (on the main host/port you configured WireMock to run on).
I'm using Laravel Forge to run a simple deploy script. npm run build calls 'vue-cli-service build'.
Script below. The script 'ends' on
DONE Build complete. The dist directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
but the thread does not quit, which causes issues in forge (e.g. thinks it's timed out or failed when it hasn't).
How do I do the equivelant of ctrl-c in a terminal once this has finished, in the deploy script? I've seen threads on trap SIGINT / trap etc. but I'm still not really sure how to implement it.
It may be that I just include the exit callback fix noted here: Vue-cli-service serve build completion callback?
git pull origin $FORGE_SITE_BRANCH;
npm run build;
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
if [ -f artisan ]; then
$FORGE_PHP artisan migrate --force
fi```
Try out to add Daemon termination command to the end of your deployment script
$FORGE_PHP artisan horizon:terminate
First time trying out serverless framework.
Am trying to use the local web shell to do some inspection.
But realise I couldn't list tables or show a list of records.
Web shell example:
var params = {
TableName: 'stocks-table-dev',
};
dynamodb.scan(params, function(err, data) {
if (err) ppJson(err); // an error occurred
else ppJson(data); // successful response
});
The above command throws a status code 413 error.
But aws cli works fine: aws dynamodb scan --table-name=stocks-table-dev --endpoint-url='http://localhost:8000'
I start the web shell with the command sls dynamodb start.
Prior to that, I used the following commands to install the plugin:
npm install --save-dev serverless-dynamodb-local
sls dynamodb install
Am I suppose to use the web shell for inspection?
Is there some configuration to be done for the web shell to work?
I am Pretty new to Team City and have been set with a task of creating a CI build.
The thing I trying to build is an angular2 app with protractor e2e tests.
All the other build steps in Team City run ok but I am having trouble trying to run the step that does the e2e test.
if I was to do this locally I would open a cmd window and type...
npm run start
I would then open another command window and type...
npm run e2e
How do I run parallel steps in Team City?
Build steps cannot be run parallel in TeamCity. What you need to do, is create a script that runs 'npm run start' in background, and then runs 'npm run e2e'. You can use command line runner to run the script
I still couldn't get the forever thing working properly for me so I created my own node script that fires up live-server and then executes npm run e2e and that seems to have done the trick thanks for your help though Oleg.
This is how I did it in the end...
const exec = require('child_process').exec;
var psTree = require('ps-tree');
const server = exec('live-server ./dist --port=3000 --no-browser');
const tests = exec('npm run e2e');
tests.stdout.on('data', function(data) {
console.log(data);
});
tests.stderr.on('data', function(data) {
console.log(data);
});
tests.on('close', function(code) {
console.log('closing code: ' + code);
exec('taskkill /PID ' + server.pid + ' /T /F');
});
How do you run the Express 4 app with Forever? (or is there a new package?)
I am running my Express 3 apps with Forever installed locally with the package manager. I use the command:
forever -a start app.js
Try this:
forever start ./bin/www
Let's take a look to package.json:
"scripts": {
"start": "node ./bin/www"
},
I guess when we call npm start, ./bin/www will be executed at some point.
Then look at the content of./bin/www:
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
so we are ready to listen for connections.
forever start --minUptime 1000 --spinSleepTime 1000 ./bin/www
If you use npm start to run your app, this works in place of it:
forever start -c "npm start" /path/to/app/dir/
Source: https://github.com/foreverjs/forever/issues/540
Try node app.js first, for me, I added a new module in code base, but i did not run npm install in my AWS box, forever is not giving you the error, it just stopped silently, but node will give you the error
http://expressjs.com/guide.html
in Expressjs guide doc,
use 'npm start'
I want use 'forever' but can not too
so,
add code at 'app.js'
var server = app.listen(3000, function() {
console.log('Listening on port %d', server.address().port);
});
and
$node app.js
can use it.
and forever can use too
Feb 2021
This solution is for express.js & forever, on Windows OS.
package.json
"scripts": {
"start": "set PORT=3001 && set DEBUG=myapp:* && forever start --minUptime 1000 --spinSleepTime 1000 ./bin/www",
}
Now run:
npm start
NOTE: For other OS, and customization see following link: https://expressjs.com/en/starter/generator.html