Why can't I run two node.js AWS opsworks layers?

It might be very easy to fix, but it seems like I can't deploy two layers of node.js OpsWorks on AWS. I need to have one node.js layer for my frontend and I am a middle tier that consumes messages from a queue. I have a web resource node.js, but now when I try to add a second layer of node.js, node.js is not one of the options in the dropdown. Is this intentional? I had to create a second app for my node.js layer to handle this, but this is an ugly solution since by default the same chef scripts run on all instances of node.js and on my load the balancing layer. Any help is appreciated!

+3


source to share


1 answer


Creating a second app is the best way.

In your recipes, you can use the stack config and config values to see what level the current instance is at and decide what you need (if any) when the lifecycle configure / deploy event runs.

  • At your front-end tier, you will deploy the frontend app and ignore the second app and vice versa at the middle tier.
  • On your load balancer, you probably won't do anything at deployment.


To determine which application is deployed in a Deploy lifecycle event, you can use the search feature in Chef and the deploy attribute hosted in the application.

search(:aws_opsworks_app, "deploy:true").each do |app|
  #Your deploy logic here
end

      

+2


source







All Articles