2013 09 drupalcamp leuven deployments en workflow

549 views

Published on

Deployments and workflow
Drupalcamp Leuven 2013

Frederik Wouters

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

  • Be the first to like this

No Downloads
Views
Total views
549
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2013 09 drupalcamp leuven deployments en workflow

  1. 1. Deployments & workflow Frederik Wouters
  2. 2. Who am I
  3. 3. Frederik Wouters • Drupal user profile since 2010 • Create issues/patches on d.o. • Freelance Drupal 6/7 • Working for Q-music at the moment
  4. 4. Agenda - Working alone - Working in a small team - Working in a large team - Releases and Deployments - Workflow models
  5. 5. IF YOU ARE ALONE It’s just you and the server
  6. 6. FTP SSH …
  7. 7. Client wants a change • Look at code • Make change • Upload Code • It’s not complicated • No overhead • If feels good • Always up to date What can go wrong?
  8. 8. Working in a small team?
  9. 9. Some teams FTP SSH … DEV DEV DEV
  10. 10. Client want changes • Get code from ftp • Make changes • Upload • It’s not complicated • No overhead • If feels good • Always up to date
  11. 11. CODE IS LOST You knew it was coming
  12. 12. HELLO VCS FTP / SSH / … DEV DEV LEAD
  13. 13. Client want changes • Check out latest version • Make changes to master • Commit • Deployer deploys
  14. 14. MULTIPLE DEVELOPERS No problem
  15. 15. TL;DR Prepare for scaling, even if you’re alone Use git
  16. 16. Working in a bigger team
  17. 17. Assume • Production / Acceptance / Dev environment • Code is tested before Acceptance • Multiple people are working on several features at the same time.
  18. 18. Concept: BRANCHES
  19. 19. Client want changes Hotfix • Check out acc/prd • Make changes • Commit • checkout dev/acc • Cherry pick • Commit Feature • Check out dev • Make changes • Commit
  20. 20. HOW TO IMPROVE • Deployment • Workflow
  21. 21. DEPLOYMENT
  22. 22. How do the big fish deploy? Facebook Code is compiled to one big executable This blob is deployed with bittorrent Twitter “Murder” (Capistrano + optimised bittorrent) Google YADT : yaml datacenter management
  23. 23. DEPLOYING TO PRODUCTION I merged branches
  24. 24. Automate deployments No matter what your workflow is, you will always profit from automatic deployments Frederik Wouters
  25. 25. Automate deployments • Jenkins – Open source (dev’s love it) – A lot of components • Capistrano – Open source (Ruby devs love it) – Command line • Bamboo – Integrated with Jira (PM’s love it) – Nice issue tracking and all
  26. 26. Commit based deployment • Github • Bitbucket Committing will trigger a build of a specific branch to a specific environment. https://github.com/wieni/jenbucket
  27. 27. How to set it up? Github/bitbucket hook: • Github:
  28. 28. How to set it up? • Apt-get install jenkins • Install some plugins – ftp publisher – Ssh publisher – Ssh credentials – Git client – Google calendar – Html5 notifier – Jquery – Mailer – Subversion – Workspace cleanup – ….
  29. 29. How to set it up? Job conf: • Enter your git repo • Add build config – Build a tarball from codebase – Ssh publish the code – Create DB dump before – Symlink of files directory between deployments – Save a copy of prev codebase (just in case) – Drush updb, cc , fra , dis devel etc…
  30. 30. Config + deploy demo • LIVE DEMO
  31. 31. Commit based deployment • What is my current version? • Bitbucket Provide a page where you can put your jenkins url. Committing will then trigger a build of a specific Job. https://drupal.org/sandbox/wouters_frederik/1979636
  32. 32. I COMMITTED MY CODE It’s on dev, because it’s good
  33. 33. WORKFLOW
  34. 34. • Waterfall – Conception – Initiation – Analysis – Design – Construction – Testing – Implementation – Maintenance • Scrum – Agile – Sprint Backlog – 30 days sprint – Test – Release – Repeat • CI – Build test self – Commit to base – Build fast – Build + Test every commit Overview
  35. 35. Advantages • Waterfall – Deliverables for every Phase – Complete 1 thing at a time • Scrum – Agile – Rapid delivery – Changes in requirements are ok – 30 days of awesome • CI – Early warnings of broken code – Immediate testing of all changes – Write less complex code (frequent checkins)
  36. 36. Implementation • Waterfall – Work on master branch for entire project. • Scrum – Agile – Production branch – Hotfixes – Dev branch per Release of 30 days. • CI – Commit to master – Write code with feature toggles – Each change must be testeable / releasable
  37. 37. How do the big fish do it? Facebook Moving fast and breaking things Major deploy every Tuesday Two minor deploys every day Conflicts are to be sold by Tuesday 12.00 Twitter Each feature/bugfix lives in its branch, branches are selected for deploy, tested and merged. This gives more merge conflicts. Google The release goes out on time. If a feature isn't ready, it just gets moved to the next release. Features that are not ready can be disabled (hidden) Everyone works most of the time on one main branch
  38. 38. CI is hot Be sure to • Automate the build • Make your build self testing • Commit to the main line every day • Every commit should build to dev • Keep the build fast • Test a clone of production
  39. 39. What worked for my bigger projects • Using jenkins • scrum • Working in sprint branches • Client tests --a lot--
  40. 40. What works for you? • Small team, small changes, commit often, release often • Big Team, big Features… Consider a x days sprint and release branches. • …
  41. 41. TL;DR Deploy without user interaction Find a workflow that suits your project Prepare for scaling
  42. 42. Graphics http://nvie.com/posts/a-successful-git-branching-model/ Chuck Norris and friends
  43. 43. Contact me @drupal_sensei wouters.f@gmail.co m

×