Continuous Integration and
Deployment with PHP
Samantha Quiñones - DCPHP Meetup - June 11, 2013
Slide 2
Slide 2 text
About Me
Samantha Quiñones
http://about.me/samantha.quinones
[email protected]
@ieatkillerbees
Slide 3
Slide 3 text
My Awesome Job
(HELP WANTED!)
Slide 4
Slide 4 text
What is CI/CD?
● Frequent builds
● Automated build/test/release
● Hands-off deployment
Slide 5
Slide 5 text
But first...
Slide 6
Slide 6 text
T
ypical Build Process
● Update config files
● Create SQL scripts to update the DB
● Run tests
Slide 7
Slide 7 text
T
ypical Deployment Process
● (S)FTP
● git pull / svn update
● rsync
Slide 8
Slide 8 text
T
ypical Deployment Process
● (S)FTP
● git pull / svn update
● rsync
Slide 9
Slide 9 text
T
ypical Deployment Process
Slide 10
Slide 10 text
Building & Pushing by Hand Sucks
● Error prone
● Encourages dirty hacks
● Time-consuming
● Integration Hell
Slide 11
Slide 11 text
Building & Pushing by Hand Sucks
Slide 12
Slide 12 text
You might have a deployment
problem if...
● “I don't know, it worked on my machine.”
● “Who deployed X? X wasn't ready for prod!”
● “Well, in production, you have to...”
● PackageRepository_20130313.php
Slide 13
Slide 13 text
Continuous Integration
(one better way)
● Practice of Extreme/Agile Programming
● Martin Fowler & Kent Beck
Slide 14
Slide 14 text
What's the Point?
● Build one thing & integrate it immediately
● When an enhancement is made, software is
ready to ship
● Building is automated and repeatable
Automate Database Changes
● If you use an RDBMS and don't use a migration tool,
start!
● Many major frameworks
● Liquibase, dbdeploy, alembic (it's not just for
python!)
Slide 19
Slide 19 text
What Does a Good Build Look Like?
● Tests Pass
● Code Coverage
● Coding Standards
● Static Analysis
● Documentation
Slide 20
Slide 20 text
Choose Your Weapon
Slide 21
Slide 21 text
Discover Problems Quickly
Slide 22
Slide 22 text
Build History and Data
Slide 23
Slide 23 text
Enforce Use of QA Tools
Slide 24
Slide 24 text
ABCs of Continuous Deployment
A lways
B e
s C ipping
(Anglo-Saxons need love too!)
Slide 25
Slide 25 text
Deployment is Tricky
● Deploy Test Commit or Rollback
→ →
● Versioned directories & symlinks
Slide 26
Slide 26 text
It's 3 am.
Do you know where your hackers are?
● When deployments fail, back them out!
● Fixing code in production is a terrible idea
● Missing a deadline sucks. Releasing crappy
code sucks more.
Slide 27
Slide 27 text
Don't Be a Cowboy
Slide 28
Slide 28 text
The Beating Agile Heart
User story Enhancement Release
→ →
● Testable, reproducible results
● Be confident in your product
● Give end-users a window in to dev cycle
Slide 29
Slide 29 text
Next Steps?
● “Continuous Integration” by Martin Fowler
http://bit.ly/KEgGa
● Chris Hartjes' Grumpy Learning
http://bit.ly/11fxCcY
● Marcelo Gornstein's Blog
http://bit.ly/192nVCw
● Email or tweet me!