daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Given an app with mirrors web-blue and web-green in the CF test space with hostname www.example.org...
  2.  
  3. # Find which mirror is already active, which to switch to
  4. export OLD_MIRROR=$(cf routes | sed -nr 's/^(test\s+)?www\s+example\.org\s+web-(blue|green).*$/\2/p')
  5. if [ "$OLD_MIRROR" = "blue" ]; then
  6.   export NEW_MIRROR="green"
  7. elif [ "$OLD_MIRROR" = "green" ]; then
  8.   export NEW_MIRROR="blue"
  9. else
  10.   export OLD_MIRROR="green"
  11.   export NEW_MIRROR="blue"
  12. fi
  13.  
  14. ## Push to Cloud Foundry
  15. cf push web-${NEW_MIRROR} --no-route
  16.  
  17. ## Switch route targets
  18. cf map-route web-${NEW_MIRROR} example.org -n www
  19. cf unmap-route web-${OLD_MIRROR} example.org -n www
  20.  
  21. ## Stop old mirror
  22. cf stop web-${OLD_MIRROR}
RAW Paste Data
Top