Has anyone found a way to force azure to gracefully fail a deploy if it cannot start the node server?
There was a bug in our node server scripts, and I was only able to find it by pulling dump logs and tracing through them. I am updating the script to better catch and log the error, but I am unable to find a good way for it to fail the deployment if it cannot start the server.
I have found many people that are getting their deployments to fail, but I want mind to fail and cannot seem to force it in a scenario in which I believe it should.
Here is snippet from server.js
catch (err) {
console.error(err);
process.exit(1);
}
You can try to leverage the Custom Deployment Script. Usually, we will leverage this to do some additionally steps during the deployment task, like execute gulp
or Browserify
scripts to build up the production application from source code scripts. And if test scripts leverage pure node.js scripts, they are should be in the same mechanism.
Also, leveraging the custom deployment script, you can control the deployment process.
For node.js application, you can follow https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script#a-first-lets-generate-a-deployment-script-for-the-nodejs-website to generate the required deployment scripts, and you can modify the scripts and put them into your root directory of your application, then deploy them together to Azure.
Any further concern, please feel free to let me know.