Re: Zero downtime deployments

2015-12-08 Thread Kevin Hale Boyes
On 4 December 2015 at 11:19, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Kevin,
>
> On 12/3/15 2:21 PM, Kevin Hale Boyes wrote:
> > Thanks for this link to the presentation.
> > How do you all deal with some of the other dependencies that the web
> > application has?
> >
> > For example, if v2 of my application needs new database columns or
> worse, a
> > change to an existing column how can I have v1 and v2 running at the same
> > time?  We use Oracle as our database though the problem exists for many
> > database servers.
>
> That's not a deployment problem. That's a design problem.
>
> In short, you need to make sure that your web application is both
> forward-compatible and backward-compatible at the same time.
>
> That's rubbish, or course. Here's a more concrete suggestion, and it
> requires a LOT of work, but it's worth it.
>
> First of all, you can't think of a release as a single event any more.
> Instead, there are 4 events.
>


We already do this sort of development when needed.  In particular, when we
have database changes that will take a long time like back populating new
columns or creating new indexes on large tables, we run then in a
pre-release phase against live production.  We time the activities to
finish just before our release window.  Sometimes we also have post-release
database activities as well that follow shortly after our release outage.

I guess I hadn't extended my thoughts far enough and seen the full
potential of the idea so thanks.
One drawback for us when we use this mechanism is related to our release
schedule.  We release on a quarterly basis so having a process that spans
four releases pushes it out for an entire year.  But that's our problem and
we're making headway there too.

Thanks Christopher
Kevin.


Re: Zero downtime deployments

2015-12-04 Thread Kevin Hale Boyes
This is exactly what I'm after.  Thanks to both of you.

On 3 December 2015 at 12:54, Tauzell, Dave <dave.tauz...@surescripts.com>
wrote:

> If you cannot use a tool like flyway you can do it by hand, too.  The key
> is that all database changes need to be backwards compatible.  For example:
>
> So, if you want to drop a column:
> 1. Deploy new version of app that doesn't require column X
> 2. Shutdown version which does
> 3. drop column X
>
> If you want to rename a column:
> 1. Deploy new version of app that writes data to old column name + new name
> 2. shutdown old version
> 3. drop old column
>
> We generally test out our old version of an app running against the new
> database schema to make sure this process will work.
>
> -Dave
>
> -Original Message-
> From: jieryn [mailto:jie...@gmail.com]
> Sent: Thursday, December 03, 2015 1:32 PM
> To: Tomcat Users List
> Subject: Re: Zero downtime deployments
>
> Use http://flywaydb.org/ to perform database migrations. You will need at
> least 3 versions in order to perform an incompatible database change. v1 is
> existing behavior, v2 is a shim that bridges v1 and v3, and then v3 cleans
> up the shim and removes all the unnecessary hacks.
> When you have v1 rolled out against N images, then you can start rolling
> out compat shim v2 which adds some temporary work for the db and coexists,
> then when all instances are at v2 you can move to v3 which uses all the new
> stuff.
>
> I haven't found anything better or more efficient than the 2-step
> deployment with live code.
>
> On Thu, Dec 3, 2015 at 2:21 PM, Kevin Hale Boyes <kcbo...@gmail.com>
> wrote:
> > Thanks for this link to the presentation.
> > How do you all deal with some of the other dependencies that the web
> > application has?
> >
> > For example, if v2 of my application needs new database columns or
> > worse, a change to an existing column how can I have v1 and v2 running
> > at the same time?  We use Oracle as our database though the problem
> > exists for many database servers.
> >
> > Thanks,
> > Kevin.
> >
> > On 3 December 2015 at 01:31, Neill Lima <neill.l...@visual-meta.com>
> wrote:
> >
> >> Hello Jason,
> >>
> >> This approach of using httpd in front of 2+ Tomcats via AJP works
> >> well in my company. There is a bit of config necessary at httpd level
> >> so httpd is aware of all the Tomcats and also Tomcat config needs to
> >> be set to listen to AJP port instead of default port but it is not
> rocket science.
> >>
> >> This facilitates the deployment of nodes sequentially with no
> >> downtime. Of course, there is a shared session server to take care
> >> the sessions are not lost when Tomcats flip up and down.
> >>
> >> Reply in pvt if you need help setting up this.
> >>
> >> Thanks,
> >>
> >> Neill
> >>
> >> On Thu, Dec 3, 2015 at 12:08 AM, Jason Britton <jbritto...@gmail.com>
> >> wrote:
> >>
> >> > Thank you Christopher, reading now and we'll see if I can swing the
> >> > conference :)
> >> >
> >> > On Wed, Dec 2, 2015 at 4:00 PM, Christopher Schultz <
> >> > ch...@christopherschultz.net> wrote:
> >> >
> >> > > Jason,
> >> > >
> >> > > On 12/2/15 4:07 PM, Jason Britton wrote:
> >> > > > I was looking for information for how those on the list achieve
> >> > > > zero downtime deployments of their tomcat hosted web
> >> > > > applications.  I
> >> > imagine
> >> > > > this can be achieved in a variety of ways, but would love to
> >> > > > hear
> >> what
> >> > > > works for you.  In our current environment we front multiple
> >> > > > tomcat instances with apache httpd, each tomcat instance
> >> > > > hosting one or more unique web apps.  In order to support this
> >> > > > effort we do have the
> >> > > resources
> >> > > > where we could spin up multiple tomcat instances to serve
> >> > > > requests
> >> for
> >> > a
> >> > > > single application.  I know there is mod_proxy_balancer
> >> > > > available for httpd, and I understand starting with tomcat 7
> >> > > > there is support for parallel deployment of versioned wars, and
> >> > > > tomcat also supports clustering.  I'm 

Re: Zero downtime deployments

2015-12-03 Thread Kevin Hale Boyes
Thanks for this link to the presentation.
How do you all deal with some of the other dependencies that the web
application has?

For example, if v2 of my application needs new database columns or worse, a
change to an existing column how can I have v1 and v2 running at the same
time?  We use Oracle as our database though the problem exists for many
database servers.

Thanks,
Kevin.

On 3 December 2015 at 01:31, Neill Lima  wrote:

> Hello Jason,
>
> This approach of using httpd in front of 2+ Tomcats via AJP works well in
> my company. There is a bit of config necessary at httpd level so httpd is
> aware of all the Tomcats and also Tomcat config needs to be set to listen
> to AJP port instead of default port but it is not rocket science.
>
> This facilitates the deployment of nodes sequentially with no downtime. Of
> course, there is a shared session server to take care the sessions are not
> lost when Tomcats flip up and down.
>
> Reply in pvt if you need help setting up this.
>
> Thanks,
>
> Neill
>
> On Thu, Dec 3, 2015 at 12:08 AM, Jason Britton 
> wrote:
>
> > Thank you Christopher, reading now and we'll see if I can swing the
> > conference :)
> >
> > On Wed, Dec 2, 2015 at 4:00 PM, Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> > > Jason,
> > >
> > > On 12/2/15 4:07 PM, Jason Britton wrote:
> > > > I was looking for information for how those on the list achieve zero
> > > > downtime deployments of their tomcat hosted web applications.  I
> > imagine
> > > > this can be achieved in a variety of ways, but would love to hear
> what
> > > > works for you.  In our current environment we front multiple tomcat
> > > > instances with apache httpd, each tomcat instance hosting one or more
> > > > unique web apps.  In order to support this effort we do have the
> > > resources
> > > > where we could spin up multiple tomcat instances to serve requests
> for
> > a
> > > > single application.  I know there is mod_proxy_balancer available for
> > > > httpd, and I understand starting with tomcat 7 there is support for
> > > > parallel deployment of versioned wars, and tomcat also supports
> > > > clustering.  I'm just unsure of what approach I should start digging
> > into
> > > > and would very much appreciate any of your experiences.  The servers
> > > we'll
> > > > be rolling out will be using the latest versions of tomcat 8 and
> apache
> > > > httpd 2.4.  Thanks for any insights!
> > >
> > > Check this out:
> > >
> > >
> >
> http://people.apache.org/~schultz/ApacheCon%20NA%202015/Load-balancing%20Tomcat%20with%20mod_jk.pdf
> > >
> > > Start on slide/page 41.
> > >
> > > Then come to ApacheCon NA 2016 and discuss it!
> > >
> > > -chris
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > > For additional commands, e-mail: users-h...@tomcat.apache.org
> > >
> > >
> >
>


Re: Tomcat 8 jspx and HTML5

2015-08-11 Thread Kevin Hale Boyes
On 8 August 2015 at 06:54, Konstantin Preißer kpreis...@apache.org wrote:

 Hi Christopher,

  -Original Message-
  From: Christopher Schultz [mailto:ch...@christopherschultz.net]
  Sent: Saturday, August 8, 2015 2:32 PM
 
  This is a common problem, and the reason for it is that script for
  some reason, in every browser I've ever seen, completely fails to
  parse correctly if it's a self-terminating tag like script /. When
  you use .jspx, the input and output are assumed to be both well-formed
  XML where script / is perfectly acceptable.
 
  IMO this is a problem with browsers. Even in standards-compliance
  mode, they seem to demand that script be a paired tag. Thus, all of
  our script tags that reference external files are written like this:
 
script src=(script) type=text/javascript!-- --/script
 
  This will force the XML serializer to retain the comment and force a
  paired tag.

 Can you elaborate why you think this is a problem with browsers?

 The W3 HTML5 specification says at section 4.11.1 [1] for the script
 element:

 Tag omission in text/html:
 Neither tag is omissible

 I read it so that when using HTML syntax (text/html), you cannot omit the
 end element of a script tag. Section 8.1.2 (Elements) [2] also doesn't
 seem to allow a self-closing tag for script elements.


So it seems that it's well known that the script tag can't be
self-closing for HTML.
When I added the JSP directive and the jsp:output to indicate that I wanted
HTML I kind of expected to get valid HTML.

I couldn't find it in the JSP specification but the JEE tutorial indicates
that the JSP container doesn't interpret the document type declaration
indicated with jsp:output.  So Tomcat doesn't need to adjust the output
based on those declarations.

I'm bringing all this up because, at work, I'm in the middle of migrating
from weblogic to tomcat.  A lot of our JSP files have needed changes to put
in empty comment bodies to get around this behaviour.  We've found that
script, div and span can cause problems when they are self-closing.  We've
fixed most of our source code but we feel a little vulnerable where the
simple removal of a comment can cause a page to break.

I've looked into the Generator class in Tomcat and it produces the output
directly - i.e., it doesn't use a tool like SAX.
It probably wouldn't be difficult to put in a couple of special cases to
output closing tags with empty contents for a few elements.  Actually, we
could just remove the test for a null body and always produce the closing
tag (and empty body) which would simplify the code slightly and solve my
problem.  It would still be valid XML and it would have the benefit of
being valid HTML as well.

Would such a change stand much of a chance at being accepted by the
community?

I've ready the complete thread by now and really appreciate the feedback
and discussion the two of you have given.

Thanks,
Kevin.


Tomcat 8 jspx and HTML5

2015-08-07 Thread Kevin Hale Boyes
I want to use a jspx to generate some HTML5 but I'm running into a strange
problem.
I've produced a very small test to demonstrate the problem.

In the jspx pasted below if I remove the comment in the script tag (in
the head) then the page won't render properly in chrome browser.  When I
have a non-empty script tag then it renders fine.

I've used curl to look at the HTML being generated from Tomcat and can see
the difference.
When the script tag is empty it gets rendered as a self-closing tag:
script src=sayhi.js type=text/javascript/
When I put in the comment it gets rendered as I expect (not self-closing):
script src=sayhi.js type=text/javascript// tag can not be
empty/script

Why does this happen?
It's quite natural to write the empty script tag and countless example
exist so why can't I do it from my jspx?

Thanks,
Kevin.

P.S.  the sayhi.js file contains function sayhi() { alert('HI!'); }



?xml version=1.0 encoding=UTF-8?

jsp:root version=2.1 xmlns:jsp=http://java.sun.com/JSP/Page;

jsp:directive.page contentType=text/html pageEncoding=UTF-8 /
jsp:output omit-xml-declaration=true /
jsp:output doctype-root-element=html
doctype-system=about:legacy-compat /

html
head
script type=text/javascript src=sayhi.js// tag can not
be empty/script
/head
body
h1HTML5 from jspx/h1
script type=text/javascriptsayhi();/script
/body
/html

/jsp:root


Re: Choosing a Connector Protocol

2015-06-09 Thread Kevin Hale Boyes
Thanks for you help!

On 9 June 2015 at 07:47, Mark Thomas ma...@apache.org wrote:

 On 09/06/2015 14:38, Kevin Hale Boyes wrote:
  I'm having trouble figuring out what protocol to use for a Connector.
  I'm using Tomcat 8 and Java 8.
 
  The production system that Tomcat will be running on is Solaris 11 and
 I'm
  not yet sure if I'll be able to build the tomcat native library.
  So, I'm choosing between the Http11NioProtocol and Http11Nio2Protocol
 but I
  can't figure out what the difference is.
 
  I'll have two connectors defined - one SSL and the other non-SSL.
  The non-SSL connector services user traffic in my web application with
 the
  SSL session being terminated at the coyote load balancer.
  The SSL connector services B2B traffic and it's set up for client
  authentication.
 
 
  I've seen the Connector Comparison chart but that doesn't really help.
  The only difference seems to be that Nio uses simulated blocking.
  A bit of searching seems to compare it against the blocking connector
 only.
 
  So, I'm asking for help in understanding what the difference is between
 the
  two connector protocols and how to choose the best one for my
 application.

 There is very little to choose between them. Implementing an NIO2
 connector was the only way to find out if there were any noticeable
 performance benefits or not (there weren't). Very long term (maybe
 Tomcat 10 onwards) one of NIO and NIO2 may get dropped but I think we
 are several years away from even thinking about that.

 Right now, I'd say go with NIO. It has been around longer and should -
 in theory at least - be a little more stable.

 Mark


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




Choosing a Connector Protocol

2015-06-09 Thread Kevin Hale Boyes
I'm having trouble figuring out what protocol to use for a Connector.
I'm using Tomcat 8 and Java 8.

The production system that Tomcat will be running on is Solaris 11 and I'm
not yet sure if I'll be able to build the tomcat native library.
So, I'm choosing between the Http11NioProtocol and Http11Nio2Protocol but I
can't figure out what the difference is.

I'll have two connectors defined - one SSL and the other non-SSL.
The non-SSL connector services user traffic in my web application with the
SSL session being terminated at the coyote load balancer.
The SSL connector services B2B traffic and it's set up for client
authentication.


I've seen the Connector Comparison chart but that doesn't really help.
The only difference seems to be that Nio uses simulated blocking.
A bit of searching seems to compare it against the blocking connector only.

So, I'm asking for help in understanding what the difference is between the
two connector protocols and how to choose the best one for my application.

Thanks,
Kevin.


Re: WorkManager replacement

2015-02-13 Thread Kevin Hale Boyes
I'll look into the timers for sure.
I've also noticed that my application (lots of code) also uses Executors
and ExecutorService so I might do something there.

One of the things that WorkManager gave us, and we take advantage of, is a
callback handler that lets us know when the work was accepted for
processing and when it was complete.  I'll have to find replacements for
that feature.  Maybe that's easily done with Future's in the concurrency
framework.

Thanks for your help.
Kevin

On 13 February 2015 at 06:15, David kerber dcker...@verizon.net wrote:

 On 2/13/2015 7:29 AM, Daniel Mikusa wrote:

 On Thu, Feb 12, 2015 at 11:59 PM, Kevin Hale Boyes kcbo...@gmail.com
 wrote:

  I currently have an application running on weblogic that I'm moving over
 to
 tomcat 8.
 One of the things the application does is run background jobs using the
 commonj WorkManager.  These jobs are managed by weblogic which seems to
 be
 the recommended practice.

 What is the best/recommended way to run background jobs in Tomcat 8?


 Personally I'd use Spring, which has a nice and simple way to schedule
 tasks.  I'd also be using Spring for other things though and I'm not sure
 I'd pull it in just for scheduled tasks.


 I use java.util.timer for my scheduled jobs in tomcat.



 A quick google search came up with this library.

 http://commonj.myfoo.de/

 Haven't personally used it though.

 I suppose another option would be to just use java.util.concurrent.

 Dan



 Thanks,
 Kevin




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




Re: WorkManager replacement

2015-02-13 Thread Kevin Hale Boyes
We already use Spring in the project so I'll have a look there.
Thanks

On 13 February 2015 at 05:29, Daniel Mikusa dmik...@pivotal.io wrote:

 On Thu, Feb 12, 2015 at 11:59 PM, Kevin Hale Boyes kcbo...@gmail.com
 wrote:

  I currently have an application running on weblogic that I'm moving over
 to
  tomcat 8.
  One of the things the application does is run background jobs using the
  commonj WorkManager.  These jobs are managed by weblogic which seems to
 be
  the recommended practice.
 
  What is the best/recommended way to run background jobs in Tomcat 8?
 

 Personally I'd use Spring, which has a nice and simple way to schedule
 tasks.  I'd also be using Spring for other things though and I'm not sure
 I'd pull it in just for scheduled tasks.

 A quick google search came up with this library.

http://commonj.myfoo.de/

 Haven't personally used it though.

 I suppose another option would be to just use java.util.concurrent.

 Dan


 
  Thanks,
  Kevin
 



Re: WorkManager replacement

2015-02-13 Thread Kevin Hale Boyes
We use quartz already for scheduled tasks but the work that I'm talking
about doesn't necessarily happen on a timer.
The main use for us is the asynchronous execution of work once we've
figured out which node in our cluster should handle it.
I'm still going to consider java.util.concurrent since we use it elsewhere
but I'm also going to look more into Spring.

Thanks for your help,
Kevin.

On 13 February 2015 at 09:32, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Dan,

 On 2/13/15 7:29 AM, Daniel Mikusa wrote:
  On Thu, Feb 12, 2015 at 11:59 PM, Kevin Hale Boyes
  kcbo...@gmail.com wrote:
 
  I currently have an application running on weblogic that I'm
  moving over to tomcat 8. One of the things the application does
  is run background jobs using the commonj WorkManager.  These jobs
  are managed by weblogic which seems to be the recommended
  practice.
 
  What is the best/recommended way to run background jobs in Tomcat
  8?
 
 
  Personally I'd use Spring, which has a nice and simple way to
  schedule tasks.  I'd also be using Spring for other things though
  and I'm not sure I'd pull it in just for scheduled tasks.
 
  A quick google search came up with this library.
 
  http://commonj.myfoo.de/
 
  Haven't personally used it though.
 
  I suppose another option would be to just use
  java.util.concurrent.

 That amounts to rolling-your-own. If you just need to do something on
 a rough schedule, then java.util.concurrent is fine: start a thread
 that does something every 10 minutes or whatever.

 If you want real scheduling, you want something like Quartz:
 http://quartz-scheduler.org/

 I would argue that there are better solutions than using Quartz from
 within your own web application, but it depends upon your perspective.

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org

 iQIcBAEBCAAGBQJU3icEAAoJEBzwKT+lPKRY9bIP/ilEoImpKncX82WU+SqgQQgP
 zUhUTP0x+bntXNpouuxbb1NOhHKH6d7l0p2WKkQRoKf2qxJzxYhEnAiBELCI7CQF
 02OrXnzl4VmatgVgd5Aom/7QIzhLArLKNosGwIS8d/BbssPcZS6plBTU70VS8C7D
 I+QON7RW3veJG9SFFA5sKrGhlgFuDUTbrLcz/oZeZ2xdbg4s2htAH9B+XNz5Gbvv
 NKESUASPTGzYCSwZhgwIVoxZZavdkCwVvSJIEyPDlGwMDrBkYdSg/GbctyHA8Mny
 METMmlN9Q29mEc6/VNSv6B+XtqUWCPud0WAPZm6rIso7NaV/ScY+/L19lzvLOn1a
 SvwYavQ8bdGWb+w5xIcnsnZkLknwaDJoYMerquwnCxsPqaAdBygdku8OuvA8PxT4
 eIlUCOoT5GjxWTEX+HIWBvyx2KXTM8EScYdyXCuGtxnKcpexYaXBJQ2GhNc4EHym
 T3JiLu/fAIu4TWyI6oM64YLMfJfNk49gNtPCjWfRluG4qqKQ3YqjQubf8FIe/vOe
 y1wXzC/7KtV1urLDL74mLTjGpihiig3e9CRa7MWK354K/WoSlgbkze/Ac1df40g+
 Zq1MpgnGQmjgvG16FGujeL5U+QlwFTXYNAqXKsP0++FJJ9DEhkQM8c0yYlDplOYZ
 xFKob5fnVsgVj1flZH4N
 =aLoS
 -END PGP SIGNATURE-

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




Re: WorkManager replacement

2015-02-13 Thread Kevin Hale Boyes
Spring is starting to appear to be the best choice.  Thanks for the
reference.

On 13 February 2015 at 08:04, Daniel Mikusa dmik...@pivotal.io wrote:

 On Fri, Feb 13, 2015 at 9:49 AM, Kevin Hale Boyes kcbo...@gmail.com
 wrote:

  We already use Spring in the project so I'll have a look there.
 


 http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#scheduling

 Dan


  Thanks
 
  On 13 February 2015 at 05:29, Daniel Mikusa dmik...@pivotal.io wrote:
 
   On Thu, Feb 12, 2015 at 11:59 PM, Kevin Hale Boyes kcbo...@gmail.com
   wrote:
  
I currently have an application running on weblogic that I'm moving
  over
   to
tomcat 8.
One of the things the application does is run background jobs using
 the
commonj WorkManager.  These jobs are managed by weblogic which seems
 to
   be
the recommended practice.
   
What is the best/recommended way to run background jobs in Tomcat 8?
   
  
   Personally I'd use Spring, which has a nice and simple way to schedule
   tasks.  I'd also be using Spring for other things though and I'm not
 sure
   I'd pull it in just for scheduled tasks.
  
   A quick google search came up with this library.
  
  http://commonj.myfoo.de/
  
   Haven't personally used it though.
  
   I suppose another option would be to just use java.util.concurrent.
  
   Dan
  
  
   
Thanks,
Kevin
   
  
 



WorkManager replacement

2015-02-12 Thread Kevin Hale Boyes
I currently have an application running on weblogic that I'm moving over to
tomcat 8.
One of the things the application does is run background jobs using the
commonj WorkManager.  These jobs are managed by weblogic which seems to be
the recommended practice.

What is the best/recommended way to run background jobs in Tomcat 8?

Thanks,
Kevin