Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying Distributed Systems

Deploying Distributed Systems

As Hailo transitions to a globally distributed SOA model, we needed to improve how we deployed software. We currently do this with an application called Conan, based on a modified version of Capistrano.

Talk given at PHP London, March 2013

mattheath

March 07, 2013
Tweet

More Decks by mattheath

Other Decks in Programming

Transcript

  1. HOW DO WE DO THIS? FTP SCP HOT EDIT SERVER

    MAGNETIZED NEEDLE & STEADY HANDS?!
  2. WHAT ELSE? COMPRESS & MINIFY RESTART SERVERS ASSET VERSIONING DATABASE

    MIGRATIONS LOAD NEW CONFIGS LINT CHECKS CLEAR CACHES SPAWN WORKERS WARM CACHES
  3. “Capistrano is a utility and framework for executing commands in

    parallel on multiple remote machines, via SSH”
  4. • Identify version to deploy • Update remotely cached git

    repository • Checkout specific version
  5. • Identify version to deploy • Update remotely cached git

    repository • Checkout specific version • Copy code to a new timestamped folder
  6. • Identify version to deploy • Update remotely cached git

    repository • Checkout specific version • Copy code to a new timestamped folder • Final preflight tasks
  7. • Identify version to deploy • Update remotely cached git

    repository • Checkout specific version • Copy code to a new timestamped folder • Final preflight tasks • Switch symlink to point to new code
  8. • Identify version to deploy • Update remotely cached git

    repository • Checkout specific version • Copy code to a new timestamped folder • Final preflight tasks • Switch symlink to point to new code • Restart web servers
  9. • Identify version to deploy • Update remotely cached git

    repository • Checkout specific version • Copy code to a new timestamped folder • Final preflight tasks • Switch symlink to point to new code • Restart web servers • Post deploy tasks
  10. • Identify version to deploy • Update remotely cached git

    repository • Checkout specific version • Copy code to a new timestamped folder • Final preflight tasks • Switch symlink to point to new code • Restart web servers • Post deploy tasks • Clean up old releases
  11. $ capify . [add] writing './Capfile' [add] making directory './config'

    [add] writing './config/deploy.rb' [done] capified!
  12. cap londonstaging deploy cap dublinstaging deploy cap torontostaging deploy cap

    chicagostaging deploy cap nycstaging deploy MULTI-CONFIGURATION?
  13. cap londonstaging deploy cap dublinstaging deploy cap torontostaging deploy cap

    chicagostaging deploy cap nycstaging deploy cap bostonstaging deploy MULTI-CONFIGURATION?
  14. cap londonstaging deploy cap dublinstaging deploy cap torontostaging deploy cap

    chicagostaging deploy cap nycstaging deploy cap bostonstaging deploy cap ...staging deploy MULTI-CONFIGURATION?
  15. cap londonstaging deploy cap dublinstaging deploy cap torontostaging deploy cap

    chicagostaging deploy cap nycstaging deploy cap bostonstaging deploy cap ...staging deploy cap ...staging deploy MULTI-CONFIGURATION?
  16. cap londonstaging deploy cap dublinstaging deploy cap torontostaging deploy cap

    chicagostaging deploy cap nycstaging deploy cap bostonstaging deploy cap ...staging deploy cap ...staging deploy ... MULTI-CONFIGURATION?
  17. INTERNAL TOOLS & APIS HAILOCAB.COM DRIVER APIS CUSTOMER SERVICES CREDIT

    SERVICES COMMUNICATION SERVICES AUTHENTICATION SERVICES CONFIGURATION SERVICES CRM SERVICES PAYMENT SERVICES EVENTS SERVICES STATS SERVICES ALLOCATION SERVICES BACKGROUND QUEUES CUSTOMER APIS MESSAGING SERVICES APPLICATIONS
  18. One application to deploy all applications Deploy in parallel to

    n servers in distributed geographic regions with the correct configuration Dynamic server lists Add additional functionality in one central place Play a shipping horn sound when deploying
  19. "echo 'APC Cache Blitz in '`let n= $(php -i |

    grep realpath_cache_ttl | sed -n 's/.* \([0-9]*\).*/\1/p') +5;echo $n`' seconds... ('`date`')'; sleep `let n=$(php -i | grep realpath_cache_ttl | sed -n 's/.* \([0-9]*\).*/\1/p')+5;echo $n`; echo 'Blitzing... ('`date`')'; blitz"
  20. IRC / CHAT [03:14:58] <CONAN> mobile-api/intlrelease (6957bb87) is being deployed

    to staging by Matt Heath [03:15:25] <CONAN> mobile-api/intlrelease successfully deployed to staging [12:29:20] <CONAN> elasticride/master (390eae4c) is being deployed to staging by Saul Howard
  21. Image credits: Conan ‘8-bit Marvels’ - Paulo Capdeville Network diagram

    - Elijah Meeks, dhs.stanford.edu Creative Commons images from sxc.hu thanks to Miguel Saavedra, @rbval, G. Marcus Still interested? Caphub - Multistage capistrano: http://bit.ly/Tkkn4W Deploying at Github: http://git.io/FlaFhA Asgard - Web based deployment from Netflix: http://nflx.it/NsJVtD