Node.js: gestire le app in produzione su Ubuntu Server 14.04

Su Ubuntu Server 14.04 possiamo gestire le app in Node.js con il servizio upstart.

Node.js di Gabriele Romanato

Su Ubuntu Server 14.04 possiamo gestire le app in Node.js con il servizio upstart.

Create un file .conf in /etc/init (ad esempio app.conf) con i seguenti contenuti:


start on filesystem and started networking
stop on shutdown
respawn
setuid nomeutente
chdir /home/nomeutente/app
exec /usr/local/bin/node app.js

La vostra app verrà eseguita come servizio e con l'utenza scelta anche al boot del sistema e potrete gestirla con il comando service seguito dal nome del file .conf scelto e dalle normali opzioni del comando. Ad esempio:


sudo service app restart

Commenti