Over a million developers have joined DZone.

No Downtime Deployment Using Yet Another Cloud Foundry Gradle Plugin

MVB Biju Kunjummen describes his Gradle plugin for deploying to Cloud Foundry for both autopilot and blue-green deployments.

· DevOps Zone

The DevOps zone is brought to you in partnership with Sonatype Nexus. The Nexus suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

I have been trying my hand at writing a Gradle plugin for deploying applications to Cloud Foundry and wrote about this plugin in my previous post. I have now enhanced this plugin with support for no-downtime deploys into Cloud Foundry using two approaches—an Autopilot style deployment described here and more commonly used Blue-Green style deployment described here.

To jump into the meat of the plugin, once it is configured cleanly, all you have to do is the following:

For an autopilot style:

./gradlew cf-push-autopilotjavascript:void(0)


...and for a Blue-Green deployment:

./gradlew cf-push-blue-green


And the plugin tasks would take care of the rest.

What Is Being Solved

If you use Cloud Foundry CLI to push an application to Cloud Foundry, then existing instances of the application are stopped, replaced, and started up. This introduces a downtime for the application until the new instance of the application is up. Just to demonstrate this behavior, the following graph represents steady traffic to a website while an application is pushed to Cloud Foundry—the 30-second blip is when the new app is being started up.


Autopilot and Blue-Green Style Deployments

Autopilot and Blue-Green styles of deployment fix the issue by carefully orchestrating the deployment of an application such that the external facing route always points to a working version of the application.

The plugin now natively performs all the steps needed for these two styles of no-downtime deployments.

Here is how the same graph looks with an Autopilot style type deployment using the plugin, note that there is a slightly higher response time around the time the new application switches in. Once primed though the response times smooth out:


...and with a Blue-Green style deployment using this plugin:


References:

1. The details about how to install and configure the plugin is available here - https://github.com/pivotalservices/ya-cf-app-gradle-plugin

2. A sample application configured with the plugin is here - https://github.com/bijukunjummen/cf-show-env

3. The load test using gatling is available here

The DevOps zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today

Topics:
cloud foundry ,gradle ,plugin ,deployment

Published at DZone with permission of Biju Kunjummen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}