By Jerba
Hello there, DigitalOcean community!
I’m very new to Digital Ocean and in fact hosting in general, so I apologies prior if what you’re about to read is an incredibly rookie question, but…
I’ve cloned a copy of a standard express (NodeJS) application on my droplet from a bitbucket repository and I can very easily run it via SSH using Nodemon (https://www.npmjs.com/package/nodemon), however, as I’m executing the bin/www via the SSH connection, when I exit, the application stops running (as expected).
My question is, how do I configure my server so that Nodemon is always running my application on the server, I’m aware that there are ‘services’ or .conf files on Ubuntu which can be utilised to achieve such functionality, but I’m not sure how exactly I’d go about doing so…
Also, please correct me if I’m wrong, but if I do handle this via .conf / services, the service will automatically restart if for instance Digital Ocean does a mass droplet reload / update i.e after / during maintenance etc… Right?
Note: If this is a bad way of running a Node application on a server please let me know. I’d like to know the best / most efficient method(s) of doing this.
I appreciate any help, thanks in advance!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
There’s Node module called ‘forever’ or ‘pm2’, if you need clustering. More info here
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.