2

On our opsworks stack, we have a stack with 2 App Servers - 1 Java and 1 PHP. Each App Server currently has 1 instance each.

We also have several apps in this stack - 1 app is deployed to the Java app server / instance, while the rest are deployed to the PHP server / instance.

When we deploy an app, under "Advanced >>", both App Servers are ticked. We are wondering if there is a way to setup each app, such that the deployment for it defaults to the app server its currently on. For example, deploying a PHP app, to only the PHP App Server.

Right now, it's not a major problem, because deploying an app, say a PHP app to both app servers means the PHP App Server deployment succeeds, while the Java App Server deployment fails (and fails quite quickly) without impacting the success of the PHP App Server deployment.

This is more a case of tidying up loose ends.

1 Answers1

2

Is the deployment failure in opsworks recipes, or your own? Most of the opsworks deployment recipes have a guard to ensure it only runs on instances in the layer. For instance, in the java deployment recipe it guards that the recipes only run if the application type is java.

node[:deploy].each do |application, deploy|
  if deploy[:application_type] != 'php'
    Chef::Log.debug("Skipping deploy::php application #{application} as it is not an PHP app")
    next
  end
  # deployment actions for application types in this layer
end

I reproduced the guard above. This of course presumes the PHP apps are in a PHP layer, and the Java App is in a java layer.

dgtized
  • 121
  • 4
  • Thanks @dgtized - what I'm looking for is more in the Opsworks UI deployment wizard. I don't mind seeing the deployment failures - and the code has never deployed to the wrong server type, but it's more a minor "doh!" issue when I don't unselect the PHP server when I try to deploy Java code, or vice-versa – alexmcroberts Oct 14 '14 at 15:51