Dependency between nodes


#1

Hi,
I wanted to know if chef is suitable for the following scenari, if yes then
what would be the best way to achieve it.
We need to deploy a web-application which contains 3 components

  1. A WAR file - portal
  2. An application - A module which interacts with the portal for different
    tasks
  3. DB
  4. Active MQ - To facilitate the communication b/w Portal and App

If the above 4 components are on different machines/nodes, can the
deployment be made atomic i.e. either all nodes get upgraded or none does.
I have an ANT script which can handle the deploy-all or none on a sinle
node, is chef a possible solution if we need to suppprt the same across
nodes?

Thanks,
~Vikas


#2

There have been discussions around about Chef being used as a deployment
mechanism or not. From what i have analysed and reviewed based on the
community feedbacks + some of my experience, Chef should not be used for
deployments. Chef is a configuration management tool i.e you use Chef to
set up your servers where the applications are deployed/hosted. Depending
of Chef for deployment is just leaving more room for failures. Are you
gonna do a chef-run for a production deploy? If you so, what happens if the
chef run fails due to say, may be any silly reasons? And how are you going
to put a gate on the deployment (although this can be archived using
branches in your repo).

The mentioned type of deployment can to achieve best with a combination of
capistrano + ssh (in my opinion). Check out capistrano 2 / 3 (many suggest
to use 3, + me :slight_smile: ) . But i still use cap2. And this have tied me down to
an older Version of chef.

A .war can be deployed to a say Tomcat cointainer using ssh from the
repository via the jenkins servers (if you use jenkins). & the DB related
deploys are done mostly via the capistrano. Not sure on the other 2 apps on
what they are though.

hope this gives some to think and possibly a solution.

On Sun, May 17, 2015 at 11:16 PM, Vikas Roonwal pvikasroonwal@gmail.com
wrote:

Hi,
I wanted to know if chef is suitable for the following scenari, if yes
then what would be the best way to achieve it.
We need to deploy a web-application which contains 3 components

  1. A WAR file - portal
  2. An application - A module which interacts with the portal for different
    tasks
  3. DB
  4. Active MQ - To facilitate the communication b/w Portal and App

If the above 4 components are on different machines/nodes, can the
deployment be made atomic i.e. either all nodes get upgraded or none does.
I have an ANT script which can handle the deploy-all or none on a sinle
node, is chef a possible solution if we need to suppprt the same across
nodes?

Thanks,
~Vikas


Regards
nirish okram


#3

On Sun, May 17, 2015 at 11:16 PM, Vikas Roonwal pvikasroonwal@gmail.com wrote:
Hi,
I wanted to know if chef is suitable for the following scenari, if yes then what would be the best way to achieve it.
We need to deploy a web-application which contains 3 components

  1. A WAR file - portal
  2. An application - A module which interacts with the portal for different tasks
  3. DB
  4. Active MQ - To facilitate the communication b/w Portal and App

If the above 4 components are on different machines/nodes, can the deployment be made atomic i.e. either all nodes get upgraded or none does.
I have an ANT script which can handle the deploy-all or none on a sinle node, is chef a possible solution if we need to suppprt the same across nodes?

Thanks,
~Vikas

As mentioned by niristotle; you can use chef to build the infrastructure and deploy the app.

I’ve used chef to build up from a base image a Tomcat server, then configure tomcat, then deploy a WAR file from a known location into that server. I then image that resulting server to be used for an Amazon Auto Scaling group. However; Chef is not necessarily needed here as I’m using it purely as a build chain. You could do this with packer, or a number of other tools.

If you wanted to continue to maintain state on this server once built; chef would have that added benefit.

In my case I simply have a role as shown which is used to apply to a node bootstrapped with knife (in AWS in my case):

{
“name”: “java-appserver”,
“default_attributes”: {},
“override_attributes”: {
“java”: {
“jdk_version”: “7”
},
“oracle”: {
“accept_oracle_download_terms”: true
},
“aws”: {
“s3”: {
“bucket”: “myappdeploybucket”
}
},
“tomcat”: {
“java_options”: “${JAVA_OPTS} -Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx25g -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=1g -XX:+DisableExplicitGC -XX:+CMSClassUnloadingEnabled”
}
},
“json_class”: “Chef::Role”,
“description”: “Role for Java Apps Servers using OpenJDK7”,
“chef_type”: “role”,
“run_list”: [
“recipe[java]”,
“recipe[tomcat]”,
“recipe[tomcat::users]”,
“recipe[simianarmy::app-deploy-edda]”
]
}

I’m using community java and tomcat cookbooks to setup the Web App Server.
https://supermarket.chef.io/cookbooks/java
https://supermarket.chef.io/cookbooks/tomcat

The final recipe merely drops the WAR into the tomcat webs directory to auto-deploy

Copy EDDA WAR to webapps for autodeployment - Requires that instance have role with access to bucket

execute “aws s3 cp #{node[‘simianarmy’][‘urls’][‘edda’]} /var/lib/tomcat7/webapps/” do
action :run
not_if { File.exist?("/var/lib/tomcat7/webapps/#{server_file(node[‘simianarmy’][‘urls’][‘edda’])}") }
end


Ted
GPG Key: 0x2B272DFD | E564 BCC1 F601 5D1F 01CD AC10 C37D D2B0 2B27 2DFD


#4

You might also want to take a look at chef-provisioning or vagrant for
multi-machine setups

Alternatively, terraform explicitly knows about node dependencies an (re-)
builds them in the correct order. Not sure if chef-provisioning does that
too.

HTH, Torben
Am 18.05.2015 09:46 schrieb “Ted B” ted@pobox.com:

On Sun, May 17, 2015 at 11:16 PM, Vikas Roonwal pvikasroonwal@gmail.com
wrote:
Hi,
I wanted to know if chef is suitable for the following scenari, if yes
then what would be the best way to achieve it.
We need to deploy a web-application which contains 3 components

  1. A WAR file - portal
  2. An application - A module which interacts with the portal for
    different tasks
  3. DB
  4. Active MQ - To facilitate the communication b/w Portal and App

If the above 4 components are on different machines/nodes, can the
deployment be made atomic i.e. either all nodes get upgraded or none does.
I have an ANT script which can handle the deploy-all or none on a sinle
node, is chef a possible solution if we need to suppprt the same across
nodes?

Thanks,
~Vikas

As mentioned by niristotle; you can use chef to build the infrastructure
and deploy the app.

I’ve used chef to build up from a base image a Tomcat server, then
configure tomcat, then deploy a WAR file from a known location into that
server. I then image that resulting server to be used for an Amazon Auto
Scaling group. However; Chef is not necessarily needed here as I’m using it
purely as a build chain. You could do this with packer, or a number of
other tools.

If you wanted to continue to maintain state on this server once built;
chef would have that added benefit.

In my case I simply have a role as shown which is used to apply to a node
bootstrapped with knife (in AWS in my case):

{
“name”: “java-appserver”,
“default_attributes”: {},
“override_attributes”: {
“java”: {
“jdk_version”: “7”
},
“oracle”: {
“accept_oracle_download_terms”: true
},
“aws”: {
“s3”: {
“bucket”: “myappdeploybucket”
}
},
“tomcat”: {
“java_options”: “${JAVA_OPTS} -Djava.awt.headless=true
-Dfile.encoding=UTF-8 -server -Xms512m -Xmx25g -XX:NewSize=256m
-XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=1g
-XX:+DisableExplicitGC -XX:+CMSClassUnloadingEnabled”
}
},
“json_class”: “Chef::Role”,
“description”: “Role for Java Apps Servers using OpenJDK7”,
“chef_type”: “role”,
“run_list”: [
“recipe[java]”,
“recipe[tomcat]”,
“recipe[tomcat::users]”,
“recipe[simianarmy::app-deploy-edda]”
]
}

I’m using community java and tomcat cookbooks to setup the Web App Server.
https://supermarket.chef.io/cookbooks/java
https://supermarket.chef.io/cookbooks/tomcat

The final recipe merely drops the WAR into the tomcat webs directory to
auto-deploy

Copy EDDA WAR to webapps for autodeployment - Requires that instance

have role with access to bucket
execute “aws s3 cp #{node[‘simianarmy’][‘urls’][‘edda’]}
/var/lib/tomcat7/webapps/” do
action :run
not_if {
File.exist?("/var/lib/tomcat7/webapps/#{server_file(node[‘simianarmy’][‘urls’][‘edda’])}")
}
end


Ted
GPG Key: 0x2B272DFD | E564 BCC1 F601 5D1F 01CD AC10 C37D D2B0 2B27 2DFD