I don't know what I should call it on Ubuntu Server, but most time I work on Windows it is called a service for running an application on the background.
I build my web server based on Node.js, so to deploy it on Ubuntu sever I need a 'service' for running Node.js, I want the 'service':
Normally, I run a Node.js application by opening a terminal an run the js file. But from my understanding this is more for testing purpose because there is no guarantee from the terminal to start Node.js after a fail.
js application locally after closing the terminal or Application, to run the nodeJS application permanently. We use NPM modules such as forever or PM2 to ensure that a given script runs continuously. NPM is a Default Package manager for Node.
Many people use forever https://github.com/nodejitsu/forever , which has become pretty much industry standard.
If you are on Ubuntu, you can also use init scripts ( google 'ubuntu upstart' ), that will do much the same thing, and are guaranteed to if the server ever gets restarted.
Here is my upstart script for example https://gist.github.com/qbert65536/5271721 .
It gets run when the server starts, you also control them with
start myapp, stop myapp, restart myapp , where myapp.conf is the name of the upstart script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With