Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DevOps automation: CI and Deployment with Jenkins

DevOps automation: CI and Deployment with Jenkins

Agile development and CI are increasingly becoming the de-fact standard for web application development teams. It allows for faster release cycles, and significantly reduces the amount of bugs in a realease if implemented correctly. During this session I will show you how to setup a CI environment using Jenkins and Zend Server, and also how to automate common Zend Server tasks.

Slavey Karadzhov

October 08, 2013

More Decks by Slavey Karadzhov

Other Decks in Programming


  1. 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
  2. 3 •Faster Time-To-Market •Cooperation between Devs and Ops (DevOps) •Automation

    •Helpful tools •Putting the pieces together What is this talk about
  3. 4 •Getting rid of the IT/Operations guys (department) •Getting rid

    of lazy developers. What ISN'T this talk about
  4. 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
  5. 7 "Deliver faster, with more features and better quality“ •Agile

    development o SCRUM, Extreme Programming o UnitTests Faster Time-To-Market
  6. 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
  7. 11 •Integration o Running tests o Checking Code Quality →Coding

    Styles →Copy/Paste Detection →Code Metrics — Cyclomatic Complexity Continuous
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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=/<source> https://bitbucket.org/zendtechnologies/deploymentapp/raw/master/build.xml
  17. 26 •Mix and cook o Create a Jenkins job →Gets

    source from repo Cooking Recipe
  18. 27 •Mix and cook o Create a Jenkins job (cnt.

    1) →Runs phing with target deployment and parameters Cooking Recipe