[chef] Re: Re: Re: application cookbook w/ Rails app


Chronological Thread 
  • From: Denis Haskin < >
  • To:
  • Subject: [chef] Re: Re: Re: application cookbook w/ Rails app
  • Date: Sat, 21 Jul 2012 15:21:20 -0400

Good to hear.  Fork, fix, and submit a pull request!

Sent from mobile

On Jul 21, 2012 3:02 PM, "Wes Morgan" < "> > wrote:
Thanks for the insight and examples, Denis & Igor. I think I was being thrown off by the documentation errors and all the deprecated code in the application cookbook. It's starting to come together now.

Wes

On Jul 21, 2012, at 12:20 PM, Denis Haskin wrote:

Correct, you need the ruby do block.

I have a cookbook for my application, which has

depends "application_ruby"

in its metadata.rb, and then in its default recipe, has this (as an example):

application "zmx_app" do
  path "/srv/zmx"
  owner 'nobody'
  group 'nogroup'

  repository ' :zmxmusic/zmx2.git'
  deploy_key "-----BEGIN RSA PRIVATE KEY----- ...etc... -----END RSA PRIVATE KEY-----\n" # note embedded newlines
  if node.chef_environment=='production'
    revision '2.26'
    action :deploy
  else
    revision 'master'
    action :force_deploy
  end

  db = "zmx_#{node.chef_environment}"

  rails do
    gems ['bundler']
    precompile_assets true
    database do
      reconnect true
      encoding 'utf8'
      username '...'
      adapter 'mysql2'
      password '...'
      database db
    end
    database_master_role "zmx_database_master"
  end

  passenger_apache2 do
  end
end

There might well be better ways to do it; I migrated up from the old cookbook.  My apache/passenger config is really done in other recipes; one of these days I'll take care of that and probably migrate to unicorn, nginx, etc.

Don't know what you're using for database.  I had to wrestle mightily with the mysql (and database?) cookbooks to get a working set of cookbooks+recipes that would come up from scratch on AWS... I'm not even convinced I've actually got that, yet, but needed to move on and get stuff done.

--
Denis Haskin





On Sat, Jul 21, 2012 at 1:09 PM, Wes Morgan < " target="_blank"> > wrote:
I'm trying to deploy a Rails app using the new application cookbook. According to the README, I'm supposed to declare a dependency on the application_rails cookbook in the metadata.rb, but that doesn't seem to exist. Earlier in the README, application_ruby is mentioned, so I switched it to that. Do we need a documentation fix there?

Anyway, I can't quite figure out how the rails-y portion of the cookbook is supposed to be invoked. Just declaring a "depends" line in metadata.rb doesn't actually run anything, does it?

I see in the examples that there is a rails do ... end block in the application's block. Is that what triggers it?

Does anyone have a working example of deploying a Rails app w/ the new application cookbook?

Wes





Archive powered by MHonArc 2.6.16.

§