understand how opsworks and custom cookbooks work

2019-09-02 02:27发布

问题:

I have my stack on opsworks and app is deploying fine (cake php).

Now I have to configure some things like chmod, php versions, etc etc... I'm reading about this but don't know exactly whats the best way to do this.

Question 1 - Should I do this with custom deploy JSON or via custom cookbooks?

Question 2 - Whats the correctly way to work with custom cookbooks? Fork original AWS repositories, update recipes and then use it in my stack?

回答1:

depends on what you would like to achieve, you may implement many things, such as:

  1. a recipe, which is invoked only once during a chef-client run.
  2. a lightweight resource provider, which supports notifies and can be invoked zero or more times.
  3. a definition, which is available before resource collection and can be invoked zero or more times.

for your second question, first checkout berkshelf -- a cookbook manager. i would suggest forking a project only if the project is dead, otherwise i would consider to contribute to already implemented project so everybody will benefit from it; and you can always write your own wrapper cookbook, you can also refer to Chef wrapper cookbook best practices.