OpsWorks - what to include in custom cookbook

∥☆過路亽.° 提交于 2019-12-11 04:01:19

问题


I'm new to chef and AWS OpsWorks.

I want to create a custom cookbook in order to precompile assets in production and set cron jobs with the whenever gem.

I found something about precompiling assets and I'll figure the cron part out as well, but I am confused how my custom chef project should look like. Is it a full chef solo project that will replace the standard cookbook(s) of AWS OpsWorks, thus I'll have to copy stuff from their github repo? Or will our and their cookbooks be merged? If so, what directories and files do I have to include as a bare minimum to e.g. execute "bundle exec whenever --update-crontab 'foo'"

Is it advisable to create a second project just for the cookbooks or can I place chef files in a subdirectory of my rails structure without cluttering it?


回答1:


OpsWorks, at the moment, does not support a single cookbook directory style. It works to build the repository like this:

delayed_job
  recipes
    deploy.rb
    undeploy.rb
s3cmd
  attributes
    default.rb
  recipes
    setup.rb
    configure.rb
  templates
    default
      s3cfg.erb
whenever
  recipes
    deploy.rb
    undeploy.rb

Then under stack settings, under custom cookbooks, one can add e.g. whenever::deploy under deploy. For default.rb recipes, once can just add e.g. sphinx instead of sphinx::default.

And after changing and pushing to the repositiory, one has to run the update_custom_cookbooks command from the deployments page.



来源:https://stackoverflow.com/questions/17921580/opsworks-what-to-include-in-custom-cookbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!