質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top