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
> On Sun, May 17, 2015 at 11:16 PM, Vikas Roonwal < "> > 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
Archive powered by MHonArc 2.6.16.