Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Continuous
PHP Pipeline
in it2PROFESSIONAL PHP SERVICES
Michelangelo van Dam
PHP Consultant, Community Leader & Trainer
https://www.flickr.com/photos/akrabat/8784318813
Schedule
• Development processes
• Automation first
• Continuous Integration
• The PHP Pipeline
• Do what you do best: code...
Knowledge Check
• What’s PHP?
• What’s a SCM?
• What’s unit testing?
• What are distributed systems?
• What is provisionin...
Development Management
https://www.flickr.com/photos/27433628@N05/2597308328
Waterfall
Project Start
Kick-off meeting
Defining Approach
Meeting Execs
Project Initiate
Business Cases
Project Controls
R...
Scrum
Weekly
backlog review
Daily
standups
Product
Backlog
Acceptance
Criteria
Sprint
Backlog
Prototype Delivery
Product
B...
Something (ad-hock)
Project
Requirements
Ad-hock
Issues
Task
Assignment
Delivery
Need to deliver
Weekly
backlog review
Daily
standups
Product
Backlog
Acceptance
Criteria
Sprint
Backlog
Prototype Delivery...
Delivery “event”
• Off-hours release planning
• Set up a maintenance page
• Pre-release actions (backups, stopping crons, ...
A nightmare
https://www.flickr.com/photos/bernatcg/2231649285
Automation First
https://www.flickr.com/photos/freefoto/5982549938
Computers are great at doing
repetitive task very well
Development
Source
Code
Static
Files
Database
Deltas
Platform
Monitoring Database
Storage Workers Caches
Web
Server
Infras...
Infrastructure
Bare
Metal
Virtual
Machines
Cloud
Infrastructure
https://www.gnu.org/graphics/heckert_gnu.small.png
Hosting Providers
On Premise
Cloud Solution Providers
A “simple” architecture
Web Web
Proxy Proxy Proxy
DB Slave DB Slave DB Slave DB Slave
DB Master DB Master
NoSQL NoSQL NoSQ...
Are you ready?
Things get very complex very fast
https://www.flickr.com/photos/mariano-mantel/9194344268
Platform
Monitoring Database
Storage Workers Caches
Web
Server
Automation tools
https://www.gnu.org/graphics/heckert_gnu.small.png
Why automate platform?
• It should be optimised to run your application
• Continuous updates and tweaks possible
• Setting...
Choose wisely
https://www.flickr.com/photos/keepitsurreal/6107919083
Give Docker a try
• Requires no virtualisation software
• Saves on resources!
• Allows to set up a distributed architectur...
Vagrant up
Monitoring Database
Storage Workers Caches
Web
Server
Development
Source
Code
Static
Files
Database
Deltas
SCM is a must!
FTP is not a SCM
Commit and push
https://www.flickr.com/photos/mabi/38307124
Why CI?
• Monitors continuously
• Executes directly after change
• Gives feedback
• Has dashboards
• Automate post-develop...
CI takes care of your code
Pre build steps!
- Stop crons, queues and workers
- Remove target from load balancer
Build step...
Common CI systems
Online CI systems
The PHP Pipeline
https://www.flickr.com/photos/mmmavocado/4597397875
Prioritise build steps
Unit tests Metrics
Provisioning
new target
Provisioning
databases
Provisioning
workers
Integration
...
Stop execution at first fail
Unit tests Metrics
Provisioning
new target
Provisioning
databases
Provisioning
workers
Integra...
When good, promote!
Unit tests Metrics
Provisioning
new target
Provisioning
databases
Provisioning
workers
Integration
tes...
Delivery vs Deployment
Source: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
Continuous Delivery
Build Feedback
Build Feedback
SCM
Commits SCM Change
Polling
Deployment Management
Dashboard
test
stag...
Continuous Deployment
Build Feedback
Execute Delivery
SCM
Commits SCM Change
Polling
test
staging
production
All code is live!
    if ($application->getFeature('myawesomefeature')->isComplete()) { "
!
        // Here comes the new ...
Other usages
• A/B Testing
• Partial based roll-out (GeoLocation, Age, Gender)
• SaaS premium features
• Automated assiste...
https://www.flickr.com/photos/ihtatho/627226315
Benefits
Failures do happen
Our tools
Our Stats
Total commits today 129
Total releases 118
Total failures 11
Total DB deployments 4
Average failure resolution t...
https://www.flickr.com/photos/timypenburg/5172042007
Your turn now!
• Automate everything that’s not coding
• Create repeatable, reliable processes
• Fail as quickly as possib...
Recommended Reading
in it2PROFESSIONAL PHP SERVICES
Michelangelo van Dam!
Zend Certified Engineer
PHP Consulting - Training - Quality Assurance...
https://www.flickr.com/photos/56218409@N03/15371262455
The Continuous PHP Pipeline
The Continuous PHP Pipeline
The Continuous PHP Pipeline
The Continuous PHP Pipeline
The Continuous PHP Pipeline
Upcoming SlideShare
Loading in …5
×

The Continuous PHP Pipeline

5,386 views

Published on

You've got your tests, your metrics, your database migrations and your system provisioning automated, but how can you deploy everything with a push of a button and not be scared something goes wrong? Welcome to the continuous PHP Pipeline. In this talk I take the code, the tests, the metrics and the provisioners and show you how you can have a continuous delivery pipeline setup based on certain criteria you define upfront, your code gets automatically deployed to staging or to production with all the arbitrary tasks along with it. Never get stressed again about deployments. Make deployments as easy as committing to your repository and get home on time to enjoy your well deserved weekend.

Published in: Engineering

The Continuous PHP Pipeline

  1. 1. Continuous PHP Pipeline in it2PROFESSIONAL PHP SERVICES
  2. 2. Michelangelo van Dam PHP Consultant, Community Leader & Trainer https://www.flickr.com/photos/akrabat/8784318813
  3. 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. 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. 5. Development Management https://www.flickr.com/photos/27433628@N05/2597308328
  6. 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. 7. Scrum Weekly backlog review Daily standups Product Backlog Acceptance Criteria Sprint Backlog Prototype Delivery Product Backlog Product BacklogProduct Backlog Sprint
  8. 8. Something (ad-hock) Project Requirements Ad-hock Issues Task Assignment Delivery
  9. 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. 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. 11. A nightmare https://www.flickr.com/photos/bernatcg/2231649285
  12. 12. Automation First https://www.flickr.com/photos/freefoto/5982549938
  13. 13. Computers are great at doing repetitive task very well
  14. 14. Development Source Code Static Files Database Deltas Platform Monitoring Database Storage Workers Caches Web Server Infrastructure Bare Metal Virtual Machines Cloud
  15. 15. Infrastructure Bare Metal Virtual Machines Cloud
  16. 16. Infrastructure https://www.gnu.org/graphics/heckert_gnu.small.png Hosting Providers On Premise Cloud Solution Providers
  17. 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. 18. Are you ready? Things get very complex very fast https://www.flickr.com/photos/mariano-mantel/9194344268
  19. 19. Platform Monitoring Database Storage Workers Caches Web Server
  20. 20. Automation tools https://www.gnu.org/graphics/heckert_gnu.small.png
  21. 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. 22. Choose wisely https://www.flickr.com/photos/keepitsurreal/6107919083
  23. 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. 24. Vagrant up Monitoring Database Storage Workers Caches Web Server
  25. 25. Development Source Code Static Files Database Deltas
  26. 26. SCM is a must!
  27. 27. FTP is not a SCM
  28. 28. Commit and push
  29. 29. https://www.flickr.com/photos/mabi/38307124
  30. 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. 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. 32. Common CI systems
  33. 33. Online CI systems
  34. 34. The PHP Pipeline https://www.flickr.com/photos/mmmavocado/4597397875
  35. 35. Prioritise build steps Unit tests Metrics Provisioning new target Provisioning databases Provisioning workers Integration tests Promote branch CI
  36. 36. Stop execution at first fail Unit tests Metrics Provisioning new target Provisioning databases Provisioning workers Integration tests Promote branch CI
  37. 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. 38. Delivery vs Deployment Source: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
  39. 39. Continuous Delivery Build Feedback Build Feedback SCM Commits SCM Change Polling Deployment Management Dashboard test staging production
  40. 40. Continuous Deployment Build Feedback Execute Delivery SCM Commits SCM Change Polling test staging production
  41. 41. All code is live!     if ($application->getFeature('myawesomefeature')->isComplete()) { " !         // Here comes the new feature functionality " !     }
  42. 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. 43. https://www.flickr.com/photos/ihtatho/627226315
  44. 44. Benefits
  45. 45. Failures do happen
  46. 46. Our tools
  47. 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. 48. https://www.flickr.com/photos/timypenburg/5172042007
  49. 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. 50. Recommended Reading
  51. 51. in it2PROFESSIONAL PHP SERVICES Michelangelo van Dam! Zend Certified Engineer PHP Consulting - Training - Quality Assurance www.in2it.be | contact@in2it.be
  52. 52. https://www.flickr.com/photos/56218409@N03/15371262455

×