Download - Continous PHP Pipeline - ZendCon 2014

Transcript
Page 1: Continous PHP Pipeline - ZendCon 2014

2

The  Con(nuous  PHP  PipelineZendCon  2014,  Santa  Clara

Page 2: Continous PHP Pipeline - ZendCon 2014

Michelangelo  van  Dam

2

Page 3: Continous PHP Pipeline - ZendCon 2014

Schedule

• Development  processes  • Automa;on  first  • Con;nuous  Integra;on  • The  PHP  Pipeline  • Do  what  you  do  best:  code  • Round  up

3

Page 4: Continous PHP Pipeline - ZendCon 2014

Required  knowledge

• Working  with  an  SCM  • Unit  tes;ng  • Distributed  architectures  • Provisioning  plaMorms  • Have  experienced  troubled  releases

4

Page 5: Continous PHP Pipeline - ZendCon 2014

Development  management

5

http

s://w

ww.

flick

r.com

/pho

tos/

2743

3628

@N

05/2

5973

0832

8

Page 6: Continous PHP Pipeline - ZendCon 2014

Project  flow:  Waterfall

6

Project Start

Kick-off meetingDefining Approach

Meeting Execs

Project Initiate

Business CasesProject ControlsRisk Definition

Project Control

Progress Monitoring

Project Delivery

Project finalisation

Maintenance

Ongoing process

Page 7: Continous PHP Pipeline - ZendCon 2014

Project  flow:  Scrum

7

Weeklybacklog review

Dailystandups

Product Backlog

AcceptanceCriteria

Sprint Backlog Prototype Delivery

Product Backlog

Product BacklogProduct

Backlog

Sprint

Page 8: Continous PHP Pipeline - ZendCon 2014

Project  flow:  something…

8

Project Requirements

Ad-hockIssues

TaskAssignment Delivery

Page 9: Continous PHP Pipeline - ZendCon 2014

Common:  delivery

9

Weeklybacklog review

Dailystandups

Product Backlog

AcceptanceCriteria

Sprint Backlog Prototype Delivery

Product Backlog

Product BacklogProduct

Backlog

Sprint

Project Start

Kick-off meetingDefining Approach

Meeting Execs

Project Initiate

Business CasesProject ControlsRisk Definition

Project Control

Progress Monitoring

Project Delivery

Project finalisation

Maintenance

Ongoing process

Project Requirements

Ad-hockIssues

TaskAssignment Delivery

Delivery

Page 10: Continous PHP Pipeline - ZendCon 2014

Delivery  event!

• Off-­‐hours  release  planning  • Set  up  a  maintenance  page  • Pre-­‐release  ac;ons  (backups,  stopping  crons,  …)  • Release  checklist  -­‐>  manual  deployment  • Post-­‐release  ac;ons  (crons,  caches,  …)  • Removing  maintenance  page  • Manually  verify  everything  is  working  (old  &  new  stuff)  • If  lucky,  going  home  for  the  night

10

Page 11: Continous PHP Pipeline - ZendCon 2014

A  nightmare

11

http

s://w

ww.

flick

r.com

/pho

tos/

bern

atcg

/223

1649

285

Page 12: Continous PHP Pipeline - ZendCon 2014

Automa(on  first!

12

http

s://w

ww.

flick

r.com

/pho

tos/

freef

oto/

5982

5499

38

Page 13: Continous PHP Pipeline - ZendCon 2014

Computers  are  great  at  doing  repe((ve  task  very  well

13

Page 14: Continous PHP Pipeline - ZendCon 2014

Iden(fying  the  players

14

Development

Source Code

Static Files

Database Deltas

Platform

Monitoring Database

Storage Workers Caches

Web Server

Infrastructure

Bare Metal

Virtual Machines Cloud

Page 15: Continous PHP Pipeline - ZendCon 2014

Infrastructure

15

Infrastructure

Bare Metal

Virtual Machines Cloud

Page 16: Continous PHP Pipeline - ZendCon 2014

PlaJorm

16

Platform

Monitoring Database

Storage Workers Caches

Web Server

Page 17: Continous PHP Pipeline - ZendCon 2014

Automa(ng  tools

17

https://www.gnu.org/graphics/heckert_gnu.small.png

Page 18: Continous PHP Pipeline - ZendCon 2014

Why  automate  plaJorm?

• It  should  be  op;mised  to  run  your  applica;on  • Con;nuous  updates  and  tweaks  possible  • SeXng  up  your  architecture  in  a  consistent  way  

• For  produc;on  • For  staging  • For  tes;ng  • For  development

18

Page 19: Continous PHP Pipeline - ZendCon 2014

Choose  wisely

19

http

s://w

ww.

flick

r.com

/pho

tos/

keep

itsur

real

/610

7919

083

Page 20: Continous PHP Pipeline - ZendCon 2014

Give  Docker  a  try

• Requires  no  virtualisa;on  so[ware  • Saves  on  resources!  

• Allows  to  set  up  a  distributed  architecture  • Even  for  development  purposes  

• Isolates  processes  in  a  container  • Helps  with  securing  infrastructure

20

Page 21: Continous PHP Pipeline - ZendCon 2014

Vagrant  up

21

Monitoring Database

Storage Workers Caches

Web Server

Page 22: Continous PHP Pipeline - ZendCon 2014

Development

22

Development

Source Code

Static Files

Database Deltas

Page 23: Continous PHP Pipeline - ZendCon 2014

SCM  is  a  must!

23

Page 24: Continous PHP Pipeline - ZendCon 2014

FTP  is  not  SCM!!!

24

Page 25: Continous PHP Pipeline - ZendCon 2014

Commit  and  push

25

Page 26: Continous PHP Pipeline - ZendCon 2014

Con(nuous  Integra(on

26

http

s://w

ww.

flick

r.com

/pho

tos/

mab

i/383

0712

4

Page 27: Continous PHP Pipeline - ZendCon 2014

Most  common  CI  systems

27

Page 28: Continous PHP Pipeline - ZendCon 2014

Why  CI?

• Monitors  con;nuously  • Executes  directly  a[er  change  • Gives  feedback  • Has  dashboards  • Automate  post-­‐development  processes

28

http

s://w

ww.

flick

r.com

/pho

tos/

ambe

rand

clin

t/326

6859

324

Page 29: Continous PHP Pipeline - ZendCon 2014

CI  takes  care  of  you

29

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

Page 30: Continous PHP Pipeline - ZendCon 2014

The  PHP  Pipeline

30

http

s://w

ww.

flick

r.com

/pho

tos/

mm

mav

ocad

o/45

9739

7875

Page 31: Continous PHP Pipeline - ZendCon 2014

Priori(se  build  steps

31

Unit tests Metrics

Provisioningnew target

Provisioningdatabases

Provisioningworkers

Integrationtests

Promotebranch

CI

Page 32: Continous PHP Pipeline - ZendCon 2014

Stop  execu(on  at  first  fail

32

Unit tests Metrics

Provisioningnew target

Provisioningdatabases

Provisioningworkers

Integrationtests

Promotebranch

CI

Page 33: Continous PHP Pipeline - ZendCon 2014

When  good,  promote

33

Unit tests Metrics

Provisioningnew target

Provisioningdatabases

Provisioningworkers

Integrationtests

Promotebranch

CI

Unit tests Metrics

Provisioningnew target

Provisioningdatabases

Provisioningworkers

Integrationtests

Promotebranch

CI

Page 34: Continous PHP Pipeline - ZendCon 2014

Con(nuous  Delivery

34

Build Feedback

Build Feedback

SCMCommits SCM Change

Polling

Deployment ManagementDashboard

test

staging

production

Page 35: Continous PHP Pipeline - ZendCon 2014

Con(nuous  Deployment

35

Build Feedback

Execute Delivery

SCMCommits SCM Change

Pollingtest

staging

production

Page 36: Continous PHP Pipeline - ZendCon 2014

What’s  the  difference?

36

Source: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment

Page 37: Continous PHP Pipeline - ZendCon 2014

Do  what  you  do  best:  code!

37

http

s://w

ww.

flick

r.com

/pho

tos/

ihta

tho/

6272

2631

5

Page 38: Continous PHP Pipeline - ZendCon 2014

The  benefit

38

Page 39: Continous PHP Pipeline - ZendCon 2014

Failures  happen

39

Page 40: Continous PHP Pipeline - ZendCon 2014

Overview  of  our  tools

40

Page 41: Continous PHP Pipeline - ZendCon 2014

Rounding  up

41

http

s://w

ww.

flick

r.com

/pho

tos/

timyp

enbu

rg/5

1720

4200

7

Page 42: Continous PHP Pipeline - ZendCon 2014

Build  your  own  pipeline

• 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!  • Con;nuously  improve  

• On  your  code  • On  your  processes

42

Page 43: Continous PHP Pipeline - ZendCon 2014

Recommended  reading

43

Page 44: Continous PHP Pipeline - ZendCon 2014

44

Page 45: Continous PHP Pipeline - ZendCon 2014

45

joind.in/12053

Slides will be available here, please leave feedback !

If you like it, thanks! If you don’t, tell me how to improve this talk

Page 46: Continous PHP Pipeline - ZendCon 2014

Ques(ons?

46

Page 47: Continous PHP Pipeline - ZendCon 2014

Thank  you

47

in it2PROFESSIONAL PHP SERVICES

Michelangelo van Dam!Zend Certified Engineer

PHP Consulting - Training - Quality Assurance

www.in2it.be | [email protected]