- From: Adam Jacob <
>
- To:
- Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Managing Node Info
- Date: Tue, 4 Oct 2011 15:37:24 -0700
If the application is identical, and the only difference is data, I would:
0) Have a base role that defines how to deploy your app, primarily
about the run list, and any common attributes.
name "app_base"
run_list [ "recipe[app]" ]
1) Have a role for each vhost that uses an attribute like this:
name "app_admin"
run_list [ "role[app_base]" ]
default_attributes(
{
"app" => {
"vhosts" => {
"admin.domain.com" => "/srv/admin.domain.com"
}
}
}
)
2) Have the app recipe walk the node["app"]["vhosts"], doing your
docroot creation, code checkout, and webserver configs
3) Assign the roles to the nodes
If you were going to do this a lot, you could change the above to use
data bags - but for the small use case you submitted here, I wouldn't
bother.
On Tue, Oct 4, 2011 at 1:25 PM, Aaron Abramson
<
>
wrote:
>
How would one go about setting environment attributes for prod/qa/dev if
>
each 'environment' is simply checked out into a separate vhost on the same
>
node?
>
We're deploying a PHP app, and we have admin.domain.com, beta.domain.com and
>
dev.domain.com for our different environments, but they're all just vhosts
>
with different docroots on the same node.
>
Right now I have 3 recipes, one for each environment, but I'd like to get to
>
1 recipe with 3 sets of attributes.
>
>
On Oct 4, 2011, at 3:15 PM, jorge espada wrote:
>
>
Thanks Adam, that's what i'm going to do.
>
@Bryan I would say yes.. since you manage your env with chef environments
>
[0]
>
[0] http://wiki.opscode.com/display/chef/Environments
>
>
Jorge E. Espada
>
Phone: +54 9 341 5692435
>
>
>
On Tue, Oct 4, 2011 at 5:09 PM, Bryan Berry
>
<
>
>
wrote:
>
>
>
> so if you have the same app in three different instances, dev, qa, and
>
> prod, you would abstract that application as a role?
>
>
>
> On Tue, Oct 4, 2011 at 9:56 PM, Adam Jacob
>
> <
>
>
> wrote:
>
>>
>
>> Yeah, if they are really that tightly coupled (1:1) I would say they
>
>> each have a different role (and they probably all use the same base
>
>> role that specifies the bulk of the runlist, and those roles just set
>
>> the couple of node attributes that matter.)
>
>>
>
>> Adam
>
>>
>
>> On Tue, Oct 4, 2011 at 12:51 PM, jorge espada
>
>> <
>
>
>> wrote:
>
>> > Thanks Adam for answer, yes they are truly per-node, for instance we
>
>> > have:
>
>> > 4 servers(nodes) called app[1-4] all of them are running tomcat and
>
>> > tomcat
>
>> > is configured to talk to an ejabberd cluster, but each of them are
>
>> > connected to a different server in that ejabberd cluster.. hence each
>
>> > node
>
>> > (app1 , app2...) has a different config for tomcat, despite they belong
>
>> > to
>
>> > the same services, let say app-services.. so what do you suggest one
>
>> > role
>
>> > per instance of the same service ?
>
>> > Thanks
>
>> > Jorge E. Espada
>
>> > Phone: +54 9 341 5692435
>
>> > On Tue, Oct 4, 2011 at 4:29 PM, Adam Jacob
>
>> > <
>
>
>> > wrote:
>
>> >>
>
>> >> Are they truly per-node, or are they four different roles?
>
>> >>
>
>> >> Ideally, you would abstract the differences, and then just apply the
>
>> >> attributes to each node through a role (or on the node itself, if it's
>
>> >> truly one-off)
>
>> >>
>
>> >> Best,
>
>> >> Adam
>
>> >>
>
>> >> On Tue, Oct 4, 2011 at 12:22 PM, jorge espada
>
>> >> <
>
>
>> >> wrote:
>
>> >> > Hi, what will be the right or better approach to store custom (non
>
>> >> > default)
>
>> >> > config attributes per node ?
>
>> >> > For instance, lets say that I have the tomcat or apache cookbook
>
>> >> > applied
>
>> >> > to
>
>> >> > 4 nodes, and all of them have different config files, should I write
>
>> >> > 4
>
>> >> > different attributes files for that cookbook , also for each same
>
>> >> > cookbook
>
>> >> > applied to those nodes with different configs? Or is better to use
>
>> >> > data
>
>> >> > bags
>
>> >> > for custom configs on each nodes?
>
>> >> > I know that attribute is a per-node thing. and data bag is across
>
>> >> > nodes.
>
>> >> > but I'm not sure how to sort this situation.. or there is another
>
>> >> > thing
>
>> >> > that
>
>> >> > i'm missing
>
>> >> > Thanks
>
>> >> > Jorge E. Espada
>
>> >> > Phone: +54 9 341 5692435
>
>> >> >
>
>> >>
>
>> >>
>
>> >>
>
>> >> --
>
>> >> Opscode, Inc.
>
>> >> Adam Jacob, Chief Product Officer
>
>> >> T: (206) 619-7151 E:
>
>> >>
>
>> >
>
>> >
>
>>
>
>>
>
>>
>
>> --
>
>> Opscode, Inc.
>
>> Adam Jacob, Chief Product Officer
>
>> T: (206) 619-7151 E:
>
>>
>
>
>
>
>
--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E:
Archive powered by MHonArc 2.6.16.