2
你可以建議在Ubuntu的nodejs upstart配置文件?我發現了下面的教程:http://howtonode.org/deploying-node-upstart-monit,但它看起來很舊。配置文件的暴發戶與nodejs
你可以建議在Ubuntu的nodejs upstart配置文件?我發現了下面的教程:http://howtonode.org/deploying-node-upstart-monit,但它看起來很舊。配置文件的暴發戶與nodejs
我有一個小小的shell腳本來創建我的配置文件。
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"
我把這個和TJ's deploy結合使用。所以在我的post部署掛鉤我做startup app file.
謝謝。我在我的服務器上使用nvm。我該如何運行nodejs?我應該爲nodejs創建一個特定的用戶 – Erik