简体   繁体   English

nodejs新贵的配置文件

[英]config file for upstart with nodejs

Can you advise a upstart config file for nodejs on ubuntu? 您能否建议在ubuntu上使用nodejs的新贵配置文件? I've found the follows tutorial: http://howtonode.org/deploying-node-upstart-monit but it seem very old. 我找到了以下教程: http : //howtonode.org/deploying-node-upstart-monit,但它看起来很旧。

I have a little shell script that creates my config files. 我有一个小的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"

I use this in combination with TJ's deploy . 我将其与TJ的deploy结合使用。 So in my post deploy hook i do startup app file. 因此,在我的部署挂钩中,我会startup app file.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM