2

I have become the interim ops guy until the company I am contracting for finds one that knows a heck of a lot more than me. I'm going through our current setup for OpsWorks and our recipes. I noticed that our deploy recipe includes our configure recipe. When I asked about this, I was told it was due to some mystery around when configure is actually triggered.

I've been reading the docs here and here are my questions:

The docs say that OpsWorks runs Deploy after Setup. The docs also say that Configure is ran after any instance enters or leaves the online state. Does Configure then run between Setup and Deploy or after Deploy, when a new instance is spun up?

Also, is it standard practice to include a configure recipe in the deploy recipe for those times when a deploy is executed by itself or should we be using a different recipe that would handle configuration changes based on a deployment?

2 Answers 2

3

Does Configure then run between Setup and Deploy or after Deploy, when a new instance is spun up?

Going by my OpsWorks logs, it does indeed seem configure is run after setup but before deploy. In general you should use this for things which need to be done every time the instance is booted (such as updating a DNS record for example, if you don't use an elastic IP). Keep in mind that unless it's a time based instance OpsWorks won't automatically run a fresh deploy when an instance comes online after being stopped (although if it's a new instance it will).

different recipe that would handle configuration changes based on a deployment?

For application specific deployment configuration (such as setting file permissions, etc.) you should use Chef deployment hooks.

3

The second part of thexacre's answer is correct, but the first part needs some clarification:

The setup event is run when an instance starts up, whether from a cold-start (completely new instance) or from the "stopped" state (an EBS-backed instance that was launched previously). This setup event includes the recipes that are specified to run for the deploy event but does not actually issue a separate deploy event. The OpsWorks logs are therefore not reliable indicators of when the deploy recipes are run.

The configure event is run when an instance in the stack enters or leaves the online state, including this instance itself. This event can be used to update cross-instance dependencies, such as to add an instance to the (perhaps HAProxy) load balancer instance, or to add it to a (perhaps MongoDB) cluster.

The deploy event is run in response to hitting the "Deploy" button in the UI.

See the AWS OpsWorks docs for more info.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .