Blue green deployment demo for Java applications.
This example assumes that a continuous integration system is deploying WAR with a known name at dist folder. You can learn more about this technology by reading the quickstart guide.
To make this deployment you need to build:
- the role that contains the server configuration
- the macfile that contains the infrastructure blueprint
Configure aws
and mac
tools
pip install awscli
pip install mac
aws configure
mac login
mac provider credential amazon <access key> <secret_access_key>
Deploy the infrastructure version 1.
mac -s infrastructure macfile https://goo.gl/SouFP3 -p INF_VERSION=1 WAR_VERSION=1
The output displays the DNSName of the elastic load balancer. In a real word deployment, this would be the CNAME of the domain name where the application resides. You can access at this value at any time. Open it in a browser to see the results.
mac resource get_stdout demo 1 build_lb_inf
Let's emulate a green blue deployment. We will deploy a second infrastructure "version 2".
mac -s infrastructure macfile https://goo.gl/SouFP3 -p INF_VERSION=2 WAR_VERSION=2
There are two infrastructures running in paralel and connecting to the same RDS.
mac infrastructure list
You can access to the DNSName of the load balancer:
mac resource get_stdout demo 2 build_lb_inf
Destroy the old infrastructure version 1
mac infrastructure destroy demo 1