Over a million developers have joined DZone.

No Downtime Deployment Using Yet Another Cloud Foundry Gradle Plugin

DZone 's Guide to

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 ·
Free Resource

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:


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

cloud foundry ,gradle ,plugin ,deployment

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}