I read Martin Fowler's Blue/Green Deployment article and really like it. Basically, it's the concept that you have 2 production-class environments: a "blue" LIVE environment and a "green" LIVE environment. You only have 1 environment considered to be the "real" LIVE environment at any given time. So you put some sort of routing/switch mechanism (probably an intermediary web app or a modified software load balancer) in front of these two LIVE environments that dictates which environment users get routed to (we're talking web apps here).
So you have all your users getting routed to, say, the Green LIVE environment at http://green.example.com/myapp
. Then, when you are ready to push out some new production changes, instead of deploying them to Green LIVE, you deploy them to Blue LIVE, and start routing some small (~10%) percentage of your users over to the Blue LIVE. Typical strategies are to have the router use IP addresses or cookies to determine whether a user should be routed to Blue or Green.
When you're confident that there are no bug bugs/issues with your production changes (applied to on Blue LIVE), you reconfigure the router to now have all traffic redirected to Blue LIVE at http://blue.example.com/myapp
.
Now, onto my question:
I am designing a GWT app and would like to implement this blue/green switch pattern. The problem is that GWT apps are client-side and don't follow the normal server-side web app architecture that Spring, Struts, JSP, servlet apps utilize.
So I ask: how could I have 2 Tomcat instances (Blue Tomcat and Green Tomcat), serving two different versions of the same GWT app to users from behind a blue/green "router"? By "router", I'm probably talking about an intermediary web app at http://router.example.com/myapp-router
.
Visually, here's the problem:
green.example.com:8080/opt/tomcat/webapps/myapp.war/ --> Green Tomcat
myModule/
mymodule.nocache.js
mymodule.cache.html } typical GWT app WAR structure...
hosts/ this is currently the "real" LIVE
index.html environment where 90% traffic is routed to
css/
main.css
WEB-INF/
web.xml
lib/
classes/
blue.example.com:8080/opt/tomcat/webapps/myapp.war/ --> Blue Tomcat
myModule/
mymodule.nocache.js
mymodule.cache.html } typical GWT app WAR structure...
hosts/ new production changes have been deployed here
index.html and 10% of users are routed here
css/
main.css
WEB-INF/
web.xml
lib/
classes/
router.example.com:8080/opt/tomcat/webapps/myapp-router.war/ --> Router
WEB-INF/
web.xml
lib/ } simple headless WAR that inspects HTTP Requests and
classes/ determines which environment to redirect user to
That's the basic architecture: the problem is that clients would be making requests to router.example.com/myapp-router
, and the router would be forwarding the requests on to either blue.example.com/myapp
or green.example.com/myapp
. I'm not convinced that GWT (I'm using RequestFactory here) will ultimately know to communicate with either blue
or green
once the GWT app is downloaded to the client.
So I ask: is this possible? Are there any special configurations/code/libs/techniques etc. I will need to utilize in order to make this work? Any caveats or pitfalls I'm not thinking of? Thanks in advance!