Multiple application instances on a node


#1

I’ve tried to Google and search this mailing list but I might be missing the
right term for what I’m trying to accomplish.

I want to install and configure multiple web applications on the same node.
Although I’m writing a cookbook that does more, the standard apache2 cookbook
is a sufficient example. I can run the “web_app” definition many times to get a
conf file for each web app. However, I can’t work out how to store attributes
for each application. Is there a pattern for when there are multiple of the
same “thing” on a node?


#2

Hi,

I usually just use separate cookbooks for each application. The same way
you can have a node/role attributes separated for each application

node[‘application1’][‘root_path’]
node[‘application2’][‘root_path’]

etc.

If your application are very similar (for example several rails
applications) you can use one cookbook and control everything via
attributes - here is an example - https://github.com/iafonov/rails_ghetto

On Tue, Jul 31, 2012 at 4:07 PM, Ian Buchanan
ian.buchanan@versionone.comwrote:

I’ve tried to Google and search this mailing list but I might be missing
the
right term for what I’m trying to accomplish.

I want to install and configure multiple web applications on the same node.
Although I’m writing a cookbook that does more, the standard apache2
cookbook
is a sufficient example. I can run the “web_app” definition many times to
get a
conf file for each web app. However, I can’t work out how to store
attributes
for each application. Is there a pattern for when there are multiple of the
same “thing” on a node?


#3

On Tue, Jul 31, 2012 at 8:07 AM, Ian Buchanan
ian.buchanan@versionone.comwrote:

I’ve tried to Google and search this mailing list but I might be missing
the
right term for what I’m trying to accomplish.

I want to install and configure multiple web applications on the same node.
Although I’m writing a cookbook that does more, the standard apache2
cookbook
is a sufficient example. I can run the “web_app” definition many times to
get a
conf file for each web app. However, I can’t work out how to store
attributes
for each application. Is there a pattern for when there are multiple of the
same “thing” on a node?

You could try creating multiple ‘nodes’ on each physical machine so that
each node would have its own instance of the application. You should be
able to do this by running ‘chef-client -N [node_name] -k [node_key]’.

I have done this many times with my tomcat cookbook to setup several
instances of tomcat, each with their own web apps.


#4

Igor,

Thanks much. Your rails_ghetto recipe is the model I was looking for.

Ian

From: Igor Afonov [mailto:afonov@gmail.com]
Sent: Tuesday, July 31, 2012 9:26 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Multiple application instances on a node

Hi,

I usually just use separate cookbooks for each application. The same way you can have a node/role attributes separated for each application

node[‘application1’][‘root_path’]
node[‘application2’][‘root_path’]

etc.

If your application are very similar (for example several rails applications) you can use one cookbook and control everything via attributes - here is an example - https://github.com/iafonov/rails_ghetto
On Tue, Jul 31, 2012 at 4:07 PM, Ian Buchanan <ian.buchanan@versionone.commailto:ian.buchanan@versionone.com> wrote:
I’ve tried to Google and search this mailing list but I might be missing the
right term for what I’m trying to accomplish.

I want to install and configure multiple web applications on the same node.
Although I’m writing a cookbook that does more, the standard apache2 cookbook
is a sufficient example. I can run the “web_app” definition many times to get a
conf file for each web app. However, I can’t work out how to store attributes
for each application. Is there a pattern for when there are multiple of the
same “thing” on a node?


#5

Bryan,

It seems like one advantage of this approach, in contrast to Igor’s approach, is the simple and most common case where node = machine can have reasonable defaults. I’ll try this to see how else it compares.

Ian

From: Bryan Baugher [mailto:bjbq4d@gmail.com]
Sent: Tuesday, July 31, 2012 10:07 AM
To: chef@lists.opscode.com
Subject: [chef] Re: Multiple application instances on a node

On Tue, Jul 31, 2012 at 8:07 AM, Ian Buchanan <ian.buchanan@versionone.commailto:ian.buchanan@versionone.com> wrote:
I’ve tried to Google and search this mailing list but I might be missing the
right term for what I’m trying to accomplish.

I want to install and configure multiple web applications on the same node.
Although I’m writing a cookbook that does more, the standard apache2 cookbook
is a sufficient example. I can run the “web_app” definition many times to get a
conf file for each web app. However, I can’t work out how to store attributes
for each application. Is there a pattern for when there are multiple of the
same “thing” on a node?

You could try creating multiple ‘nodes’ on each physical machine so that each node would have its own instance of the application. You should be able to do this by running ‘chef-client -N [node_name] -k [node_key]’.

I have done this many times with my tomcat cookbook to setup several instances of tomcat, each with their own web apps.