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

Continious deployment at Flipkart

Continious deployment at Flipkart

39d28dff39e8dfc4866477c0e1d52506?s=128

Pankaj Kaushal

April 11, 2012
Tweet

More Decks by Pankaj Kaushal

Other Decks in Technology

Transcript

  1. 1 | Internal use only Continuous deployment at flipkart Pankaj

    Kaushal Photo credit: http://www.flickr.com/photos/bomb_tea/
  2. 2 | Internal use only Old school deployment Check out

    svn Point docroot to new svn Place copies on all servers One server at a time Check if it works
  3. 3 | Internal use only Fear of the tar Site

    breaks unexpectedly
  4. 4 | Internal use only many downtimes everyday

  5. 5 | Internal use only most related to deployments

  6. 6 | Internal use only Deployments Module X is no

    longer working. Foostat widget is now displaying php instead of rendering html. All images are gone Blah blah tab shows sometimes and disappears sometimes I get blank screens I'm sure I deployed on all four servers Forgot to restart foo backend service If anything can go wrong, it will.
  7. 7 | Internal use only Discourage deployments in the interest

    of stability? or Allow deployments to happen as fast as they need to?
  8. 8 | Internal use only Flipkart releases

  9. 9 | Internal use only Deployment should be a non-event

  10. 10 | Internal use only Flipkart deployment procedure Step1: svn

    copy -m “deploying to prod” trunk/ prod/2011-07-08-10:00/ Step2: there is no Step 2
  11. 11 | Internal use only How? You don't need magic

  12. 12 | Internal use only 1. Continuous integration

  13. 13 | Internal use only 1. Continuous integration integrate frequently

    against a controlled source code repository Multiple integrations per day
  14. 14 | Internal use only 2. Multiple Environments

  15. 15 | Internal use only 2. Multiple Environments Integration environments

    are replicas of production All components of the system are available Duplicate the production environment as much as you can
  16. 16 | Internal use only 3. One step build

  17. 17 | Internal use only

  18. 18 | Internal use only 4. One step build and

    deploy
  19. 19 | Internal use only

  20. 20 | Internal use only

  21. 21 | Internal use only Continuous integration Is not a

    tool, neither is it the result of a tool It's a philosophy
  22. 22 | Internal use only You don't need lots of

    money or fancy tools We use a bunch of shell scripts to do this
  23. 23 | Internal use only Use existing Free software Debian

    Subversion SSH Puppet
  24. 24 | Internal use only

  25. 25 | Internal use only Continuous integration Integration Environments Packaging

    Configuration Automated Builds and Deployments
  26. 26 | Internal use only

  27. 27 | Internal use only Building with Continuous Integration Step1:

    check out trunk/mainline Step 2: build feature/ fix bug Step 3: Commit to mainline/trunk Step 4: Commit to eng/ Integration environment builds automatically
  28. 28 | Internal use only Continuous integration Integration Environments Packaging

    Configuration Automated Builds and Deployments
  29. 29 | Internal use only

  30. 30 | Internal use only Integration Environments We have two

    integration environments ENG (Engineering) SB (Sandbox) Each with it's own svn branch ENG is on virtual machines
  31. 31 | Internal use only Each environment acts as a

    monitor to the repository Every time there is a commit against the repository Build server automatically checks out the sources initiates a build notifies the committer of the result of the build
  32. 32 | Internal use only Continuous integration Integration Environments Packaging

    Configuration Automated Builds and Deployments
  33. 33 | Internal use only

  34. 34 | Internal use only @flipkart apt-get install whatever We

    leverage the debian package mangaer All software is installed using apt-get
  35. 35 | Internal use only @flipkart apt-get install whatever Automated

    builds make .deb .deb pushed to a repository (flipkart repo)
  36. 36 | Internal use only @flipkart apt-get install whatever Software

    dependencies Version information Allows rollbacks and prevents software mismatches
  37. 37 | Internal use only Apt Repository

  38. 38 | Internal use only Apt Repository

  39. 39 | Internal use only Continuous integration Integration Environments Package

    management Configuration Automated Builds and Deployments
  40. 40 | Internal use only Where is the booboo file?

    Many things together build a product Everything should be in the repository Source Code, Configuration, Database schemas
  41. 41 | Internal use only Can't find booboo Put everything

    in the repository not just code Everything you need to do a build should be in there test scripts properties files database schema install scripts third party libraries
  42. 42 | Internal use only Static Configurations Packages Dynamic configurations

    Database System Configurations Puppet
  43. 43 | Internal use only Continuous integration Integration Environments Packaging

    Configuration Automated Builds and Deployments
  44. 44 | Internal use only

  45. 45 | Internal use only Automated Builds Turning source code

    to a running system is complicated Typing strange commands is a waste of time
  46. 46 | Internal use only Automated deployments Multiple environments One

    to run commit tests (eng) One or more to run secondary tests (sandbox) Production Scripts that allow you to deploy the application into any environment easily Deployment procedure is the same everywhere
  47. 47 | Internal use only @flipkart fk-ops-build One Package that

    Has a config to describe environments Contains Build scripts for all packages for all env Monitors the svn tree for changes Build new packages automatically (or manually) Deploys new packages automatically (or manually)
  48. 48 | Internal use only

  49. 49 | Internal use only Continuous Deployment Changes trickle down

    environments automatically Builds succeed in all test environments Elaborate test cases Automatically hit production
  50. 50 | Internal use only experiments Some teams use automated

    deployments till Sandbox Some teams use Teamcity to do integrated builds on every commit We can do continuous deployments till prod but we do not practice it in every project
  51. 51 | Internal use only Way forward Much tighter integration

    with test cases Environments as Rings ENG to do unit tests Sandbox to do smoke tests Functional tests before push to production
  52. 52 | Internal use only Resources Wikipedia martinfowler.com

  53. 53 | Internal use only moo @spo0nman Spo0nman on freenode

    #linux-india #perl #debian