[chef] Re: Re: Re: Running two applications in the same node using application cookbook


Chronological Thread 
  • From: Max Gorbul < >
  • To:
  • Subject: [chef] Re: Re: Re: Running two applications in the same node using application cookbook
  • Date: Thu, 26 Apr 2012 11:57:17 -0700

I did a dirty hack right in the application::default recipe. it works. But I agree this solution smells :)

      node.run_state[:current_app] = app                                                                                                                                                                                     
      node.run_state[:seen_recipes].delete("application::#{recipe}")                                                                                                                                                         
      include_recipe "application::#{recipe}"  

--max

On Thu, Apr 26, 2012 at 11:23 AM, Sachin Sagar Rai < " target="_blank"> > wrote:
I'd also the same issue earlier. But I've fixed it by modifying some code and restructuring the data_bag and the database master recipe.
And now I can deploy not only multiple rails + unicorn app, but also PHP apps like Drupal and Wordpress on the same node.

I'll be doing a screencast soon as I've seen this pain with other devs too.

-------------------------------------------
@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow

On Thursday, April 26, 2012 at 9:06 PM, Joshua Timberman wrote:

Hello,


On Apr 25, 2012, at 4:26 PM, Daniel Cukier wrote:

Is it possible to run 2 applications in the same node using the application cookbook?

I have tried to do it by adding two roles of two different applications to the same node. Both roles are based on the application cookbook.

But just one of the applications is being installed.


It is not currently possible because of the way the application::default recipe works and how Chef de-duplicates recipes.

The application::default recipe does an "include_recipe" for each recipe relevant to the application being managed, so if you have two apps that should be rails + unicorn, it does this:

# app1
include_recipe "application::rails"
include_recipe "application::unicorn"

# app2
include_recipe "application::rails"
include_recipe "application::unicorn"

However, the second app, Chef will say[0] "not including recipe application::rails because I have already seen it.

The solution to this problem is address by implementing "application" as a lightweight resource, and is the work done primarily by Noah and Andrea for COOK-634[1][2]. The cookbooks for this work will be released by Opscode at some point soon; the more people we get testing the code the better, and the sooner we can release. They're probably beta quality right now, though I believe that the existing recipes will remain backwards compatible for a couple months after release.


[0]: you can see the messages with -l debug

--
Opscode, Inc
Joshua Timberman, Technical Program Manager
IRC, Skype, Twitter, Github: jtimberman





Archive powered by MHonArc 2.6.16.

§