You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Rosenberg <jr...@tabbysplace.org> on 2011/08/10 18:37:30 UTC

Parallel Deployment: Get Context Version #

I'm using Tomcat 7+.  How can I get the context version #?  I.e., if app Is
being run as  app##124, I want 124.

--
JR

Re: Parallel Deployment: Get Context Version #

Posted by Jonathan Rosenberg <jr...@tabbysplace.org>.
I suspect I can do it like this:

"If session information is present in the request, check the session
manager of each version for a matching session and if one is found,
use that version."

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/


On Wed, Aug 10, 2011 at 2:55 PM, Jonathan Rosenberg <jr...@tabbysplace.org> wrote:
> Quick answer: I want to have my Grails app determine at runtime which
> version it was deployed as (bad English, I know).
>
> Longer answer:
>
> I want to use parallel deployment as an easy way to allow existing
> sessions to continue while redirecting new sessions to a "down for
> temp maintenance page."
>
> My thought was to
>
> 1) Have app check context version before each controller action.  If
> version is '~~~' (late in sorting order), redirect user to maintenance
> page.
>
> 2) Deploy app with version '~~~'.  Normal condition, app is stopped.
>
> Now all I have to do is start this context whenever I want to
> accomplish temp outage.
>
> QED
>
> --
> Jonathan Rosenberg
> Founder & Executive Director
> Tabby's Place, a Cat Sanctuary
> http://www.tabbysplace.org/
>
>
> On Wed, Aug 10, 2011 at 2:48 PM, Mark Thomas <ma...@apache.org> wrote:
>> On 10/08/2011 19:41, Jonathan Rosenberg wrote:
>>> Looking at some of my session ids & doing some searching online did
>>> not turn up any useful info on format of session id (& where context
>>> version is).
>>>
>>> Can you point me at something?
>>
>> Sorry, my bad - that was an earlier version of the code that did that.
>>
>> Let me ask a different question, what problem are you trying to solve?
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> 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: Parallel Deployment: Get Context Version #

Posted by Pid <pi...@pidster.com>.
On 11/08/2011 02:55, Jonathan Rosenberg wrote:
> Two benefits:
> 
> 1) Allows incompatible upgrades.
> 2) Allos existing sessions to complete.

Parallel deployment does allow existing sessions to complete.
Only new sessions are directed to the newest application.

Are you seeing different behaviour?


p

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


Re: Parallel Deployment: Get Context Version #

Posted by Jonathan Rosenberg <jr...@tabbysplace.org>.
> We use apache http in-front of tomcat. This allows us to do exactly this. We
> route calls from apache through to tomcat normally using mod_jk, and then
> when we want to perform an upgrade, we update apache config, graceful
> restart of apache, and apache routes all traffic to holding page. This won't
> give you the ability to leave existing sessions running until completion.

I also have Apache httpd in front, but I don't want to kill sessions,
as this is an ecommerce app.

> I think what pid was suggesting was that you have you app deployed as
> app##01.war. Then when it becomes upgrade time, create a second war file
> with only a holding page in it, and deploy this as app##02.war. Old session
> will continue until they die, and all new sessions will be directed the 02
> context. If this just sends to holding page, then you are done. When you are
> ready, then roll out the proper app as app##03.war.

Understood.

> Personally I don't see what benefit this gives you. Does the upgrade perform
> some kind of not backward compatible db change, surely you can just run app
> v01 and app v02 side by side? What benefit does the holding page give you?

Two benefits:

1) Allows incompatible upgrades.
2) Allos existing sessions to complete.

> Chris

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/

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


Re: Parallel Deployment: Get Context Version #

Posted by chris derham <ch...@derham.me.uk>.
>>> I want to use parallel deployment as an easy way to allow existing

> >>> sessions to continue while redirecting new sessions to a "down for
> >>> temp maintenance page."
>

We use apache http in-front of tomcat. This allows us to do exactly this. We
route calls from apache through to tomcat normally using mod_jk, and then
when we want to perform an upgrade, we update apache config, graceful
restart of apache, and apache routes all traffic to holding page. This won't
give you the ability to leave existing sessions running until completion.

I think what pid was suggesting was that you have you app deployed as
app##01.war. Then when it becomes upgrade time, create a second war file
with only a holding page in it, and deploy this as app##02.war. Old session
will continue until they die, and all new sessions will be directed the 02
context. If this just sends to holding page, then you are done. When you are
ready, then roll out the proper app as app##03.war.

Personally I don't see what benefit this gives you. Does the upgrade perform
some kind of not backward compatible db change, surely you can just run app
v01 and app v02 side by side? What benefit does the holding page give you?

Chris

Re: Parallel Deployment: Get Context Version #

Posted by Pid <pi...@pidster.com>.
On 10/08/2011 21:15, Jonathan Rosenberg wrote:
>>> I want to use parallel deployment as an easy way to allow existing
>>> sessions to continue while redirecting new sessions to a "down for
>>> temp maintenance page."
> 
>> Why not just upload a new .war (with the newest version) which only
>> displays that page?
> 
> I could do that.  But if I can use the same code, I can add other
> actions later & still maintain a single code base.  Only 1 app to
> maintain this way.
> 
>>> 1) Have app check context version before each controller action.  If
>>> version is '~~~' (late in sorting order), redirect user to maintenance
>>> page.
> 
>> The app will only see it's own version, how can it compare its own
>> version to other versions of the app?
>>
> 
> Huh?  App only needs to see its own version.

Sorry, I thought you were sorting version numbers?


p

> --
> Jonathan Rosenberg
> Founder & Executive Director
> Tabby's Place, a Cat Sanctuary
> http://www.tabbysplace.org/
> 
> 
> On Wed, Aug 10, 2011 at 4:00 PM, Pid <pi...@pidster.com> wrote:
>> On 10/08/2011 19:55, Jonathan Rosenberg wrote:
>>> Quick answer: I want to have my Grails app determine at runtime which
>>> version it was deployed as (bad English, I know).
>>>
>>> Longer answer:
>>>
>>> I want to use parallel deployment as an easy way to allow existing
>>> sessions to continue while redirecting new sessions to a "down for
>>> temp maintenance page."
>>
>> Why not just upload a new .war (with the newest version) which only
>> displays that page?
>>
>>
>>> My thought was to
>>>
>>> 1) Have app check context version before each controller action.  If
>>> version is '~~~' (late in sorting order), redirect user to maintenance
>>> page.
>>
>> The app will only see it's own version, how can it compare its own
>> version to other versions of the app?
>>
>>
>>> 2) Deploy app with version '~~~'.  Normal condition, app is stopped.
>>>
>>> Now all I have to do is start this context whenever I want to
>>> accomplish temp outage.
>>>
>>> QED
>>
>> See my first above.
>>
>>
>> p
>>
>>
>>> --
>>> Jonathan Rosenberg
>>> Founder & Executive Director
>>> Tabby's Place, a Cat Sanctuary
>>> http://www.tabbysplace.org/
>>>
>>>
>>> On Wed, Aug 10, 2011 at 2:48 PM, Mark Thomas <ma...@apache.org> wrote:
>>>> On 10/08/2011 19:41, Jonathan Rosenberg wrote:
>>>>> Looking at some of my session ids & doing some searching online did
>>>>> not turn up any useful info on format of session id (& where context
>>>>> version is).
>>>>>
>>>>> Can you point me at something?
>>>>
>>>> Sorry, my bad - that was an earlier version of the code that did that.
>>>>
>>>> Let me ask a different question, what problem are you trying to solve?
>>>>
>>>> Mark
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 


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


Re: Parallel Deployment: Get Context Version #

Posted by Jonathan Rosenberg <jr...@tabbysplace.org>.
>> I want to use parallel deployment as an easy way to allow existing
>> sessions to continue while redirecting new sessions to a "down for
>> temp maintenance page."

> Why not just upload a new .war (with the newest version) which only
> displays that page?

I could do that.  But if I can use the same code, I can add other
actions later & still maintain a single code base.  Only 1 app to
maintain this way.

>> 1) Have app check context version before each controller action.  If
>> version is '~~~' (late in sorting order), redirect user to maintenance
>> page.

> The app will only see it's own version, how can it compare its own
> version to other versions of the app?
>

Huh?  App only needs to see its own version.

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/


On Wed, Aug 10, 2011 at 4:00 PM, Pid <pi...@pidster.com> wrote:
> On 10/08/2011 19:55, Jonathan Rosenberg wrote:
>> Quick answer: I want to have my Grails app determine at runtime which
>> version it was deployed as (bad English, I know).
>>
>> Longer answer:
>>
>> I want to use parallel deployment as an easy way to allow existing
>> sessions to continue while redirecting new sessions to a "down for
>> temp maintenance page."
>
> Why not just upload a new .war (with the newest version) which only
> displays that page?
>
>
>> My thought was to
>>
>> 1) Have app check context version before each controller action.  If
>> version is '~~~' (late in sorting order), redirect user to maintenance
>> page.
>
> The app will only see it's own version, how can it compare its own
> version to other versions of the app?
>
>
>> 2) Deploy app with version '~~~'.  Normal condition, app is stopped.
>>
>> Now all I have to do is start this context whenever I want to
>> accomplish temp outage.
>>
>> QED
>
> See my first above.
>
>
> p
>
>
>> --
>> Jonathan Rosenberg
>> Founder & Executive Director
>> Tabby's Place, a Cat Sanctuary
>> http://www.tabbysplace.org/
>>
>>
>> On Wed, Aug 10, 2011 at 2:48 PM, Mark Thomas <ma...@apache.org> wrote:
>>> On 10/08/2011 19:41, Jonathan Rosenberg wrote:
>>>> Looking at some of my session ids & doing some searching online did
>>>> not turn up any useful info on format of session id (& where context
>>>> version is).
>>>>
>>>> Can you point me at something?
>>>
>>> Sorry, my bad - that was an earlier version of the code that did that.
>>>
>>> Let me ask a different question, what problem are you trying to solve?
>>>
>>> Mark
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: Parallel Deployment: Get Context Version #

Posted by Pid <pi...@pidster.com>.
On 10/08/2011 19:55, Jonathan Rosenberg wrote:
> Quick answer: I want to have my Grails app determine at runtime which
> version it was deployed as (bad English, I know).
> 
> Longer answer:
> 
> I want to use parallel deployment as an easy way to allow existing
> sessions to continue while redirecting new sessions to a "down for
> temp maintenance page."

Why not just upload a new .war (with the newest version) which only
displays that page?


> My thought was to
> 
> 1) Have app check context version before each controller action.  If
> version is '~~~' (late in sorting order), redirect user to maintenance
> page.

The app will only see it's own version, how can it compare its own
version to other versions of the app?


> 2) Deploy app with version '~~~'.  Normal condition, app is stopped.
> 
> Now all I have to do is start this context whenever I want to
> accomplish temp outage.
> 
> QED

See my first above.


p


> --
> Jonathan Rosenberg
> Founder & Executive Director
> Tabby's Place, a Cat Sanctuary
> http://www.tabbysplace.org/
> 
> 
> On Wed, Aug 10, 2011 at 2:48 PM, Mark Thomas <ma...@apache.org> wrote:
>> On 10/08/2011 19:41, Jonathan Rosenberg wrote:
>>> Looking at some of my session ids & doing some searching online did
>>> not turn up any useful info on format of session id (& where context
>>> version is).
>>>
>>> Can you point me at something?
>>
>> Sorry, my bad - that was an earlier version of the code that did that.
>>
>> Let me ask a different question, what problem are you trying to solve?
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> 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
> 


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


Re: Parallel Deployment: Get Context Version #

Posted by Jonathan Rosenberg <jr...@tabbysplace.org>.
Quick answer: I want to have my Grails app determine at runtime which
version it was deployed as (bad English, I know).

Longer answer:

I want to use parallel deployment as an easy way to allow existing
sessions to continue while redirecting new sessions to a "down for
temp maintenance page."

My thought was to

1) Have app check context version before each controller action.  If
version is '~~~' (late in sorting order), redirect user to maintenance
page.

2) Deploy app with version '~~~'.  Normal condition, app is stopped.

Now all I have to do is start this context whenever I want to
accomplish temp outage.

QED

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/


On Wed, Aug 10, 2011 at 2:48 PM, Mark Thomas <ma...@apache.org> wrote:
> On 10/08/2011 19:41, Jonathan Rosenberg wrote:
>> Looking at some of my session ids & doing some searching online did
>> not turn up any useful info on format of session id (& where context
>> version is).
>>
>> Can you point me at something?
>
> Sorry, my bad - that was an earlier version of the code that did that.
>
> Let me ask a different question, what problem are you trying to solve?
>
> Mark
>
> ---------------------------------------------------------------------
> 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: Parallel Deployment: Get Context Version #

Posted by Mark Thomas <ma...@apache.org>.
On 10/08/2011 19:41, Jonathan Rosenberg wrote:
> Looking at some of my session ids & doing some searching online did
> not turn up any useful info on format of session id (& where context
> version is).
> 
> Can you point me at something?

Sorry, my bad - that was an earlier version of the code that did that.

Let me ask a different question, what problem are you trying to solve?

Mark

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


Re: Parallel Deployment: Get Context Version #

Posted by Jonathan Rosenberg <jr...@tabbysplace.org>.
Looking at some of my session ids & doing some searching online did
not turn up any useful info on format of session id (& where context
version is).

Can you point me at something?

--
Jonathan Rosenberg
Founder & Executive Director
Tabby's Place, a Cat Sanctuary
http://www.tabbysplace.org/


On Wed, Aug 10, 2011 at 12:52 PM, Mark Thomas <ma...@apache.org> wrote:
> On 10/08/2011 17:37, Jonathan Rosenberg wrote:
>> I'm using Tomcat 7+.  How can I get the context version #?  I.e., if app Is
>> being run as  app##124, I want 124.
>
> The simplest way will be to parse the session ID.
>
> Mark
>
> ---------------------------------------------------------------------
> 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: Parallel Deployment: Get Context Version #

Posted by Mark Thomas <ma...@apache.org>.
On 10/08/2011 17:37, Jonathan Rosenberg wrote:
> I'm using Tomcat 7+.  How can I get the context version #?  I.e., if app Is
> being run as  app##124, I want 124.

The simplest way will be to parse the session ID.

Mark

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