简体   繁体   English

在OpsWorks上启动Node.js应用

[英]Launching Node.js app on OpsWorks

I'm having trouble getting my OpsWorks custom recipe to launch my node application. 我在获取OpsWorks自定义配方来启动节点应用程序时遇到麻烦。 I'm just starting to learn the fundamentals of Chef, so I may be missing something rather obvious. 我刚刚开始学习Chef的基础知识,所以我可能会缺少一些显而易见的东西。

To get me started I forked a copy of AWS nodejs cookbook and made very minor changes. 为了让我开始工作,我分叉了一份AWS nodejs食谱,并做了非常小的更改。 I was also sure to copy the node deploy script here . 我还确保在此处复制节点部署脚本。

My layers are now fully configured and I can trigger node manually via SSH, however it seems that upon deploy it's not triggered by the Ruby script. 现在,我的层已经完全配置好了,我可以通过SSH手动触发节点,但是似乎在部署时它不是由Ruby脚本触发的。

I'm assuming the start program line (which is the only place in the cookbook where I can see node being started) isn't getting run: 我假设启动程序行(这是菜谱中唯一可以看到节点启动的地方)没有运行:

check host node_web_app_<%= @application_name %> with address 127.0.0.1
  start program = "/bin/bash -c 'cd <%= @deploy[:deploy_to] %>/current; source <%= @deploy[:deploy_to] %>/shared/app.env; /usr/bin/env PORT=<%= @deploy[:nodejs][:port] %> NODE_PATH=<%= @deploy[:deploy_to] %>/current/node_modules:<%= @deploy[:deploy_to] %>/current /usr/local/bin/node <%= @monitored_script %>' --NODE_ENV=prod"
  stop program = "/usr/bin/pkill -f 'node <%= @monitored_script %>'"
  <% if @deploy[:ssl_support] -%>
  if failed port <%= @deploy[:nodejs][:port] %> type TCPSSL protocol HTTP
  <% else -%>
  if failed port <%= @deploy[:nodejs][:port] %> protocol HTTP
  <% end -%>
    request /
    with timeout 10 seconds
    then restart

So I'm really at a loss for why it's not doing it's thing. 所以我真的很茫然,为什么它没有做到这一点。

It almost seems as though this deploy cookbook wasn't fully completed. 似乎该部署指南尚未完全完成。 If there's a better cookbook available that someone can suggests, I'd consider changing. 如果有人可以提出更好的食谱,我会考虑进行更改。

Thanks. 谢谢。

Using the AWS opsworks nodejs layer, you should be able to set environment variables during App registration. 使用AWS opsworks nodejs层,您应该能够在App注册期间设置环境变量。 You should see a section like this: 您应该看到如下部分:

under app settings: 在应用程序设置下:

在此处输入图片说明

Where you can set all your variables to be included in the deployment. 您可以在其中设置所有变量以包含在部署中。

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

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