Can you advise a upstart config file for nodejs on ubuntu? I've found the follows tutorial: http://howtonode.org/deploying-node-upstart-monit but it seem very old.
Asked
Active
Viewed 1,102 times
1 Answers
1
I have a little shell script that creates my config files.
create_upstart() {
project=$1
file=$2
conf="/etc/init/${project}_${file}.conf"
cat > $conf << EOF
#!upstart
description "Node Process - $1"
author "Geert Pasteels"
respawn
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
script
export NODE_ENV="production"
export PORT="3001"
exec /usr/bin/node /var/www/$project/current/$file.js >> /var/www/$project/shared/logs/$file 2>&1
end script
EOF
echo $conf
# Restart upstart script
stop ${project}_${file}
start ${project}_${file}
echo Restarted ${project}_${file}
}
create_upstart "$1" "$2"
I use this in combination with TJ's deploy. So in my post deploy hook i do startup app file.

Pickels
- 33,902
- 26
- 118
- 178
-
Thanks. I'm using nvm on my server. How can I run nodejs with this one? And should I create an specific user for nodejs – Erik Nov 06 '12 at 18:34