Question

I want to do zero downtime deployment of apps on cloudbees (I am using continuous deployment) - but my app needs time to warm up?

Also, I would like to quickly be able to roll back if things go horribly wrong, is there a way to do this?

Was it helpful?

Solution

What you want, but may not realise it - is blue-green deployment, where you always have a active/standby app pair - and always deploy to the standby, cut over when ready.

See here for a better description.

Well, good news - there is a plugin for this here.

You can even automate this as part of your Jenkins build, for example, do something like this in your freestyle job script (this assumes you have setup an app as per the above link:

# INSTALL AND CONFIGURE BEES SDK
export BEES_HOME=/opt/cloudbees/cloudbees-sdk/
export PATH=$PATH:$BEES_HOME
if [ ! -d ~/.bees ]; then
    bees init -f -a <account name> -ep us -k $BEES_API -s $BEES_SECRET
fi
bees plugin:install com.cloudbees.sdk.plugins:bg-plugin




# DEPLOY
bees app:bg:deploy -n <your app name> target/web-webapp.war




# WARM NEW SERVERS - for example - could be a smoke test here:
echo "Preparing new servers for router switch over..."
for i in {1..50}
do
    curl -s "http://yourwebsite.com/" > /dev/null
    sleep 5
done




# SWITCH ROUTER
echo "Switching router over to new servers..."
bees app:bg:switch -n <your app name> -f




# SHUTDOWN OLD SERVERS
echo "Shutting down old servers..."
bees app:bg:stop -n int -f
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top