cf plugin for zero-downtime application restaging and restarting, highly inspired by autopilot.
cf bg-restage
is mostly for those who don't want to redeploy an app with source code.
It was initially created to restage automatically all apps in a Cloud Foundry
when a new buildpack has been released with security patch.
cf bg-restart
can be used, for example, to perform zero-downtime scale-up/down of
instances, or to apply new environment variables, service bindings or security
groups.
Download the latest version from the releases page and make it executable.
$ cf install-plugin path/to/downloaded/binary
$ cf bg-restage [--no-delete | --no-stop] application-to-restage
$ cf bg-restart [--no-delete | --no-stop] application-to-restart
This is the process for bg-restage
:
It retrieves manifest from old app in a directory and create fake file as content to be pushed.
The old application is renamed to <APP-NAME>-venerable
. It keeps its old route
mappings and this change is invisible to users.
The new application is pushed to <APP-NAME>
, this push will normally fail because we just want to create an app
but not push real code (we do that because there is no easy way to create an app without pushing code as a cli plugin).
Note: you will not see any failures and if it's not failed the app will not be started.
Application bits (source code) will be copied from old app to the new app to put real code inside the new app.
The new app will be restarted which will restage the app with the real code from old app.
The old app will be removed and all traffic will be on the new app.
The process for bg-restart
is similar, but in step 4. we also copy the staged droplet in
addition to the application bits.