Luis Majano Forums Notification: Post to Restart Key

Title: Restart Key
Thread: Restart Key
Forum: Enhancements
Conference: ColdBox
User: oscararevalo

Hello all,
I run into a situation at work and thought it may be good to share
with others and can even be a nice candidate for a coldbox addition.

A little
background first. Pretty much all the applications that we roll out at work must
be deployed to a cluster of ColdFusion servers, that is, the same code base is
running in parallel in at least 2 machines, and sometimes if the load requires
it, on several more. A constant problem that we run into is that when we roll
out upgrades to the application on either the config.xml or on the
onApplicationStart event handler, there is no easy way to force all of the
servers to recognize those changes. Basically we either have to make a request
to each individual server with the reinit flag or we have to restart the CF
service on all of them. Needless to say neither of those solutions is painless.
Now, what we came up with, and what I'm proposing to be incorporated into the
framework is the following solution. Add a hardcoded variable named "resetKey"
and assign it an arbitrary value (ie a release number). Then right before the
fwreinit is evaluated in order to check if it is true or false compare the value
of the resetKey setting with a corresponding variable but on the Application
scope (for example application.resetKey). If they are different or if the key
does not exist on the application scope, then set the fwreinit to true, and when
the whole application reinitialization process has been completed, set the
application.resetKey variable to the resetKey value that is hardcoded. This will
force each server to refresh itself on its own as soon as it processes the next
request. This way refreshing the application becomes a painless process.
Luis, any thoughts?