Search code examples
cloud-foundryblue-green-deployment

Push and delete or Reroute? Blue Green Deployment on CloudFoundry


Is there a reason that the CloudFoundry documentation recommends the following steps for Blue-Green deployment (we're in Pivotal CloudFoundry):

  1. Push GoodApp_new
  2. Add GoodApp route to GoodApp_new (load balancing between them)
  3. Remove GoodApp route from GoodApp
  4. Remove GoodApp_new route from GoodApp_new
  5. Delete GoodApp
  6. Commonplace followup step: Rename the GoodApp_new to GoodApp

When the following steps seem equivalent?

  1. Rename GoodApp to GoodApp_old (routes remain unchanged)
  2. Push the new version with the name GoodApp (effectively load balanced, has correct routes by default because the app name is correct)
  3. Delete GoodApp_old

Maybe its uncommon that all the correct routes are added during the push?

Maybe there is an unforeseen side affect to renaming the app that isn't in the documentation? Our APM setup already handles having multiple app names floating around for the few seconds that that will be relevant.


Solution

  • I don't see anything wrong with either approach. There are a handful of ways to do blue/green deployment, so you can pick the one that works best for you and your workflow.

    That said, I would suggest using an existing and tested plugin for the cf cli, instead of rolling it yourself. It's not a super complicated process but there are a handful of plugins so if one fits your workload you may as well use it. It'll save you a little time and it's vetted by the community.

    Plugin list here -> https://plugins.cloudfoundry.org/

    The one that I see used a lot is https://github.com/contraband/autopilot, but that isn't a knock against any of the other plugins.

    Hope that helps!