Anatoly
Anatoly

Reputation: 5241

How to update bluemix application but leaving this application available?

I have Java Liberty Web Application on Bluemix. If I need to update it, the app becomes unavailable for a few minutes. Is it possible to update it without turning it off? For example deploy two applications and reroute to a second one one when first is being updated?

Upvotes: 4

Views: 112

Answers (2)

Holly Cummins
Holly Cummins

Reputation: 11502

This is known as a blue-green deployment, and there are several cloud foundry plugins which will do it 'automatically':

Bluemix's Active Deploy service

This is new function, so it's in beta at the moment. To make the service available, you can add it from the Bluemix service catalog to your space. If you're running cf locally, you'll need to install the plugin:

  cf add-plugin-repo bluemix http://plugins.ng.bluemix.net/
  cf install-plugin active-deploy -r bluemix 

Once it's available (either with a cf plugin install, or the catalog configuration), and you have routes, you can do

cf push --no-route new-version
cf active-deploy-create old-version new-version

Cloud Foundry community-contributed plugin for blue green deployments

You can install this using cf add-plugin-repo garage https://garage-cf-plugins.eu-gb.mybluemix.net/ cf install-plugin blue-green-deploy -r garage

Then, to push,

cf blue-green-deploy app_name --smoke-test <path to test script>

The smoke test part is optional, but a good idea.

Upvotes: 2

Ed Shee
Ed Shee

Reputation: 971

Yep. There best way of doing this currently is via the following steps.

  1. deploy original application on myroute.mybluemix.net
  2. make some code changes
  3. deploy changed application on myroute2.mybluemix.net
  4. map myroute.mybluemix.net to the changed application using cf map-route APP_NAME DOMAIN [-n HOSTNAME]. Original application now has myroute.mybluemix.net and the changed application now has myroute.mybluemix.net & myroute2.mybluemix.net. At this point traffic will be routed equally between the two application versions (assuming they have the same number of instances).
  5. unmap myroute.mybluemix.net from the original application using cf unmap-route APP_NAME DOMAIN [-n HOSTNAME]. All traffic on myroute.mybluemix.net will now all be routed to the newer version.
  6. delete original application using cf delete APP_NAME
  7. (optional) remove myroute2.mybluemix.net using cf unmap-route APP_NAME DOMAIN [-n HOSTNAME]

This seems a bit long winded but it will achieve what you want.

Upvotes: 6

Related Questions