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.
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
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
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
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
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
39. Prioritise build steps
Unit tests Metrics
Provisioning
new target
Provisioning
databases
Provisioning
workers
Integration
tests
Promote
branch
CI
40. Stop execution at first fail
Unit tests Metrics
Provisioning
new target
Provisioning
databases
Provisioning
workers
Integration
tests
Promote
branch
CI
41. 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
42. Delivery vs Deployment
Source: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
51. 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
53. 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