Slide 1

Slide 1 text

DevOps automation: CI and Deployment with Jenkins. Slavey Karadzhov Senior Consultant Zend Technologies

Slide 2

Slide 2 text

2 •Name: Slavey Karadzhov (Славей Караджов) •Senior Technical Consultant and Trainer at Zend Technologies •Zend Framework (ZF) and PHP ZCE •Many years of PHP (v3,4 & 5), ZF and galaxy of programming languages (Python, Perl, Java, JavaScript,…). •Author of the “Learn ZF2” book ( http://learnzf2.com ) About me

Slide 3

Slide 3 text

3 •Faster Time-To-Market •Cooperation between Devs and Ops (DevOps) •Automation •Helpful tools •Putting the pieces together What is this talk about

Slide 4

Slide 4 text

4 •Getting rid of the IT/Operations guys (department) •Getting rid of lazy developers. What ISN'T this talk about

Slide 5

Slide 5 text

Faster Time-To-Market

Slide 6

Slide 6 text

6 •Why is that important o More Features, More Often (Facebook is good example) o Competitive advantage to your business o Improve the end-customer experience o Reduced costs o Better quality "Deliver faster, with more features and better quality" Faster Time-To-Market

Slide 7

Slide 7 text

7 "Deliver faster, with more features and better quality“ •Agile development o SCRUM, Extreme Programming o UnitTests Faster Time-To-Market

Slide 8

Slide 8 text

Cooperation between Devs and Ops

Slide 9

Slide 9 text

9 "DevOps is a methodology which helps foster collaboration between the teams that create and test applications (Dev) with those that maintain them in production environments (Ops). •Decrease the tedious communication o for requirements needed by the application defined by the Devs and provided by the Ops" •Decrease the efforts from the Ops o needed to assure that the code is ready for prime time. o Because "it worked on the Devs computer" is not enough! •Allow faster response from the Devs Cooperation between Devs and Ops

Slide 10

Slide 10 text

Continuous

Slide 11

Slide 11 text

11 •Integration o Running tests o Checking Code Quality →Coding Styles →Copy/Paste Detection →Code Metrics — Cyclomatic Complexity Continuous

Slide 12

Slide 12 text

12 •Delivery "Continuous Delivery is the natural extension of Continuous Integration: an approach in which teams ensure that every change to the system is releasable, and that we can release any version at the push of a button. Continuous Delivery aims to make releases boring, so we can deliver frequently and get fast feedback on what users care about." Continuous

Slide 13

Slide 13 text

13 Continues

Slide 14

Slide 14 text

Automation

Slide 15

Slide 15 text

15 •Automation is King: o gives always deterministic and reproducible results. o allows faster reproduction of time-consuming tasks •Continuous Integration and Delivery o Based on some rules o With a click of a button Automation

Slide 16

Slide 16 text

16 Automation Production

Slide 17

Slide 17 text

Cooking Recipe

Slide 18

Slide 18 text

18 •Ingredients o 1..n, n>=1 Zend Servers o 1 CI/CD server with Jenkins •Preparation o Add packaging support in source →deployment.xml →deployment.properties →build.xml o Configure Jenkins →Enable git and phing Cooking Recipe

Slide 19

Slide 19 text

19 •Mix and cook o Create a Jenkins job →Gets source from repo →Runs phing with target deployment and parameters o Push the button! Cooking Recipe

Slide 20

Slide 20 text

20 •Ingredients: 1..n Zend Servers Cooking Recipe wget http://repos.zend.com/zend.key -O- |apt-key add - sudo sh -c 'echo "deb http://repos.zend.com/zend-server/6.1/deb_ssl1.0 \ server non-free" > /etc/apt/sources.list.d/zend.list' sudo apt-get update sudo apt-get install zend-server-php-5.3

Slide 21

Slide 21 text

21 •Ingredients: 1 CI/CD server o PHP o Pear •apt-get install php-pear •PHPUnit(For unit Tests) Cooking Recipe apt-get install php5-cli apt-get install php-pear pear install pear.phpunit.de/PHPUnit pear config-set auto_discover 1 pear install pear.phpunit.de/PHPUnit

Slide 22

Slide 22 text

22 •Ingredients: 1 CI/CD server (cnt.1) o Phing (Build System) o Jenkins(Automation System) Cooking Recipe pear channel-discover pear.phing.info pear install phing/phing wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt- key add - sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ >\ /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins

Slide 23

Slide 23 text

23 •Ingredients: 1 CI/CD server (cnt.2) o zs-client (interacts with Zend Server) Cooking Recipe cd /usr/local/bin sudo wget \ https://github.com/zend-patterns/ZendServerSDK/raw/master/bin/zs- client.phar sudo chmod a+x zs-client.phar

Slide 24

Slide 24 text

24 •Preparation o Add packaging support in source →deployment.xml & deployment.properties →build.xml – XML containing the steps needed for the build — UnitTests — Package creation — Deployment Cooking Recipe zs-client.phar initZpk –-folder=/ https://bitbucket.org/zendtechnologies/deploymentapp/raw/master/build.xml

Slide 25

Slide 25 text

25 •Preparation o Configure Jenkins →Enable git and phing (Manage Jenkins->Manage Plugins) Cooking Recipe

Slide 26

Slide 26 text

26 •Mix and cook o Create a Jenkins job →Gets source from repo Cooking Recipe

Slide 27

Slide 27 text

27 •Mix and cook o Create a Jenkins job (cnt. 1) →Runs phing with target deployment and parameters Cooking Recipe

Slide 28

Slide 28 text

28 •Push the button! Cooking Recipe Time for Demo

Slide 29

Slide 29 text

Thank You! Joind.In: https://joind.in/9060 Zs-client: https://github.com/zend-patterns/ZendServerSDK/ DemoApp: https://bitbucket.org/zendtechnologies/deploymentapp