One click deployment with Jenkins - PHP Munich

86
© 2011 Mayflower GmbH Thorsten Rinne I 22. August 2011, München One Click Deployment with Jenkins

description

 

Transcript of One click deployment with Jenkins - PHP Munich

Page 1: One click deployment with Jenkins - PHP Munich

© 2011 Mayflower GmbH

Thorsten Rinne I 22. August 2011, München

One Click Deployment with Jenkins

Page 2: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Team LeadScrum MasterHead of Open Source Labs

@ThorstenRinne2

Page 3: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Who are you?

3

Page 4: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Developers?

4

Page 5: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Administrators?

5

Page 6: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

DevOps?

6

Page 7: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Continuous Integration?

7

Page 8: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

How much time do you need for a release?

8

Page 9: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

More than a year?

9

Page 10: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

6 - 12 months?

10

Page 11: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

1 - 6 months?

11

Page 12: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

2 - 4 weeks?

12

Page 13: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

1 - 14 days?

13

Page 14: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

1 - 24 hours?

14

Page 15: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Less than 15 minutes?

15

Page 16: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

15 Minutes!

16

Page 17: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Why One Click Deployment?

17

Page 18: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Everything is getting faster.

18

Page 19: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Faster feedback from your customer / user

19

Page 20: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Faster ROI (return on invest)

20

Page 21: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Faster responseif the market changes

21

Page 22: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Basic requirements

22

Page 23: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Agile software development

23

Page 24: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Scrum or Kanban

24

Page 25: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Test Driven Development

25

Page 26: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Continuous Integration

26

Page 27: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Continuous Inspection

27

Page 28: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Refactoring

28

Page 29: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 29

Page 30: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 29

ScrumKanban

Page 31: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 29

ScrumKanban

ContinuousIntegration

Page 32: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 29

ScrumKanban

ContinuousIntegration

ContinuousInspection

Page 33: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Continuous Deployment

29

ScrumKanban

ContinuousIntegration

ContinuousInspection

Page 34: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Things you don‘t want.

30

Page 35: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Having your SVN repo in your webserver‘s docroot.

31

Page 36: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Using SSH and vi and your root account on the live

server. Never.

32

Page 37: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Who‘s still doing this? :-)

33

Page 38: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 34

Page 39: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

What do we need?

35

Page 40: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

First: a central build server

36

Page 41: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 37

Page 42: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Continous Testing with PHPUnit

38

Page 43: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Advantages

39

Page 44: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Test results at one central page

40

Page 45: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Software metrics at one central page

41

Page 46: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Errors can be identified fast and then fixed

42

Page 47: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Awareness

43

Page 48: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 44

Awareness!

Page 49: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Continuous Integration in PHP projects

45

Page 50: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

PHPUnitphpDocumentator

PHPDox

46

Page 51: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Continuous Inspection in PHP projects

47

Page 52: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

PHPCSPHP Depend

PHPMDphpcpd

jslint

48

Page 53: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

jslint?yes!

49

Page 54: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Infrastructure

50

Page 55: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 51

Page 56: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Developer VMUbuntu 11.04

52

Page 57: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Testing VM + Jenkins VM:Ubuntu 11.04

53

Page 58: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Staging VMs:Frontend: Ubuntu 11.04

Backend: Ubuntu 10.04 LTS

54

Page 59: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

amazon AWS live:Frontend: Ubuntu 11.04

Backend: Ubuntu 10.04 LTS

55

Page 60: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Front NodesVarnishnginx

PHP 5.3 with APCZend Framework 1.11

dojo toolkitDoctrine 2.1

56

Page 61: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 57

Backend NodesMySQL Master/Slave

Apache SolrPHP 5.3 with APC

RabbitMQejabberd

Page 62: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Development workflow

58

Page 63: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

1. git workflow

59

$ git add Foo.php$ git commit -m ″Bar″$ ant jslint$ ant phpunit ...$ git push

Page 64: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

2. Post commit hook

60

Build triggered on Jenkins

Page 65: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Jenkins build checks

61

Page 66: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

PHPUnit Build:Unittests

Controller Tests (Zend_Test)PHP Code Coverage

62

Page 67: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Debian Package Build

63

Page 68: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Deploy to stagingDeploy staging to live

64

Page 69: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

What is a build process?

65

Page 70: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

ant syncant clean

ant db-updateparallelTasks:

ant phpunitant phpcbant deb

66

Page 71: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

parallelTasks:php_depend

phpmdphpunitphpcpdphpcsjslint

67

Page 72: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 68

Build Debian Packageant autoloaderant phpunitant clean

ant compilejsant compilecss

Page 73: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Deploy Stagingant clean

ant deb-signant db-staging-upscp to all hosts

69

Page 74: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 70

Deploy Staging to livescp to all hosts

Page 75: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Disadvantages and problems

71

Page 76: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Build time15 min on harddisk

massive disk i/o4 min on ramdisk :-)

72

Page 77: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Complexity beginning such a infrastructure

73

Page 78: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Jenkins:Single point of failure!

74

Page 79: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Cool stuff which is now possible

75

Page 80: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 76

Deploy by customer. :-)

Page 81: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I 77

Jenkins Chuck Norris Plugin

Page 82: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

git bisect start $BAD $GOOD

78

Page 83: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Minimum time from bugreport to deploy:

30 minutes

79

Page 84: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

$ git branch hotfix-2011-08-22$ git checkout hotfix-2011-08-22$ git reset --hard "last stable sha-1"$ git cherry-pick "hotfix sha-1"$ echo build.number=23 > build.number$ ant deb$ scp build/deb/*.deb xyz.amazonaws.com:/opt/repository/$ git checkout master$ git push origin hotfix-2011-08-10

80

Page 85: One click deployment with Jenkins - PHP Munich

Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I

Questions?

81

Page 86: One click deployment with Jenkins - PHP Munich

Thank you very much for your attention!

© 2011 Mayflower GmbH

Contact Thorsten [email protected]+49 89 242054-31

Mayflower GmbHMannhardtstr. 680538 MünchenGermany