One-Click Deployment with Jenkins

13,473 views

Published on

PHP Barcelona 2011

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
13,473
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
108
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

One-Click Deployment with Jenkins

  1. 1. One-Click Deploymentwith JenkinsFlorian Anderiasch I October 28, 2011 © Mayflower GmbH 2010
  2. 2. Who am I? Mayflower GmbH I 2
  3. 3. Developer Ex-Admin DevOp?„I rant a lot“@anderiaschstay in touch! Mayflower GmbH I 3
  4. 4. Who are you? Mayflower GmbH I 4
  5. 5. Developers? Mayflower GmbH I 5
  6. 6. Admins? Mayflower GmbH I 6
  7. 7. ContinuousIntegration? Mayflower GmbH I 7
  8. 8. How oftendo yourelease? Mayflower GmbH I 8
  9. 9. 6-12 months? Mayflower GmbH I 9
  10. 10. 1-6 months? Mayflower GmbH I 10
  11. 11. 2-4 weeks? Mayflower GmbH I 11
  12. 12. 1-14 days? Mayflower GmbH I 12
  13. 13. 1-24 hours? Mayflower GmbH I 13
  14. 14. Less than 15 minutes? Mayflower GmbH I 14
  15. 15. 15 minutes! Mayflower GmbH I 15
  16. 16. Why One-ClickDeployment? Mayflower GmbH I 16
  17. 17. Everything ismoving faster. Mayflower GmbH I 17
  18. 18. React faster touser feedback React faster to user feedback Mayflower GmbH I 18
  19. 19. Faster ROITime to market Mayflower GmbH I 19
  20. 20. Developers are lazy. Continuous Improvement in PHP Projects I Mayflower GmbH I 20
  21. 21. Basic requirements Mayflower GmbH I 21
  22. 22. Agile softwaredevelopment Mayflower GmbH I 22
  23. 23. Scrum or Kanban Mayflower GmbH I 23
  24. 24. Test DrivenDevelopment Mayflower GmbH I 24
  25. 25. ContinuousIntegration Mayflower GmbH I 25
  26. 26. Integrating the fresh parts of code into the application at least daily Mayflower GmbH I 26
  27. 27. ContinuousInspection Mayflower GmbH I 27
  28. 28. instantfeedback Mayflower GmbH I 28
  29. 29. Refactoring Mayflower GmbH I 29
  30. 30. ContinuousDeployment Mayflower GmbH I 30
  31. 31. Reproducable results Mayflower GmbH I 31
  32. 32. There arepracticesyou want to avoid Mayflower GmbH I 32
  33. 33. Having your SVN repo in yourwebservers docroot. Mayflower GmbH I 33
  34. 34. Using SSH and vi andyour root account on the live server. Mayflower GmbH I 34
  35. 35. Whos still doing this? :-) Mayflower GmbH I 35
  36. 36. Mayflower GmbH I 36
  37. 37. What do we need? Mayflower GmbH I 37
  38. 38. First of all:centralizedbuild server Mayflower GmbH I 38
  39. 39. There are plenty:CruiseControl/phpUC Bamboo buildbot Mayflower GmbH I 39
  40. 40. tests are runningall the time Mayflower GmbH I 40
  41. 41. Mayflower GmbH I 41
  42. 42. Repeatedly running tests Mayflower GmbH I 42
  43. 43. Advantages Mayflower GmbH I 43
  44. 44. Information available at onesingle point Mayflower GmbH I 44
  45. 45. find errors Mayflower GmbH I 45
  46. 46. andfix them quickly Mayflower GmbH I 46
  47. 47. Metrics Mayflower GmbH I 47
  48. 48. Dashboards Mayflower GmbH I 48
  49. 49. Awareness Mayflower GmbH I 49
  50. 50. Awareness! Mayflower GmbH I 50
  51. 51. Continuous integration in PHP projects Mayflower GmbH I 51
  52. 52. Continuous Integration in PHP projects Mayflower GmbH I 52
  53. 53. PHPUnitDocBlox Mayflower GmbH I 53
  54. 54. Continuous Inspection in PHP projects Mayflower GmbH I 54
  55. 55. PHP_CodeSniffer PHP_Depend PHPMD phpcpd jslint Mayflower GmbH I 55
  56. 56. Infrastructure Mayflower GmbH I 56
  57. 57. Mayflower GmbH I 57
  58. 58. Mayflower GmbH I 58
  59. 59. One Ubuntu package to rule them all. Continuous Improvement in PHP Projects I Mayflower GmbH I 59
  60. 60. Developer VMUbuntu 11.04 Mayflower GmbH I 60
  61. 61. Jenkins: Dev-VMTesting: Dev-VM Ubuntu 11.04 Mayflower GmbH I 61
  62. 62. Staging VMs: Frontend: Ubuntu 11.04Backend: Ubuntu 10.04 LTS(bad idea, use one version) Mayflower GmbH I 62
  63. 63. Amazon AWS live: Frontend: Ubuntu 11.04Backend: Ubuntu 10.04 LTS Mayflower GmbH I 63
  64. 64. Frontend Nodes Varnish nginxPHP 5.3 with APCZend Framework 1.11 Dojo 1.6 Doctrine2.1 Mayflower GmbH I 64
  65. 65. Backend NodesMySQL Master/Slave Apache SolrGearman/RabbitMQ memcached ejabberd Mayflower GmbH I 65
  66. 66. Development workflow Mayflower GmbH I 66
  67. 67. 1. developer commits code2. post commit hook: build3. checks4. packaging a .deb5. (deploy to STAGING)6. (deploy to LIVE) Mayflower GmbH I 67
  68. 68. <project> <property /> <target name=“build“></target> <target name=“clean“></target> <target name=“phpunit“></target> <target name=“deploy-to-staging“></target></project> Mayflower GmbH I 68
  69. 69. <target name="phpunit" depends="db-test" description="Run all tests"> <exec executable="phpunit" failonerror="true"> <arg line="--configuration${basedir}/tests/phpunit-verbose.xml${basedir}/tests/AllTests.php" /> </exec> </target> Mayflower GmbH I 69
  70. 70. „ant build“ ant sync ant clean ant db-upant parallelTasks ant phpunit ant phpcb ant build-deb Mayflower GmbH I 70
  71. 71. „ant parallelTasks“ ant phpmd ant phpdoc ant phpcpd ant phpcs ant jslint Mayflower GmbH I 71
  72. 72. „build-deb“ git pull ant phpunit ant clean ant compilejs ant compilecss Mayflower GmbH I 72
  73. 73. „deploy-to-staging“ ant deb-sign ant db-staging-up scp to all hosts Mayflower GmbH I 73
  74. 74. „deploy-to-live“fetch known-good .deb scp to all hosts there is no step 3 Mayflower GmbH I 74
  75. 75. Disadvantages and problems Mayflower GmbH I 75
  76. 76. Build time15 min on harddisk massive disk i/o 4 min on ramdisk Mayflower GmbH I 76
  77. 77. Complex setup Mayflower GmbH I 77
  78. 78. Jenkins:Single point of failure! Mayflower GmbH I 78
  79. 79. Goodies Mayflower GmbH I 79
  80. 80. everyonecan deploy (including the product owner) Mayflower GmbH I 80
  81. 81. git bisect start$BAD $GOOD Mayflower GmbH I 81
  82. 82. 30min frombugreport to deploy Mayflower GmbH I 82
  83. 83. We can still dohotfixes in this environment Mayflower GmbH I 83
  84. 84. plotting plugin (gitstats) Mayflower GmbH I 84
  85. 85. Mayflower GmbH I 85
  86. 86. echo $(olddir=`pwd`;cd /media/ram/PROJECT;git log --oneline --after=$(date +%Y-%m-%d -d yesterday) --shortstat| grep --color=none "^ " | sed s,^ *,, | awkNF==7 {p+=$4;m+=$6;diff+=$4;diff-=$6;}END {printf("%d %d %dn", p, m, diff)};cd $olddir;) > gitnum.properties.allecho YVALUE=$(cat gitnum.properties.all | cut -d -f1) >> gitnum.properties.plus Mayflower GmbH I 86
  87. 87. Jenkins Plugin:Chuck Norris Mayflower GmbH I 87
  88. 88. Questions? Mayflower GmbH I 88
  89. 89. Thanks for listening! Contact Florian Anderiasch florian.anderiasch@mayflower.de +49 89 242054 1134 @anderiasch Mayflower GmbH Mannhardtstrasse 629.10.11 80538 München Mayflower GmbH 89
  90. 90. ImagesVader (42), Sebastian Bergmann, CC-BY-SA http://www.flickr.com/photos/sebastian_bergmann/2282734669 Clouds (52), John Mueller, CC-BY-NC-ND http://www.flickr.com/photos/johnmueller/52621490/ Mayflower GmbH I 90
  91. 91. Cinder Connecting CI server and IDE Help is welcomehttp://github.com/winks/cinder needs XML from phpuc/hudson/bamboo and nothing else :) Mayflower GmbH I 91

×