one-click deployment with jenkins
DESCRIPTION
PHP Barcelona 2011TRANSCRIPT
![Page 1: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/1.jpg)
© Mayflower GmbH 2010
One-Click Deployment with Jenkins
Florian Anderiasch I October 28, 2011
![Page 2: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/2.jpg)
Mayflower GmbH I 2
Who am I?
![Page 3: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/3.jpg)
Mayflower GmbH I 3
DeveloperEx-AdminDevOp?
„I rant a lot“
@anderiaschstay in touch!
![Page 4: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/4.jpg)
Mayflower GmbH I 4
Who are you?
![Page 5: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/5.jpg)
Mayflower GmbH I 5
Developers?
![Page 6: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/6.jpg)
Mayflower GmbH I 6
Admins?
![Page 7: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/7.jpg)
Mayflower GmbH I 7
Continuous Integration?
![Page 8: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/8.jpg)
Mayflower GmbH I 8
How often
do yourelease?
![Page 9: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/9.jpg)
Mayflower GmbH I 9
6-12 months?
![Page 10: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/10.jpg)
Mayflower GmbH I 10
1-6 months?
![Page 11: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/11.jpg)
Mayflower GmbH I 11
2-4 weeks?
![Page 12: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/12.jpg)
Mayflower GmbH I 12
1-14 days?
![Page 13: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/13.jpg)
Mayflower GmbH I 13
1-24 hours?
![Page 14: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/14.jpg)
Mayflower GmbH I 14
Less than 15 minutes?
![Page 15: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/15.jpg)
Mayflower GmbH I 15
15 minutes!
![Page 16: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/16.jpg)
Mayflower GmbH I 16
Why One-ClickDeployment?
![Page 17: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/17.jpg)
Mayflower GmbH I 17
Everything is moving faster.
![Page 18: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/18.jpg)
Mayflower GmbH I 18
React faster touser feedback
React faster touser feedback
![Page 19: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/19.jpg)
Mayflower GmbH I 19
Faster ROITime to market
![Page 20: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/20.jpg)
20Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I
Developers are lazy.Developers are lazy.
![Page 21: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/21.jpg)
Mayflower GmbH I 21
Basic requirements
![Page 22: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/22.jpg)
Mayflower GmbH I 22
Agile softwaredevelopment
![Page 23: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/23.jpg)
Mayflower GmbH I 23
Scrum or Kanban
![Page 24: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/24.jpg)
Mayflower GmbH I 24
Test Driven Development
![Page 25: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/25.jpg)
Mayflower GmbH I 25
Continuous Integration
![Page 26: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/26.jpg)
Mayflower GmbH I 26
Integrating the freshparts of code into
the application
at least daily
![Page 27: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/27.jpg)
Mayflower GmbH I 27
Continuous Inspection
![Page 28: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/28.jpg)
Mayflower GmbH I 28
instantfeedback
![Page 29: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/29.jpg)
Mayflower GmbH I 29
Refactoring
![Page 30: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/30.jpg)
Mayflower GmbH I 30
ContinuousDeployment
![Page 31: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/31.jpg)
Mayflower GmbH I 31
Reproducableresults
![Page 32: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/32.jpg)
Mayflower GmbH I 32
There arepractices you wantto avoid
![Page 33: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/33.jpg)
Mayflower GmbH I 33
Having your SVN repo in your
webserver's docroot.
![Page 34: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/34.jpg)
Mayflower GmbH I 34
Using SSH and vi and your root account on
the live server.
![Page 35: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/35.jpg)
Mayflower GmbH I 35
Who's still doing this? :-)
![Page 36: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/36.jpg)
Mayflower GmbH I 36
![Page 37: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/37.jpg)
Mayflower GmbH I 37
What do we need?
![Page 38: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/38.jpg)
Mayflower GmbH I 38
First of all:centralizedbuild server
![Page 39: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/39.jpg)
Mayflower GmbH I 39
There are plenty:
CruiseControl/phpUCBamboobuildbot
![Page 40: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/40.jpg)
Mayflower GmbH I 40
tests are running
all the time
![Page 41: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/41.jpg)
Mayflower GmbH I 41
![Page 42: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/42.jpg)
Mayflower GmbH I 42
Repeatedlyrunning
tests
![Page 43: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/43.jpg)
Mayflower GmbH I 43
Advantages
![Page 44: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/44.jpg)
Mayflower GmbH I 44
Informationavailable
at onesingle point
![Page 45: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/45.jpg)
Mayflower GmbH I 45
find errors
![Page 46: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/46.jpg)
Mayflower GmbH I 46
andfix themquickly
![Page 47: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/47.jpg)
Mayflower GmbH I 47
Metrics
![Page 48: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/48.jpg)
Mayflower GmbH I 48
Dashboards
![Page 49: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/49.jpg)
Mayflower GmbH I 49
Awareness
![Page 50: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/50.jpg)
Mayflower GmbH I 50
Awareness!
![Page 51: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/51.jpg)
Mayflower GmbH I 51
Continuous integrationin
PHP projects
![Page 52: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/52.jpg)
Mayflower GmbH I 52
Continuous Integrationin
PHP projects
![Page 53: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/53.jpg)
Mayflower GmbH I 53
PHPUnitDocBlox
![Page 54: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/54.jpg)
Mayflower GmbH I 54
Continuous Inspectionin
PHP projects
![Page 55: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/55.jpg)
Mayflower GmbH I 55
PHP_CodeSnifferPHP_Depend
PHPMDphpcpd
jslint
![Page 56: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/56.jpg)
Mayflower GmbH I 56
Infrastructure
![Page 57: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/57.jpg)
Mayflower GmbH I 57
![Page 58: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/58.jpg)
Mayflower GmbH I 58
![Page 59: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/59.jpg)
59Continuous Improvement in PHP Projects I Mayflower GmbH I 25th February I
One Ubuntu package to rule them all.
![Page 60: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/60.jpg)
Mayflower GmbH I 60
Developer VMUbuntu 11.04
![Page 61: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/61.jpg)
Mayflower GmbH I 61
Jenkins: Dev-VMTesting: Dev-VM
Ubuntu 11.04
![Page 62: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/62.jpg)
Mayflower GmbH I 62
Staging VMs:Frontend: Ubuntu 11.04
Backend: Ubuntu 10.04 LTS
(bad idea, use one version)
![Page 63: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/63.jpg)
Mayflower GmbH I 63
Amazon AWS live:Frontend: Ubuntu 11.04
Backend: Ubuntu 10.04 LTS
![Page 64: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/64.jpg)
Mayflower GmbH I 64
Frontend NodesVarnishnginx
PHP 5.3 with APCZend Framework 1.11
Dojo 1.6Doctrine2.1
![Page 65: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/65.jpg)
Mayflower GmbH I 65
Backend NodesMySQL Master/Slave
Apache SolrGearman/RabbitMQ
memcachedejabberd
![Page 66: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/66.jpg)
Mayflower GmbH I 66
Development workflow
![Page 67: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/67.jpg)
Mayflower GmbH I 67
1. developer commits code2. post commit hook: build3. checks4. packaging a .deb5. (deploy to STAGING)6. (deploy to LIVE)
![Page 68: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/68.jpg)
Mayflower GmbH I 68
<project> <property /> <target name=“build“></target> <target name=“clean“></target> <target name=“phpunit“></target> <target name=“deploy-to-staging“></target></project>
![Page 69: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/69.jpg)
Mayflower GmbH I 69
<target name="phpunit" depends="db-test" description="Run all tests"> <exec executable="phpunit" failonerror="true"> <arg line="--configuration${basedir}/tests/phpunit-verbose.xml${basedir}/tests/AllTests.php" /> </exec> </target>
![Page 70: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/70.jpg)
Mayflower GmbH I 70
„ant build“
ant syncant cleanant db-up
ant parallelTasksant parallelTasksant phpunitant phpcb
ant build-debant build-deb
![Page 71: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/71.jpg)
Mayflower GmbH I 71
„ant parallelTasks“
ant phpmdant phpdocant phpcpdant phpcsant jslint
![Page 72: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/72.jpg)
Mayflower GmbH I 72
„build-deb“
git pullant phpunitant clean
ant compilejsant compilecss
![Page 73: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/73.jpg)
Mayflower GmbH I 73
„deploy-to-staging“
ant deb-signant db-staging-up
scp to all hosts
![Page 74: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/74.jpg)
Mayflower GmbH I 74
„deploy-to-live“
fetch known-good .debscp to all hosts
there is no step 3
![Page 75: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/75.jpg)
Mayflower GmbH I 75
Disadvantagesand
problems
![Page 76: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/76.jpg)
Mayflower GmbH I 76
Build time15 min on harddisk
massive disk i/o4 min on ramdisk
![Page 77: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/77.jpg)
Mayflower GmbH I 77
Complex setup
![Page 78: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/78.jpg)
Mayflower GmbH I 78
Jenkins:Single point of failure!
![Page 79: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/79.jpg)
Mayflower GmbH I 79
Goodies
![Page 80: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/80.jpg)
Mayflower GmbH I 80
everyonecan deploy
(including theproduct owner)
![Page 81: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/81.jpg)
Mayflower GmbH I 81
git bisect start$BAD $GOOD
![Page 82: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/82.jpg)
Mayflower GmbH I 82
30min frombugreport to
deploy
![Page 83: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/83.jpg)
Mayflower GmbH I 83
We can still do hotfixes in thisenvironment
![Page 84: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/84.jpg)
Mayflower GmbH I 84
plotting plugin (gitstats)
![Page 85: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/85.jpg)
Mayflower GmbH I 85
![Page 86: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/86.jpg)
Mayflower GmbH I 86
echo $(olddir=`pwd`;cd /media/ram/PROJECT;
git log --oneline --after=$(date +%Y-%m-%d -d yesterday) --shortstat
| grep --color=none "^ " | sed 's,^ *,,' | awk 'NF==7 {p+=$4;m+=$6;diff+=$4;diff-=$6;} END {printf("%d %d %d\n", p, m, diff)}';cd
$olddir;) > gitnum.properties.all
echo YVALUE=$(cat gitnum.properties.all | cut -d' ' -f1) >> gitnum.properties.plus
![Page 87: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/87.jpg)
Mayflower GmbH I 87
Jenkins Plugin: Chuck Norris
![Page 88: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/88.jpg)
Mayflower GmbH I 88
Questions?
![Page 89: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/89.jpg)
29.10.11 Mayflower GmbH 89
Thanks for listening!
Contact Florian Anderiasch
+49 89 242054 1134
@anderiasch
Mayflower GmbH
Mannhardtstrasse 6
80538 München
![Page 90: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/90.jpg)
Mayflower GmbH I 90
ImagesVader (42), Sebastian Bergmann, CC-BY-SA
http://www.flickr.com/photos/sebastian_bergmann/2282734669
Clouds (52), John Mueller, CC-BY-NC-NDhttp://www.flickr.com/photos/johnmueller/52621490/
![Page 91: One-Click Deployment with Jenkins](https://reader034.vdocument.in/reader034/viewer/2022051411/547ea436b4795984508b4b93/html5/thumbnails/91.jpg)
Mayflower GmbH I 91
CinderConnecting CI server and IDE
Help is welcomehttp://github.com/winks/cinder
needs XML from phpuc/hudson/bamboo
and nothing else :)