Blue green deployment demo for Java applications
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
src
.gitignore
README.md
circle.yml
continuous_deployment.macfile
infrastructure.macfile
java-demo.iml
pom.xml

README.md

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 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

Step 3

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

Step 4

Destroy the old infrastructure version 1

mac infrastructure destroy demo 1