Installed meanstack on ubuntu 14.04

October 1, 2014 1k views

Hello everybody , i just installed mean on my droplet , is it nessesary to configure "forever" or what other workaround is required in order to make it run permanently.


1 Answer

The MEAN image simply provides you with a good starting point to build your project. It comes with Node and MongoDB preinstalled. In order to keep your project running, there are a number of approaches that you can take. Personally, I like to use the native init system as it allows you to manage your project like any other service on your server using commands like sudo service myapp restart

On Ubuntu 14.04, the init system is Upstart. You can use it to start and keep running Node apps. For example, DigitalOcean's one-click Ghost app uses an Upstart script to have Ghost start on boot. It looks like:

description "Ghost: Just a blogging platform"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectedly trigger a respawn

setuid ghost
setgid ghost
env NODE_ENV=production
chdir /var/www/ghost

exec /usr/local/bin/npm start --production

pre-stop exec /usr/local/bin/npm stop --production

and it is installed to /etc/init/ghost.conf Of course, you'll need to update it to reflect your project, but hopefully that points you in the right direction.

MEAN is a quick start boilerplate for creating applications based on MongoDB, Node.js, Express, and AngularJS. DigitalOcean's MEAN One-Click Application pre-installs the Mean.js implementation of the stack. It also comes with the front-end package manager bower and grunt, a tool for automating JavaScript tasks. Together, these tools provide a solid base to build your web application.
Have another answer? Share your knowledge.