Can someone validate my understanding of chef?


#1

Hello fellow cooks,

I am looking for the best way to structure the following.

We have several legacy java websites running apache, tomcat & mysql.

Currently I am thinking about each site would have it’s own cookbook and branch
in the node, such as
the one below:

"example.com": {
"name":"example.com",
"admin":"contact@example.com",	  
"url":"example.com",  
"aliases":["www.example.com","example.co.uk","www.example.co.uk"],
"tomcat_port":"41511",	      
"jdbc_url":"jjdbc:mysql://host:3306",
"jdbc_user":"db",
"jdbc_password":"password",
},

The cookbook would define requirements such as apache, mysql and version of
java, but would
defer any configuration to a set of common definitions.
The website cookbook being a container to get configuration to the various
definitions. This would hopefully
also mean that production, staging and development Nodes would be a copy and
paste with a few tweaks.

Does this sounds like the chef way to go?

Cheers
Jono


#2

On 6 October 2010 08:55, jono@spiralarm.com wrote:

I am looking for the best way to structure the following.

We have several legacy java websites running apache, tomcat & mysql.

Currently I am thinking about each site would have it’s own cookbook and branch
in the node, such as
the one below:

…snip…

Does this sounds like the chef way to go?

That would generally be the way to go, although you might like to look
at using data bags for that instead, and including an attribute called
something like “deploy_to” which lists the servers that application
should be deployed onto.

I’m using a similar thing for hosting PHP and Rails sites in a
client’s cluster, and by using data bags it gives the flexibility to
quickly move a site to it’s own server by changing a single attribute.

Jon Wood
Blank Pad Development

07827 888143


#3

On 6 Oct 2010, at 12:19, Jon Wood wrote:

On 6 October 2010 08:55, jono@spiralarm.com wrote:

I am looking for the best way to structure the following.

We have several legacy java websites running apache, tomcat & mysql.

Currently I am thinking about each site would have it’s own cookbook and branch
in the node, such as
the one below:

…snip…

Does this sounds like the chef way to go?

That would generally be the way to go, although you might like to look
at using data bags for that instead, and including an attribute called
something like “deploy_to” which lists the servers that application
should be deployed onto.

(Missed the original email in this thread, but)

Have you looked at the application cookbook? It drives deploys from data bags - an example is http://gist.github.com/568508

The main reason I bring this up is that it uses ‘deploy_to’ as a path where to deploy things to. It works out what hosts to deploy it to by looking at the roles of the node and the roles you specify in the “server_roles” key. More info on http://github.com/opscode/cookbooks/tree/master/application/

-ash


#4

On 6 October 2010 12:26, Ash Berlin ash_opscode@firemirror.com wrote:

On 6 Oct 2010, at 12:19, Jon Wood wrote:

On 6 October 2010 08:55, jono@spiralarm.com wrote:

I am looking for the best way to structure the following.

We have several legacy java websites running apache, tomcat & mysql.

Currently I am thinking about each site would have it’s own cookbook and branch
in the node, such as
the one below:

…snip…

Does this sounds like the chef way to go?

That would generally be the way to go, although you might like to look
at using data bags for that instead, and including an attribute called
something like “deploy_to” which lists the servers that application
should be deployed onto.

(Missed the original email in this thread, but)

Have you looked at the application cookbook? It drives deploys from data bags - an example is http://gist.github.com/568508

The main reason I bring this up is that it uses ‘deploy_to’ as a path where to deploy things to. It works out what hosts to deploy it to by looking at the roles of the node and the roles you specify in the “server_roles” key. More info on http://github.com/opscode/cookbooks/tree/master/application/

Yes, I looked at it, but for my purposes it wasn’t really right - it
assumes that you’re going to be hosting things over a full cluster of
machines with specific uses, where as my situation is more of a shared
hosting one, with multiple sites on a single server handling web,
application and database. Because of that I was able to build my own
which was a lot simpler to use and support, but I can see that the
application cookbook would work well in other situations.

Jon Wood
Blank Pad Development

07827 888143


#5

If the sites all share a similar architecture (which it sounds like they do)
I would recommend creating a single “legacy_application” cookbook. You can
then create an application data bag with an item for each application you
will be deploying. These data bag items would contain data similar to the “
example.com” hash you shared above. You can still use a lot of the DRY
patterns laid forth by the Opscode application cookbook even though the
logic in your recipes may differ.

Seth


Opscode, Inc.
Seth Chisamore, Technical Evangelist
T: (404) 348-0505 E: schisamo@opscode.com
Twitter, IRC, Github: schisamo

On Wed, Oct 6, 2010 at 5:22 AM, Jon Wood jon@blankpad.net wrote:

On 6 October 2010 12:26, Ash Berlin ash_opscode@firemirror.com wrote:

On 6 Oct 2010, at 12:19, Jon Wood wrote:

On 6 October 2010 08:55, jono@spiralarm.com wrote:

I am looking for the best way to structure the following.

We have several legacy java websites running apache, tomcat & mysql.

Currently I am thinking about each site would have it’s own cookbook
and branch

in the node, such as
the one below:

…snip…

Does this sounds like the chef way to go?

That would generally be the way to go, although you might like to look
at using data bags for that instead, and including an attribute called
something like “deploy_to” which lists the servers that application
should be deployed onto.

(Missed the original email in this thread, but)

Have you looked at the application cookbook? It drives deploys from data
bags - an example is http://gist.github.com/568508

The main reason I bring this up is that it uses ‘deploy_to’ as a path
where to deploy things to. It works out what hosts to deploy it to by
looking at the roles of the node and the roles you specify in the
"server_roles" key. More info on
http://github.com/opscode/cookbooks/tree/master/application/

Yes, I looked at it, but for my purposes it wasn’t really right - it
assumes that you’re going to be hosting things over a full cluster of
machines with specific uses, where as my situation is more of a shared
hosting one, with multiple sites on a single server handling web,
application and database. Because of that I was able to build my own
which was a lot simpler to use and support, but I can see that the
application cookbook would work well in other situations.

Jon Wood
Blank Pad Development

07827 888143


#6

Thank you all for your responses. Data bags don’t work with chef-solo at the
moment do they?

Cheers
Jono

On 7 October 2010 00:24, Seth Chisamore schisamo@opscode.com wrote:

If the sites all share a similar architecture (which it sounds like they
do) I would recommend creating a single “legacy_application” cookbook. You
can then create an application data bag with an item for each application
you will be deploying. These data bag items would contain data similar to
the “example.com” hash you shared above. You can still use a lot of the
DRY patterns laid forth by the Opscode application cookbook even though the
logic in your recipes may differ.

Seth


Opscode, Inc.
Seth Chisamore, Technical Evangelist
T: (404) 348-0505 E: schisamo@opscode.com
Twitter, IRC, Github: schisamo

On Wed, Oct 6, 2010 at 5:22 AM, Jon Wood jon@blankpad.net wrote:

On 6 October 2010 12:26, Ash Berlin ash_opscode@firemirror.com wrote:

On 6 Oct 2010, at 12:19, Jon Wood wrote:

On 6 October 2010 08:55, jono@spiralarm.com wrote:

I am looking for the best way to structure the following.

We have several legacy java websites running apache, tomcat & mysql.

Currently I am thinking about each site would have it’s own cookbook
and branch

in the node, such as
the one below:

…snip…

Does this sounds like the chef way to go?

That would generally be the way to go, although you might like to look
at using data bags for that instead, and including an attribute called
something like “deploy_to” which lists the servers that application
should be deployed onto.

(Missed the original email in this thread, but)

Have you looked at the application cookbook? It drives deploys from data
bags - an example is http://gist.github.com/568508

The main reason I bring this up is that it uses ‘deploy_to’ as a path
where to deploy things to. It works out what hosts to deploy it to by
looking at the roles of the node and the roles you specify in the
"server_roles" key. More info on
http://github.com/opscode/cookbooks/tree/master/application/

Yes, I looked at it, but for my purposes it wasn’t really right - it
assumes that you’re going to be hosting things over a full cluster of
machines with specific uses, where as my situation is more of a shared
hosting one, with multiple sites on a single server handling web,
application and database. Because of that I was able to build my own
which was a lot simpler to use and support, but I can see that the
application cookbook would work well in other situations.

Jon Wood
Blank Pad Development

07827 888143


#7

On 6 October 2010 22:59, Jonathan Ferguson jono@spiralarm.com wrote:

Thank you all for your responses. Data bags don’t work with chef-solo at the
moment do they?

No, they don’t. If you’re using Solo, then you’re method is definately
the way to go.

Cheers
Jono

On 7 October 2010 00:24, Seth Chisamore schisamo@opscode.com wrote:

If the sites all share a similar architecture (which it sounds like they
do) I would recommend creating a single “legacy_application” cookbook. You
can then create an application data bag with an item for each application
you will be deploying. These data bag items would contain data similar to
the “example.com” hash you shared above. You can still use a lot of the DRY
patterns laid forth by the Opscode application cookbook even though the
logic in your recipes may differ.
Seth

Opscode, Inc.
Seth Chisamore, Technical Evangelist
T: (404) 348-0505 E: schisamo@opscode.com
Twitter, IRC, Github: schisamo

On Wed, Oct 6, 2010 at 5:22 AM, Jon Wood jon@blankpad.net wrote:

On 6 October 2010 12:26, Ash Berlin ash_opscode@firemirror.com wrote:

On 6 Oct 2010, at 12:19, Jon Wood wrote:

On 6 October 2010 08:55, jono@spiralarm.com wrote:

I am looking for the best way to structure the following.

We have several legacy java websites running apache, tomcat & mysql.

Currently I am thinking about each site would have it’s own cookbook
and branch
in the node, such as
the one below:

…snip…

Does this sounds like the chef way to go?

That would generally be the way to go, although you might like to look
at using data bags for that instead, and including an attribute called
something like “deploy_to” which lists the servers that application
should be deployed onto.

(Missed the original email in this thread, but)

Have you looked at the application cookbook? It drives deploys from
data bags - an example is http://gist.github.com/568508

The main reason I bring this up is that it uses ‘deploy_to’ as a path
where to deploy things to. It works out what hosts to deploy it to by
looking at the roles of the node and the roles you specify in the
"server_roles" key. More info on
http://github.com/opscode/cookbooks/tree/master/application/

Yes, I looked at it, but for my purposes it wasn’t really right - it
assumes that you’re going to be hosting things over a full cluster of
machines with specific uses, where as my situation is more of a shared
hosting one, with multiple sites on a single server handling web,
application and database. Because of that I was able to build my own
which was a lot simpler to use and support, but I can see that the
application cookbook would work well in other situations.

Jon Wood
Blank Pad Development

07827 888143


Jon Wood
Blank Pad Development

07827 888143