You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Crystal Maramba <cm...@acumenllc.com> on 2013/11/21 22:04:55 UTC

How to Deploy an Update to War File

Is there a better way to deploy the  war files?


-          Currently,  I delete  the old war file in the \webapps

-          Copy and paste the new war file in the \webapps directory

-          At times, I have to restart the service because it takes a while to load the new war after it has pasted in directory.

Note:  I added a string in the server.xml file to automatically unpack the war files:
<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

I know we deploy it through the Tomcat Manager by doing the following:


-          Log on to Tomcat Manager

-          Click un-deploy

-          Copy the new war file in the \webapps directory

-          Click redeploy

Is the tomcat manager method the preferred method and are the steps correct?

RE: [OT] How to Deploy an Update to War File

Posted by Crystal Maramba <cm...@acumenllc.com>.

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Thursday, November 21, 2013 5:54 PM
To: Tomcat Users List
Subject: Re: [OT] How to Deploy an Update to War File

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Leo,

On 11/21/13, 6:06 PM, Leo Donahue - OETX wrote:
>> -----Original Message----- From: Daniel Mikusa
>> [mailto:dmikusa@gopivotal.com] Subject: Re: How to Deploy an
>> Update to War File
>> 
>> You can use parallel deployment with WAR files.  Just name the
>> war file "webapps/<context-path>##<version>.war".
>> 
> I need to try this... very cool.

It is. Mark worked a lot of magic into that feature.

Sadly for me, my primary web application is complicated enough and
database changes are big enough that we have to take our applications
completely off-line in order to to upgrades. I can't use
parallel-deployment myself.

I have dreams of zero-downtime upgrades, but managing such things with
a mutating database is a tricky proposition. It's worth the 5-minute
downtime to avoid weeks of planning and testing that two versions of
the same application can run together nicely.

- -chris

Thanks. I knew that already. I just wanted to see the steps that others take. Sometimes after I copy and paste the .war file in the \webapps directory it requires a restart to the tomcat7 service. Not sure why. Is this normal behavior? 

I read the Tomcat website but I was confused with this information in regards to the context:
"In order to configure a Context within Tomcat a Context Descriptor is required. A Context Descriptor is simply an XML file that contains Tomcat related configuration for a Context, e.g naming resources or session manager configuration. In earlier versions of Tomcat the content of a Context Descriptor configuration was often stored within Tomcat's primary configuration file server.xml but this is now discouraged (although it currently still works)."
Source: http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html#Deploying_using_the_Client_Deployer_Package

Currently, I have a context parameter that supposed to auto deploy the war files, see below:
"<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">"

But the information above says it is not recommended. 
-crys

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSjrlCAAoJEBzwKT+lPKRY/BYQALe4/3JTyc7bMk8eUcXlFcEl
va3E3BiQXFIDJzj/jIpHZHFu/Payos7VUx7/oY36MHaOGTKTwzp00FseJVp9LpLB
jD6iYWxAzydCtZb6YhfxUGFjPz1y70AD5trp27iEsvgKvMqk/QH+IeJJiyKmCFaC
HDlkLbxeNHbOvnV0Ahy+7Kdfz5OSnWg2AB7yfWetoNgelb2z00rdX6A5AosNU3BD
Y2zvtkJOxl+/FoNufNVbdU5Elc6Um7g4oGuULe+BakiRm8Reh/t5580nfXF5xWuK
TTLSFuFi9OCNauU/u2IFdU1y8ZyaPxJQbdslDXOYH2GcdeUDHewPqUUuDIWrJxk6
48b94WQjk0TlcVI2jdtst04UckcjHyRoWSmbhLFN/G8UpGiCAnFQp/U4HZ1YFtfv
dN1Q+bPgeUJQ7VtkUCiQR40YlPUYXM1GgIR6WuIt5zMtiLMsW1X9xcRjaBJjFsTQ
AQ00QPAqBdZryDKxOP8pFIXjCb5ha5OnxGPNwIoU8QRAt7C009THCif3n8RrLZix
Knop2V12TAsYHp10XK98o2rMs+Oq+UwjU4fdhJM8RKCy9m55XejixO/LwVp8ZPMK
/yXq0CuxuiT1LOrJ/6kdr0xySskBEOHgXguEtn6ATgBEUzBao2CZMm4Iwqfe+MYS
OVqdD5BQ4KFNYYlGA+mU
=T7Vl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] How to Deploy an Update to War File

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Leo,

On 11/21/13, 6:06 PM, Leo Donahue - OETX wrote:
>> -----Original Message----- From: Daniel Mikusa
>> [mailto:dmikusa@gopivotal.com] Subject: Re: How to Deploy an
>> Update to War File
>> 
>> You can use parallel deployment with WAR files.  Just name the
>> war file "webapps/<context-path>##<version>.war".
>> 
> I need to try this... very cool.

It is. Mark worked a lot of magic into that feature.

Sadly for me, my primary web application is complicated enough and
database changes are big enough that we have to take our applications
completely off-line in order to to upgrades. I can't use
parallel-deployment myself.

I have dreams of zero-downtime upgrades, but managing such things with
a mutating database is a tricky proposition. It's worth the 5-minute
downtime to avoid weeks of planning and testing that two versions of
the same application can run together nicely.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSjrlCAAoJEBzwKT+lPKRY/BYQALe4/3JTyc7bMk8eUcXlFcEl
va3E3BiQXFIDJzj/jIpHZHFu/Payos7VUx7/oY36MHaOGTKTwzp00FseJVp9LpLB
jD6iYWxAzydCtZb6YhfxUGFjPz1y70AD5trp27iEsvgKvMqk/QH+IeJJiyKmCFaC
HDlkLbxeNHbOvnV0Ahy+7Kdfz5OSnWg2AB7yfWetoNgelb2z00rdX6A5AosNU3BD
Y2zvtkJOxl+/FoNufNVbdU5Elc6Um7g4oGuULe+BakiRm8Reh/t5580nfXF5xWuK
TTLSFuFi9OCNauU/u2IFdU1y8ZyaPxJQbdslDXOYH2GcdeUDHewPqUUuDIWrJxk6
48b94WQjk0TlcVI2jdtst04UckcjHyRoWSmbhLFN/G8UpGiCAnFQp/U4HZ1YFtfv
dN1Q+bPgeUJQ7VtkUCiQR40YlPUYXM1GgIR6WuIt5zMtiLMsW1X9xcRjaBJjFsTQ
AQ00QPAqBdZryDKxOP8pFIXjCb5ha5OnxGPNwIoU8QRAt7C009THCif3n8RrLZix
Knop2V12TAsYHp10XK98o2rMs+Oq+UwjU4fdhJM8RKCy9m55XejixO/LwVp8ZPMK
/yXq0CuxuiT1LOrJ/6kdr0xySskBEOHgXguEtn6ATgBEUzBao2CZMm4Iwqfe+MYS
OVqdD5BQ4KFNYYlGA+mU
=T7Vl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to Deploy an Update to War File

Posted by Leo Donahue - OETX <Le...@mail.maricopa.gov>.
>-----Original Message-----
>From: Daniel Mikusa [mailto:dmikusa@gopivotal.com]
>Subject: Re: How to Deploy an Update to War File
>
> You can use parallel deployment with WAR files.  Just name the war file "webapps/<context-path>##<version>.war".
>
I need to try this... very cool.

So when you build a war file with a name foo##001.war, and you want to separate out the log file for this version, you just need to remember to edit the directory in the AccessLog valve to use a different location or change the prefix to include the version number?

I will try this later tonight...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to Deploy an Update to War File

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Nov 21, 2013, at 4:58 PM, Leo Donahue - OETX <Le...@mail.maricopa.gov> wrote:

>> -----Original Message-----
>> From: Daniel Mikusa [mailto:dmikusa@gopivotal.com]
>> Subject: Re: How to Deploy an Update to War File
>> 
>> If you're using Tomcat 7, it's called Parallel Deployment.
>> 
>> Dan
> 
> Can you describe this process a little more?

Here's a very quick explanation.  

1.) When you deploy, format your context name as "<context-path>##<version>".  
2.) Tomcat will deploy your app and parse off the "##<version>".  Giving you multiple versions of the same context path.
3.) When you deploy a new version (new version string > than old version string), Tomcat will send new requests to that application as documented here.

  http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment

4.) After all sessions have been moved to the latest application, if "undeployOldVersions" is true" the older version will be undeployed.

You can probably find more detailed explanations by googling for "tomcat parallel deployment".

> So, in other words, if I want to use parallel deployment, I create context.xml files in conf/Catalina/localhost with distinct names, but use the same value for the path?  

No.  You would just name the file "conf/Catalina/localhost/<context-path>##<version>.xml".

> So this kind of answers my question about why I would want war files located outside of appBase.

Not sure I follow here.  You can use parallel deployment with WAR files.  Just name the war file "webapps/<context-path>##<version>.war".

> Does undeployOldVersions clean up the context.xml files in conf/Catalina/localhost or just the war files?

Sorry, I'm not sure off the top of my head.  Maybe someone else can clarify here or just give it a try and see.

> I hear in the back of my head Chuck saying that we should not use the path element in the Context.  

This does not change the rules on when you can use the path attribute on a Context tag.

Dan

> Was that only for contexts defined in META-INF?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to Deploy an Update to War File

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - OETX [mailto:LeoDonahue@mail.maricopa.gov] 
> Subject: RE: How to Deploy an Update to War File

> In conf/Catalina/localhost  I can have xml files that don't match the names of any 
> web app in the webapps directory, and these xml files are treated as web apps.

Yes, you can do that, but only when the webapp file(s) are located outside of the <Host> appBase.

> I read it as xml files in conf/Catalina/localhost and not the context path of 
> webapp1 in my webapps directory, because I don't specify the path param in my 
> context.xml in /META-INF

Remember that the path of a webapp is normally derived from the name of the webapp file/directory under appBase, or from the name of the .xml file under conf/Catalina/[host].  The only time a path attribute is meaningful is when there's a <Context> element in server.xml (a capability that has likely outlived its usefulness).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to Deploy an Update to War File

Posted by Leo Donahue - OETX <Le...@mail.maricopa.gov>.
>-----Original Message-----
>From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>Subject: RE: How to Deploy an Update to War File
>
>http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment
>
>> So, in other words, if I want to use parallel deployment, I create context.xml files in conf/Catalina/localhost with distinct names, but use the same value for the path?
>
>No - read the doc.
>
> - Chuck

Sorry, I'm still getting context elements and context.xml files confused with web app "contexts" when I read the docs.

In conf/Catalina/localhost  I can have xml files that don't match the names of any web app in the webapps directory, and these xml files are treated as web apps.

So when I read:

"You may define as many Context elements as you wish. Each such Context MUST have a unique context name within a virtual host. The context path does not need to be unique (see parallel deployment below)"

I read it as xml files in conf/Catalina/localhost and not the context path of webapp1 in my webapps directory, because I don't specify the path param in my context.xml in /META-INF

It's one of those words with many meanings and deriving the context of the use of the word context from the docs gets confusing.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to Deploy an Update to War File

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leo Donahue - OETX [mailto:LeoDonahue@mail.maricopa.gov] 
> Subject: RE: How to Deploy an Update to War File

> Can you describe this process a little more?

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment

> So, in other words, if I want to use parallel deployment, I create context.xml 
> files in conf/Catalina/localhost with distinct names, but use the same value 
> for the path?

No - read the doc.
 
> I hear in the back of my head Chuck saying that we should not use the path 
> element in the Context.

You've got that right.  The path attribute is usable _only_ when the <Context> element is in server.xml, where it shouldn't be.  In all other cases, the path attribute is at best ignored, at worst causes multiple deployments.

 - Chuck 


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to Deploy an Update to War File

Posted by Leo Donahue - OETX <Le...@mail.maricopa.gov>.
>-----Original Message-----
>From: Daniel Mikusa [mailto:dmikusa@gopivotal.com]
>Subject: Re: How to Deploy an Update to War File
>
>If you're using Tomcat 7, it's called Parallel Deployment.
>
>Dan

Can you describe this process a little more?

So, in other words, if I want to use parallel deployment, I create context.xml files in conf/Catalina/localhost with distinct names, but use the same value for the path?  So this kind of answers my question about why I would want war files located outside of appBase.

Does undeployOldVersions clean up the context.xml files in conf/Catalina/localhost or just the war files?

I hear in the back of my head Chuck saying that we should not use the path element in the Context.  Was that only for contexts defined in META-INF?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to Deploy an Update to War File

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On Nov 21, 2013, at 4:04 PM, Crystal Maramba <cm...@acumenllc.com> wrote:

> Is there a better way to deploy the  war files?

If you're using Tomcat 7, it's called Parallel Deployment.

  http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment
  http://www.tomcatexpert.com/blog/2011/05/31/parallel-deployment-tomcat-7

Dan

> 
> 
> -          Currently,  I delete  the old war file in the \webapps
> 
> -          Copy and paste the new war file in the \webapps directory
> 
> -          At times, I have to restart the service because it takes a while to load the new war after it has pasted in directory.
> 
> Note:  I added a string in the server.xml file to automatically unpack the war files:
> <Host name="localhost"  appBase="webapps"
>            unpackWARs="true" autoDeploy="true">
> 
> I know we deploy it through the Tomcat Manager by doing the following:
> 
> 
> -          Log on to Tomcat Manager
> 
> -          Click un-deploy
> 
> -          Copy the new war file in the \webapps directory
> 
> -          Click redeploy
> 
> Is the tomcat manager method the preferred method and are the steps correct?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to Deploy an Update to War File

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Crystal,

On 11/21/13, 6:04 PM, Crystal Maramba wrote:
> Can someone provide me the steps on how to manually re-deploy an 
> updated war file

You can simply copy the new WAR over the old WAR. If you delete the
WAR file, you may trigger an un-deployment followed by a deployment.
That may have unintended consequences, such as deleting a custom
deployment descriptor in CATALINA_BASE/conf/[engine]/[host]/[app].xml
or temporarily serving (likely error) documents from the ROOT context.

> and how to re-deploy it using tomcat manager? Sorry. I just want to
> make sure these steps are correct for documentation purposes.

Read the documentation for the Manager webapp. It's all there.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSjrndAAoJEBzwKT+lPKRYgx0QAI24w/lNGiF0yXb4UEDcVOM8
TufckaQGW77hKOP4aefrpqsmdKYt8YLZ9fHXyMy08DBJMKgfbCOleqKuPFVuf/xs
B9mHOUWGJn2wgpra74x9eH2iVvRCnuqaF0Xpkbgp8DcG5P9HnvAtbw1sOIB+tY7T
z689OyR2wXF1IxNY58GmCpRSwnYMXNjSndMk9Jt8o+eeGht8oa5DD4shnmPRFY7K
VsjMmvVmGCYBF4EasSoT3t3IQBDFHThCcAgQr0y9tlYnNF3vzy+tDgzyncjZGdOU
XiCNGcmjwucAbcL4a9+lpyP3KYwk7hvpTdLFLFT0mxGdhTdm8FgKlOpdRkB4yBUU
vJP9BuMbMHKeMBdmPZAhBnRXMgNYuHUI4oSqp6tVjLQAPIDqFlnIPUCeJXdT8sUK
lhHYTGD4cu6CACWcylKP4JU/L4/r0TgIB3QGGVbqLQxD30PWXXwFLAFIXe95LGbG
eIn+hVPgWc+nYYrFGfXS2LU/hY42L3Q98i4o4eOupWBTBesoCabe48zXonN5mrrY
qN4LZWQl32K29i/jRG6gPpLTrlTNOkhb292i/uQuG08+24Pe9IoF9+aOGf+tzTdt
n51xuVUArHVYoGKLxRjCsOQwuHt/kQ1y1p9rz8p3O+W7lTE5vJh45ImqGEQXP9bJ
IPp/ct+X4b8GVREdk8lS
=qZ7V
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to Deploy an Update to War File

Posted by Crystal Maramba <cm...@acumenllc.com>.

-----Original Message-----
From: Crystal Maramba [mailto:cmaramba@acumenllc.com] 
Sent: Thursday, November 21, 2013 1:05 PM
To: Tomcat Users List
Subject: How to Deploy an Update to War File

Is there a better way to deploy the  war files?


-          Currently,  I delete  the old war file in the \webapps

-          Copy and paste the new war file in the \webapps directory

-          At times, I have to restart the service because it takes a while to load the new war after it has pasted in directory.

Note:  I added a string in the server.xml file to automatically unpack the war files:
<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

I know we deploy it through the Tomcat Manager by doing the following:


-          Log on to Tomcat Manager

-          Click un-deploy

-          Copy the new war file in the \webapps directory

-          Click redeploy

Is the tomcat manager method the preferred method and are the steps correct?

Can someone provide me the steps on how to manually re-deploy an updated war file and how to re-deploy it using tomcat manager? Sorry. I just want to make sure these steps are correct for documentation purposes. 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org