You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rainer Frey <ra...@inxmail.de> on 2010/08/30 12:55:19 UTC

Best practice to upgrade .war files

Hi,

what is the best practice to replace a webapp with a newer version in 
production?

I'm using Tomcat 6.0.29, with unpackWARs="true" autoDeploy="false". All 
Webapps reside in appBase, some have a machine-specific context descriptor, 
that I manually copy to conf/Catalina/localhost.

I use the Tomcat Manager (via HTML-Interface) to deploy applications. What is 
the recommended way to upgrade a webapp to a newer version (same war name, 
same desired context path)?

The HTML manager has no "redeploy" option. "deploy" is not possible as the 
context already exists. I tried to put the new war file into appBase, and use 
reload, but that won't update the expanded directory to the new war file.

What I did is:
 * undeploy
 * copy new war file
 * deploy

This is cumbersome as I have to switch forth and back between manager and file 
operations.

Is there a better way?

Thanks
Rainer

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


Re: Best practice to upgrade (redeploy) .war files

Posted by Ognjen Blagojevic <og...@gmail.com>.
Hi,

I just use Tomcat Manager webapp: undeploy and deploy without restarting 
Tomcat. It brings no downtime to other webapps/hosts on the same Tomcat, 
and downtime of the webapp itself is few seconds per deploy.

This is acceptable for me, since the server load is really low.

If a webapp cleans up after itself, it will cause no problems on 
performance.

Regards,
Ognjen


On 3.9.2010 8:53, Rainer Frey wrote:
> On Monday 30 August 2010 12:55:19 Rainer Frey wrote:
>> Hi,
>
> It's not normally my style, but is there really no feedback on this topic?
> Does anyone use explicit hot deployment with Tomcat Manager in production? How
> do you actually upgrade deployed applications?
>
> And if you use cold deployment only, how do you avoid downtime for other apps?
> Do you really use one Tomcat  instance per app?
>
> I'd really like to hear some input / experiences about production use with
> several applications with independent release/deploy cycles.
>
> Thanks again
> Rainer
>
>> what is the best practice to replace a webapp with a newer version in
>> production?
>>
>> I'm using Tomcat 6.0.29, with unpackWARs="true" autoDeploy="false". All
>> Webapps reside in appBase, some have a machine-specific context descriptor,
>> that I manually copy to conf/Catalina/localhost.
>>
>> I use the Tomcat Manager (via HTML-Interface) to deploy applications. What
>> is the recommended way to upgrade a webapp to a newer version (same war
>> name, same desired context path)?
>>
>> The HTML manager has no "redeploy" option. "deploy" is not possible as the
>> context already exists. I tried to put the new war file into appBase, and
>> use reload, but that won't update the expanded directory to the new war
>> file.
>>
>> What I did is:
>>   * undeploy
>>   * copy new war file
>>   * deploy
>>
>> This is cumbersome as I have to switch forth and back between manager and
>> file operations.
>>
>> Is there a better way?
>>
>> Thanks
>> Rainer
>
> ---------------------------------------------------------------------
> 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: Best practice to upgrade (redeploy) .war files

Posted by Ruslan Gainutdinov <ru...@gmail.com>.
You can create ant task to handle this.
We do it this way.

1. We have cluster on apache2.2 using mod_jk
2. All sessions are sticky but nofailover=off means can migrate to
another server
3. Via jkmanager I disable (activation stopped) 2 out of 3 cluster nodes.
4. Wait for any AJP/HTTP thread activity to finish on this nodes
5. Every cluster node have separate webapps folder, e.g. webapps.NODE1
6. Copy war into webapps.NODE1, webapps.NODE2 folders
7. Wait for NODE1 and NODE2 to redeploy app and sessions synchronized.
8. Change activation for NODE1, NODE2 to online, NODE3 to stopped
9. Same as 4. for NODE3
10. Same as 6. for NODE3
11. Same as 7. for NODE3
12. Change activation for NODE3 to online

Looks complicated but actually it is 5 minutes per one apache.
Doing manually, haven`t found time to script it.
For jkmanager scripting - you can use connectors ant task
For 4. you can use jmx as suggested in older article

This way you do seamless migration. But your sessions must be thin
and not contain complex objects (no cache, no connections to db, etc).
Or you must be prepared to recreate them on next request.

p.s. Don`t use FarmWarDeployer - it is not reliable. Can`t handle
offline nodes when they become online,
and gets confused when war to deploy already in the temp folder.

With kindest personal regards,
Ruslan Gainutdinov
<ru...@gmail.com>



On Fri, Sep 3, 2010 at 12:20 PM, Domenico Briganti <do...@gmail.com> wrote:
> Il giorno ven, 03/09/2010 alle 08.53 +0200, Rainer Frey ha scritto:
>> How
>> do you actually upgrade deployed applications?
>
> There is a recent thread on this topic, see
> http://old.nabble.com/Best-practices-for-deployment-on-cluster-environment-td29532493.html
>
> If you need service continuity, you have to use at least 2 Tomcat
> instances
>
> Regards,
> Domenico
>
>
> ---------------------------------------------------------------------
> 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: Best practice to upgrade (redeploy) .war files

Posted by Domenico Briganti <do...@gmail.com>.
Il giorno ven, 03/09/2010 alle 08.53 +0200, Rainer Frey ha scritto:
> How 
> do you actually upgrade deployed applications? 

There is a recent thread on this topic, see
http://old.nabble.com/Best-practices-for-deployment-on-cluster-environment-td29532493.html

If you need service continuity, you have to use at least 2 Tomcat
instances

Regards, 
Domenico


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


[OT] Re: Best practice to upgrade (redeploy) .war files

Posted by Pid <pi...@pidster.com>.
On 09/09/2010 07:10, Rainer Frey wrote:
> On Wednesday 08 September 2010 22:49:20 Christopher Schultz wrote:
>> Rainer,
>>
>> On 9/3/2010 2:53 AM, Rainer Frey wrote:
>>> And if you use cold deployment only, how do you avoid downtime for other
>>> apps? Do you really use one Tomcat  instance per app?
>>
>> I use one Tomcat instance per webapp, and I use cold deployment only.
> 
> I think this is the best way if you have the resources. But I need to host a 
> growing number of rather small, new webapps, and have only one server ATM. 
> Getting the memory config right that it is enough heap even in unexpected 
> activity bursts, and still be able to run the required number of apps within 
> the available RAM seems tricky.

The memory overhead of actually running Tomcat itself is quite small.
If your small, individual apps have different heap usage profiles, then
separate Tomcat (and therefore JVMs) is in fact the way to go.

Then you can tune the settings for each app, accordingly.


p

>>> I'd really like to hear some input / experiences about production use
>>> with several applications with independent release/deploy cycles.
>>
>> I haven't done it, but Tomcat should be able to do hot re-deployment by
>> simply copying the new WAR file over the old one. Is that not an option
>> for you?
> 
> No, a simple copy triggers no redeployment, as I use autoDeploy="false". I 
> want to trigger the redeployment with the tomcat manager.
> As I stated in the first mail, that works, but is quite cumbersome:
> 
> 1. undeploy current webapp with manager. This deletes war file, expanded 
> directory, and conf/<Engine>/<Host>/app.xml
> 2. copy war file and (if needed) app.xml of new version to conf and appBase 
> directory
> 3. deploy with manager, by specifying .war or .xml and the context path (that 
> was already known to tomcat)
> 
> What I was looking for is:
> 1. copy new .war and .xml
> 2. tell tomcat (manager) to update (redeploy) the already known application 
> context with the new files (where redeploy includes updating/replacing the 
> expanded directory) 
> 
> 
>> -chris
> 
> Rainer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


Re: Best practice to upgrade (redeploy) .war files

Posted by Rainer Frey <ra...@inxmail.de>.
On Wednesday 08 September 2010 22:49:20 Christopher Schultz wrote:
> Rainer,
> 
> On 9/3/2010 2:53 AM, Rainer Frey wrote:
> > And if you use cold deployment only, how do you avoid downtime for other
> > apps? Do you really use one Tomcat  instance per app?
> 
> I use one Tomcat instance per webapp, and I use cold deployment only.

I think this is the best way if you have the resources. But I need to host a 
growing number of rather small, new webapps, and have only one server ATM. 
Getting the memory config right that it is enough heap even in unexpected 
activity bursts, and still be able to run the required number of apps within 
the available RAM seems tricky.
 
> > I'd really like to hear some input / experiences about production use
> > with several applications with independent release/deploy cycles.
> 
> I haven't done it, but Tomcat should be able to do hot re-deployment by
> simply copying the new WAR file over the old one. Is that not an option
> for you?

No, a simple copy triggers no redeployment, as I use autoDeploy="false". I 
want to trigger the redeployment with the tomcat manager.
As I stated in the first mail, that works, but is quite cumbersome:

1. undeploy current webapp with manager. This deletes war file, expanded 
directory, and conf/<Engine>/<Host>/app.xml
2. copy war file and (if needed) app.xml of new version to conf and appBase 
directory
3. deploy with manager, by specifying .war or .xml and the context path (that 
was already known to tomcat)

What I was looking for is:
1. copy new .war and .xml
2. tell tomcat (manager) to update (redeploy) the already known application 
context with the new files (where redeploy includes updating/replacing the 
expanded directory) 


> -chris

Rainer

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


Re: Best practice to upgrade (redeploy) .war files

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

Rainer,

On 9/3/2010 2:53 AM, Rainer Frey wrote:
> And if you use cold deployment only, how do you avoid downtime for other apps? 
> Do you really use one Tomcat  instance per app?

I use one Tomcat instance per webapp, and I use cold deployment only.

> I'd really like to hear some input / experiences about production use with 
> several applications with independent release/deploy cycles.

I haven't done it, but Tomcat should be able to do hot re-deployment by
simply copying the new WAR file over the old one. Is that not an option
for you?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyH9tAACgkQ9CaO5/Lv0PAGZACZAYxnXtSSmMZnrevu0yoBcb6f
268AoJngGzj8GqX3iHPD1vzawYVc1L+/
=1wq9
-----END PGP SIGNATURE-----

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


Re: Best practice to upgrade (redeploy) .war files

Posted by Rainer Frey <ra...@inxmail.de>.
On Monday 30 August 2010 12:55:19 Rainer Frey wrote:
> Hi,

It's not normally my style, but is there really no feedback on this topic?
Does anyone use explicit hot deployment with Tomcat Manager in production? How 
do you actually upgrade deployed applications? 
 
And if you use cold deployment only, how do you avoid downtime for other apps? 
Do you really use one Tomcat  instance per app?

I'd really like to hear some input / experiences about production use with 
several applications with independent release/deploy cycles.

Thanks again
Rainer

> what is the best practice to replace a webapp with a newer version in
> production?
> 
> I'm using Tomcat 6.0.29, with unpackWARs="true" autoDeploy="false". All
> Webapps reside in appBase, some have a machine-specific context descriptor,
> that I manually copy to conf/Catalina/localhost.
> 
> I use the Tomcat Manager (via HTML-Interface) to deploy applications. What
> is the recommended way to upgrade a webapp to a newer version (same war
> name, same desired context path)?
> 
> The HTML manager has no "redeploy" option. "deploy" is not possible as the
> context already exists. I tried to put the new war file into appBase, and
> use reload, but that won't update the expanded directory to the new war
> file.
> 
> What I did is:
>  * undeploy
>  * copy new war file
>  * deploy
> 
> This is cumbersome as I have to switch forth and back between manager and
> file operations.
> 
> Is there a better way?
> 
> Thanks
> Rainer

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


Re: Best practice to upgrade .war files

Posted by Rainer Frey <ra...@inxmail.de>.
On Monday 30 August 2010 13:13:03 Ozgur Ozdemircili wrote:
> On Mon, Aug 30, 2010 at 12:55 PM, Rainer Frey <ra...@inxmail.de>wrote:
> > Hi,
> > 
> > what is the best practice to replace a webapp with a newer version in
> > production?
> > 
> > I'm using Tomcat 6.0.29, with unpackWARs="true" autoDeploy="false". All
> > Webapps reside in appBase, some have a machine-specific context
> > descriptor, that I manually copy to conf/Catalina/localhost.
> > 
> > I use the Tomcat Manager (via HTML-Interface) to deploy applications.
> > What is
> > the recommended way to upgrade a webapp to a newer version (same war
> > name, same desired context path)?
> > 
> > The HTML manager has no "redeploy" option. "deploy" is not possible as
> > the context already exists. I tried to put the new war file into
> > appBase, and use
> > reload, but that won't update the expanded directory to the new war file.
> > 
> > What I did is:
> >  * undeploy
> >  * copy new war file
> >  * deploy
> > 
> > This is cumbersome as I have to switch forth and back between manager and
> > file
> > operations.
> > 
> > Is there a better way?

> After trying all sorts of deploy types I have found the best, simplest and
> pain-free deploy in :
> 
> - Stop tomcat

I refine myself: what is best practice to *hot* deploy upgraded war file? I 
don't want to influence other webapps.

Rainer

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


Re: Best practice to upgrade .war files

Posted by Ozgur Ozdemircili <oz...@gmail.com>.
Hi,

After trying all sorts of deploy types I have found the best, simplest and
pain-free deploy in :

- Stop tomcat
- Go to webapps folder
- Remove the webapplication folder and the .war file
- Copy the new war file
- Start tomcat.


In order to have a backup copy I also leave a .war file of the previous
deploy as appname.war.anc (anchestor)

Hope it helps you.


Özgür Özdemircili
http://www.acikkod.org
Code so clean you could eat off it


On Mon, Aug 30, 2010 at 12:55 PM, Rainer Frey <ra...@inxmail.de>wrote:

> Hi,
>
> what is the best practice to replace a webapp with a newer version in
> production?
>
> I'm using Tomcat 6.0.29, with unpackWARs="true" autoDeploy="false". All
> Webapps reside in appBase, some have a machine-specific context descriptor,
> that I manually copy to conf/Catalina/localhost.
>
> I use the Tomcat Manager (via HTML-Interface) to deploy applications. What
> is
> the recommended way to upgrade a webapp to a newer version (same war name,
> same desired context path)?
>
> The HTML manager has no "redeploy" option. "deploy" is not possible as the
> context already exists. I tried to put the new war file into appBase, and
> use
> reload, but that won't update the expanded directory to the new war file.
>
> What I did is:
>  * undeploy
>  * copy new war file
>  * deploy
>
> This is cumbersome as I have to switch forth and back between manager and
> file
> operations.
>
> Is there a better way?
>
> Thanks
> Rainer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>