Continuous deployment-at-flipkart

25,466
-1

Published on

Flipkart.com is one of India's top 100 websites in terms of traffic. We use continuous deployment techniques to achieve quick deployments multiple times a day. Techniques and best practices we follow that we believe could be interesting to many others.

Published in: Technology
1 Comment
33 Likes
Statistics
Notes
No Downloads
Views
Total Views
25,466
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
470
Comments
1
Likes
33
Embeds 0
No embeds

No notes for slide

Continuous deployment-at-flipkart

  1. 1. Continuous deployment at flipkart Pankaj Kaushal Photo credit: http://www.flickr.com/photos/bomb_tea/
  2. 2. Old school deployment <ul><li>Check out svn
  3. 3. Point docroot to new svn
  4. 4. Place copies on all servers
  5. 5. One server at a time
  6. 6. Check if it works </li></ul>
  7. 7. Fear of the tar <ul><li>Site breaks unexpectedly </li></ul>
  8. 8. <ul><li>many downtimes everyday </li></ul>
  9. 9. <ul><li>most related to deployments </li></ul>
  10. 10. 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.
  11. 11. <ul><li>Discourage deployments in the interest of stability?
  12. 12. or
  13. 13. Allow deployments to happen as fast as they need to? </li></ul>
  14. 14. Flipkart releases
  15. 15. <ul><li>Deployment should be a non-event </li></ul>
  16. 16. Flipkart deployment procedure <ul><li>Step1: svn copy -m “ deploying to prod ” trunk/ prod/2011-07-08-10:00/
  17. 17. Step2: there is no Step 2 </li></ul>
  18. 18. <ul><li>How?
  19. 19. You don't need magic </li></ul>
  20. 20. <ul><li>1. Continuous integration </li></ul>
  21. 21. <ul><li>1. Continuous integration </li></ul><ul><ul><li>integrate frequently </li></ul></ul><ul><ul><li>against a controlled source code repository </li></ul></ul><ul><li>Multiple integrations per day </li></ul>
  22. 22. <ul><li>2. Multiple Environments </li></ul>
  23. 23. <ul><li>2. Multiple Environments </li></ul><ul><li>Integration environments are replicas of production </li></ul><ul><li>All components of the system are available </li></ul><ul><li>Duplicate the production environment as much as you can </li></ul>
  24. 24. <ul><li>3. One step build </li></ul>
  25. 26. <ul><li>4. One step build and deploy </li></ul>
  26. 29. <ul><li>Continuous integration </li></ul><ul><li>Is not a tool, neither is it the result of a tool
  27. 30. It's a philosophy </li></ul>
  28. 31. <ul><li>You don't need lots of money or fancy tools
  29. 32. We use a bunch of shell scripts to do this </li></ul>
  30. 33. <ul><li>Use existing Free software </li><ul><li>Debian
  31. 34. Subversion
  32. 35. SSH
  33. 36. Puppet </li></ul></ul>
  34. 38. <ul><li>Continuous integration
  35. 39. Integration Environments
  36. 40. Packaging
  37. 41. Configuration
  38. 42. Automated Builds and Deployments </li></ul>
  39. 44. Building with Continuous Integration <ul><li>Step1: check out trunk/mainline
  40. 45. Step 2: build feature/ fix bug
  41. 46. Step 3: Commit to mainline/trunk
  42. 47. Step 4: Commit to eng/ </li><ul><ul><ul><li>Integration environment builds automatically </li></ul></ul></ul></ul>
  43. 48. <ul><li>Continuous integration
  44. 49. Integration Environments
  45. 50. Packaging
  46. 51. Configuration
  47. 52. Automated Builds and Deployments </li></ul>
  48. 54. Integration Environments <ul><li>We have two integration environments </li><ul><li>ENG (Engineering)
  49. 55. SB (Sandbox) </li></ul><li>Each with it's own svn branch
  50. 56. ENG is on virtual machines </li></ul>
  51. 57. <ul><li>Each environment acts as a monitor to the repository
  52. 58. Every time there is a commit against the repository </li><ul><li>Build server automatically checks out the sources
  53. 59. initiates a build
  54. 60. notifies the committer of the result of the build </li></ul></ul>
  55. 61. <ul><li>Continuous integration
  56. 62. Integration Environments
  57. 63. Packaging
  58. 64. Configuration
  59. 65. Automated Builds and Deployments </li></ul>
  60. 67. @flipkart apt-get install whatever <ul><li>We leverage the debian package mangaer
  61. 68. All software is installed using apt-get </li></ul>
  62. 69. @flipkart apt-get install whatever <ul><li>Automated builds make .deb
  63. 70. .deb pushed to a repository (flipkart repo) </li></ul>
  64. 71. @flipkart apt-get install whatever <ul><li>Software dependencies
  65. 72. Version information
  66. 73. Allows rollbacks and prevents software mismatches </li></ul>
  67. 74. Apt Repository
  68. 75. Apt Repository
  69. 76. <ul><li>Continuous integration
  70. 77. Integration Environments
  71. 78. Package management
  72. 79. Configuration
  73. 80. Automated Builds and Deployments </li></ul>
  74. 81. Where is the booboo file? <ul>Many things together build a product <li>Everything should be in the repository </li><ul><li>Source Code, Configuration, Database schemas </li></ul></ul>
  75. 82. Can't find booboo <ul><li>Put everything in the repository not just code
  76. 83. Everything you need to do a build should be in there </li><ul><li>test scripts
  77. 84. properties files
  78. 85. database schema
  79. 86. install scripts
  80. 87. third party libraries </li></ul></ul>
  81. 88. <ul><li>Static Configurations </li><ul><li>Packages </li></ul><li>Dynamic configurations </li><ul><li>Database </li></ul><li>System Configurations </li><ul><li>Puppet </li></ul></ul>
  82. 89. <ul><li>Continuous integration
  83. 90. Integration Environments
  84. 91. Packaging
  85. 92. Configuration
  86. 93. Automated Builds and Deployments </li></ul>
  87. 95. Automated Builds <ul><li>Turning source code to a running system is complicated </li><ul><li>Typing strange commands is a waste of time </li></ul></ul>
  88. 96. Automated deployments <ul><li>Multiple environments </li><ul><li>One to run commit tests (eng)
  89. 97. One or more to run secondary tests (sandbox)
  90. 98. Production </li></ul><li>Scripts that allow you to deploy the application into any environment easily
  91. 99. Deployment procedure is the same everywhere </li></ul>
  92. 100. @flipkart fk-ops-build <ul><li>One Package that </li><ul><li>Has a config to describe environments
  93. 101. Contains Build scripts for all packages for all env
  94. 102. Monitors the svn tree for changes
  95. 103. Build new packages automatically (or manually)
  96. 104. Deploys new packages automatically (or manually) </li></ul></ul>
  97. 106. Continuous Deployment <ul><ul><li>Changes trickle down environments automatically
  98. 107. Builds succeed in all test environments
  99. 108. Elaborate test cases
  100. 109. Automatically hit production </li></ul></ul>
  101. 110. experiments <ul><li>Some teams use automated deployments till Sandbox
  102. 111. Some teams use Teamcity to do integrated builds on every commit
  103. 112. We can do continuous deployments till prod but we do not practice it in every project </li></ul>
  104. 113. Way forward <ul><li>Much tighter integration with test cases
  105. 114. Environments as Rings </li><ul><li>ENG to do unit tests
  106. 115. Sandbox to do smoke tests
  107. 116. Functional tests before push to production </li></ul></ul>
  108. 117. Resources <ul><li>Wikipedia
  109. 118. martinfowler.com </li></ul>
  110. 119. moo <ul><li>@spo0nman
  111. 120. Spo0nman on freenode #linux-india #perl #debian </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×