Blue green deployment demo for Java applications
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Blue green deployment demo

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

Step 1

Configure aws and mac tools

pip install awscli
pip install mac
aws configure
mac login
mac provider credential amazon <access key> <secret_access_key>

Step 2

Deploy the infrastructure version 1.

mac -s infrastructure macfile -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

Step 3

Let's emulate a green blue deployment. We will deploy a second infrastructure "version 2".

mac -s infrastructure macfile -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

Step 4

Destroy the old infrastructure version 1

mac infrastructure destroy demo 1