[chef] Re: Re: Re: Re: Re: Re: Re: Deploying .war files?


Chronological Thread 
  • From: Charles Sullivan < >
  • To:
  • Cc:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: Re: Deploying .war files?
  • Date: Tue, 21 Jun 2011 13:16:46 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=iGlzNSw63nvAgYcD0qIcL9Ur0WPbKcqArIN6A2w0EozRYsYZ2C/ZnQrTX2O+l75Vxq j6bmxGyNfx14WDdsDg4gftHTGi886e/VnYP7HHB3QzdN/TdobbkrcAQbk6kRD5Gy+D8U ujRwL+TEcrahYahz+4MJDB6BNc9YHrxOYPQJg=

I've also found that doing multiple deploys via Tomcat API doesn't work well so I'm using a build based approach with all new instances..  to do this I've created a custom Bootstrap template for EC2.  I've added the following which gets slurped up and read in my recipe.  I then pull the appropriate file from S3.  My web layer knows about all of the different builds available and can direct different clients to the correct build for their DB state...

(
cat <<'EOP'
build: <%= ENV['BUILD'] %>
EOP
) > /tmp/build.yml



----  spinner script --- 

#!/bin/bash
echo

if test -z "$1"
then
  echo "No build number passed"
  echo "Usage: "
  echo "sledgehammer_app_prod.sh <build-number>"
else
  echo "Starting Production Server w/ Build #: $1."
  BUILD=$1 knife ec2 server create \
  -I ami-04c9306d \
  -f m1.large \
  -S production \
  -E production \
  -G application_layer,chef_client,production \
  -x ubuntu \
  --template-file ~/chef-repo/templates/sledgehammer_app.erb \
  -i ~/.ssh/production.pem \
  -r recipe[sledgehammer_app],recipe[zabbix::client],recipe[splunk::light_forwarder]
fi




On Tue, Jun 21, 2011 at 1:04 PM, John E. Vincent (lusis) <lusis.org+ "> > wrote:
Specifically on the process management front, we're using jetty. We
tried the hot deploy and it pretty much became unreliable after 5 or
so deploys a day.

We've since moved to using supervisord to manage our jetty processes.
We just do a full restart at deploy time. It's sequentially done in
jenkins right now so we don't lose all of our capacity at once. We
pull the war + appropriate configs from S3.

On Tue, Jun 21, 2011 at 1:57 PM, KC Braunschweig
< "> > wrote:
> A couple other thoughts for you:
>
> - We do this by keeping builds as maven (http://maven.apache.org/)
> artifacts in a nexus repository (http://nexus.sonatype.org/) and
> deploy with a custom artifact deployer cookbook. With nexus you have a
> nice API you can use to determine the right build to deploy and
> compare to what was deployed. Although we haven't released that
> cookbook yet, if you're having issues, I'll prod my teammate that
> wrote it to help you.
>
> - Keep in mind if you end up doing live deployments (i.e. don't
> restart tomcat) you may run into memory issues. I've had problems with
> pretty much every java container trying to do live deploys. Basically
> the JVM leaks memory and eventually you hang the JVM. Since the
> failure happens indeterminately, I decided better to deal with
> restarts and have a repeatable process then to attempt a live deploy
> that may fail randomly, if infrequently. However, I've heard tomcat 7
> tries to work around this issues and maybe its better?
>
> KC
>
> On Tue, Jun 21, 2011 at 4:44 AM, Matthew Drobnak
> < "> > wrote:
>> I appreciate everyone's input so far.
>> Seth, I totally missed the application cookbook. I'll look into that and
>> hopefully can get at least 1 piece running with Chef!
>> I love the premise, but all of the configuration management systems seem to
>> have a bit of a steep climb before it becomes easy and powerful. :)
>> Thanks again.
>> -Matt
>>
>> On Jun 21, 2011, at 12:10 AM, Seth Chisamore wrote:
>>
>> The java_webapp recipe in the application cookbook [0][1] was created to
>> accomplish just this task!
>> The Java Quick Start [1] has a full working example of using this recipe to
>> deploy a Java webapp, including setting up an environment
>> specific context.xml with database connection information.
>> Seth
>> --
>> Opscode, Inc.
>> Seth Chisamore, Senior Technical Evangelist
>> IRC, Skype, Twitter, Github: schisamo
>> [0] http://community.opscode.com/cookbooks/application
>> [1] https://github.com/opscode/cookbooks/blob/master/application/README.md
>> [2] http://help.opscode.com/kb/otherhelp/build-a-java-web-stack
>>
>>
>> On Mon, Jun 20, 2011 at 11:35 PM, Ken Mazaika < "> > wrote:
>>>
>>> could you use something like capistrano for java?
>>>
>>> On Mon, Jun 20, 2011 at 11:32 PM, Edward Sargisson < "> >
>>> wrote:
>>>>
>>>> I need to do the same thing but haven't written it yet. Here's my plan
>>>> - hopefully others can critique.
>>>>
>>>> Firstly, you don't want to stop tomcat. Chef runs every 20 minutes or
>>>> so (or whenever you set it for) so it would stop your server every 20
>>>> minutes. Instead, you should work out if the file on your file server
>>>> has changed and then do the update. In my case, my build artifacts
>>>> have a build id. I plan to store the desired build id in a data bag *.
>>>> The deployed data bag goes into the node data. Then, on the chef run
>>>> it can compare and then run the update if required.
>>>>
>>>> When you do the update you don't need to stop tomcat. Instead you
>>>> download the WAR to a temp directory then go to the webapps dir and
>>>> delete the directory for your webapp as well as the old WAR. Then you
>>>> copy the WAR in. (You can't download directly because then Tomcat
>>>> un-jars it before it's downloaded). Tomcat then un-jars it and starts
>>>> it up for you.
>>>>
>>>> Cheers,
>>>> Edward
>>>>
>>>> * Amusingly, I forgot the name for data bag and my mind came up with
>>>> drop bag. Once a trail runner, always a trail runner... :-)
>>>>
>>>> On Mon, Jun 20, 2011 at 8:25 PM,  < "> > wrote:
>>>> > Hi everyone,
>>>> > I'm fairly new to Chef. I downloaded and deployed the tomcat cookbook
>>>> > to a
>>>> > node, and now I'm trying to add a recipe? or another cookbook, I'm not
>>>> > sure
>>>> > really...to deploy our web app that should run on Tomcat.
>>>> >
>>>> > I basically want the node to stop tomcat, delete everything in the
>>>> > webapps
>>>> > directory, and scp a file to the right spot..then start tomcat.
>>>> >
>>>> > I looked briefly at the deploy resource, but that's from a version
>>>> > control
>>>> > system...we don't keep builds in version control, only the source..the
>>>> > binary
>>>> > builds are on a server, so I don't think that's what I want.
>>>> >
>>>> > If anyone can point me in the right direction to get this going, that
>>>> > would be
>>>> > greatly appreciated.
>>>> >
>>>> > Thanks.
>>>> >
>>>> > -Matt
>>>> >
>>>
>>
>>
>>
>



--
Charles Sullivan
">




Archive powered by MHonArc 2.6.16.

§