Advertisement

The Continuous PHP Pipeline

Senior PHP architect & QA Specialist at In2IT
May. 12, 2015
Advertisement

More Related Content

Advertisement
Advertisement

The Continuous PHP Pipeline

  1. Continuous PHP Pipeline in it2PROFESSIONAL PHP SERVICES
  2. Michelangelo van Dam PHP Consultant, Community Leader & Trainer https://www.flickr.com/photos/akrabat/8784318813
  3. Schedule • Development processes • Automation first • Continuous Integration • The PHP Pipeline • Do what you do best: code • Round up https://www.flickr.com/photos/wenzday01/3005297355
  4. Knowledge Check • What’s PHP? • What’s a SCM? • What’s unit testing? • What are distributed systems? • What is provisioning? • What are merge conflicts? https://www.flickr.com/photos/didmyself/6530383417
  5. Development Management https://www.flickr.com/photos/27433628@N05/2597308328
  6. Waterfall Project Start Kick-off meeting Defining Approach Meeting Execs Project Initiate Business Cases Project Controls Risk Definition Project Control Progress Monitoring Project Delivery Project finalisation Maintenance Ongoing process
  7. Scrum Weekly backlog review Daily standups Product Backlog Acceptance Criteria Sprint Backlog Prototype Delivery Product Backlog Product BacklogProduct Backlog Sprint
  8. Something (ad-hock) Project Requirements Ad-hock Issues Task Assignment Delivery
  9. Need to deliver Weekly backlog review Daily standups Product Backlog Acceptance Criteria Sprint Backlog Prototype Delivery Product Backlog Product BacklogProduct Backlog Sprint Project Start Kick-off meeting Defining Approach Meeting Execs Project Initiate Business Cases Project Controls Risk Definition Project Control Progress Monitoring Project Delivery Project finalisation Maintenance Ongoing process Project Requirements Ad-hock Issues Task Assignment Delivery Delivery
  10. Delivery “event” • Off-hours release planning • Set up a maintenance page • Pre-release actions (backups, stopping crons, …) • Release checklist -> manual deployment • Post-release actions (crons, caches, …) • Removing maintenance page • Manually verify everything is working (old & new) • If lucky, going home for the night/morning
  11. A nightmare https://www.flickr.com/photos/bernatcg/2231649285
  12. Automation First https://www.flickr.com/photos/freefoto/5982549938
  13. Computers are great at doing repetitive task very well
  14. Development Source Code Static Files Database Deltas Platform Monitoring Database Storage Workers Caches Web Server Infrastructure Bare Metal Virtual Machines Cloud
  15. Infrastructure Bare Metal Virtual Machines Cloud
  16. Infrastructure https://www.gnu.org/graphics/heckert_gnu.small.png Hosting Providers On Premise Cloud Solution Providers
  17. A “simple” architecture Web Web Proxy Proxy Proxy DB Slave DB Slave DB Slave DB Slave DB Master DB Master NoSQL NoSQL NoSQL 0MQ Mail SharedIO Web Database
  18. Are you ready? Things get very complex very fast https://www.flickr.com/photos/mariano-mantel/9194344268
  19. Platform Monitoring Database Storage Workers Caches Web Server
  20. Automation tools https://www.gnu.org/graphics/heckert_gnu.small.png
  21. Why automate platform? • It should be optimised to run your application • Continuous updates and tweaks possible • Setting up your architecture in a consistent way • For production • For staging • For testing • For development
  22. Choose wisely https://www.flickr.com/photos/keepitsurreal/6107919083
  23. Give Docker a try • Requires no virtualisation software • Saves on resources! • Allows to set up a distributed architecture • Even for development purposes • Isolates processes in a container • Helps with securing infrastructure
  24. Vagrant up Monitoring Database Storage Workers Caches Web Server
  25. Development Source Code Static Files Database Deltas
  26. SCM is a must!
  27. FTP is not a SCM
  28. Commit and push
  29. https://www.flickr.com/photos/mabi/38307124
  30. Why CI? • Monitors continuously • Executes directly after change • Gives feedback • Has dashboards • Automate post-development processes https://www.flickr.com/photos/amberandclint/3266859324
  31. CI takes care of your code Pre build steps! - Stop crons, queues and workers - Remove target from load balancer Build steps! - Check out new changes - Run unit tests - Provision target(s) - Provision databases Post build steps! - Warm up caches - Reactivate crons, queues and workers - Add target back into loadbalancer - Sent status out
  32. Common CI systems
  33. Online CI systems
  34. The PHP Pipeline https://www.flickr.com/photos/mmmavocado/4597397875
  35. Prioritise build steps Unit tests Metrics Provisioning new target Provisioning databases Provisioning workers Integration tests Promote branch CI
  36. Stop execution at first fail Unit tests Metrics Provisioning new target Provisioning databases Provisioning workers Integration tests Promote branch CI
  37. When good, promote! Unit tests Metrics Provisioning new target Provisioning databases Provisioning workers Integration tests Promote branch CI Unit tests Metrics Provisioning new target Provisioning databases Provisioning workers Integration tests Promote branch CI
  38. Delivery vs Deployment Source: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
  39. Continuous Delivery Build Feedback Build Feedback SCM Commits SCM Change Polling Deployment Management Dashboard test staging production
  40. Continuous Deployment Build Feedback Execute Delivery SCM Commits SCM Change Polling test staging production
  41. All code is live!     if ($application->getFeature('myawesomefeature')->isComplete()) { " !         // Here comes the new feature functionality " !     }
  42. Other usages • A/B Testing • Partial based roll-out (GeoLocation, Age, Gender) • SaaS premium features • Automated assisted training programs • Netflix Chaos Monkey Testing • See http://in2.se/nfchaosmonkey for details • April’s fools day fun!
  43. https://www.flickr.com/photos/ihtatho/627226315
  44. Benefits
  45. Failures do happen
  46. Our tools
  47. Our Stats Total commits today 129 Total releases 118 Total failures 11 Total DB deployments 4 Average failure resolution time (minutes) 5 Average release time (minutes) 3
  48. https://www.flickr.com/photos/timypenburg/5172042007
  49. Your turn now! • Automate everything that’s not coding • Create repeatable, reliable processes • Fail as quickly as possible • If it hurts, do it more frequently • Communicate each step • Everyone is responsible! • Continuously improve • On your code • On your processes
  50. Recommended Reading
  51. in it2PROFESSIONAL PHP SERVICES Michelangelo van Dam! Zend Certified Engineer PHP Consulting - Training - Quality Assurance www.in2it.be | contact@in2it.be
  52. https://www.flickr.com/photos/56218409@N03/15371262455
Advertisement