AWS opsworks多个nodejs应用程序? [英] aws opsworks multiple nodejs apps?

查看:266
本文介绍了AWS opsworks多个nodejs应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个OpsWorks Nodejs堆栈。我设置多个nodejs应用程序。现在的问题是,所有nodejs server.js脚本监听80端口亚马逊生命检查,但该端口只能由一个被使用。 我不知道如何解决这个问题。我已阅读亚马逊的文档,但无法找到解决办法。我读,我可以尝试改变部署的配方变量设置此生检查,以不同的端口,但没有奏效。任何帮助?

解决方案

我争夺这个问题了一会儿,终于找到了一个非常简单的解决方案。


端口处于部署食谱的属性设置...

https://github.com/aws/opsworks-cookbooks/blob/release-chef-11.10/deploy/attributes/deploy.rb

而行......

 默认的[:部署] [应用] [:nodejs] [:端口] =部署[:ssl_support]? 443:80
 

您可以使用堆栈的定制JSON,如重写此

  {
  部署 : {
    app_name_1:{
      nodejs:{
        口:80
      }
    },
    app_name_2:{
      nodejs:{
        端口:3000
      }
    }
  },
  MongoDB的:{
    ...
  }
}
 


现在在/etc/monit.d/node_web_app-.monitrc的monitrc文件应反映各自的端口,monit的应该让他们活着!

I have one OpsWorks Nodejs Stack. I setup multiple nodejs apps. The problem now is that all nodejs server.js scripts listens on port 80 for amazon life check but the port can be used only by one. I dont know how to solve this. I have read amazon documentation but could not find the solution. I read that I could try to change deploy recipe variables to set this life check to different port but it didn't work. Any help?

解决方案

I battled with this issue for a while and eventually found a very simple solution.


The port is set in the deploy cookbook's attributes...

https://github.com/aws/opsworks-cookbooks/blob/release-chef-11.10/deploy/attributes/deploy.rb

by the line...

default[:deploy][application][:nodejs][:port] = deploy[:ssl_support] ? 443 : 80

you can override this using the stack's custom json, such as:

{
  "deploy" : {
    "app_name_1": {
      "nodejs": {
        "port": 80
      }
    },
    "app_name_2": {
      "nodejs": {
        "port": 3000
      }
    }
  },
  "mongodb" : {
    ...
  }
}


Now the monitrc files at /etc/monit.d/node_web_app-.monitrc should reflect their respective ports, and monit should keep them alive!

这篇关于AWS opsworks多个nodejs应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆