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
Tweet

More Decks by Slavey Karadzhov

Other Decks in Programming

Transcript

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

    View Slide

  2. 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

    View Slide

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

    View Slide

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

    View Slide

  5. Faster Time-To-Market

    View Slide

  6. 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

    View Slide

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

    View Slide

  8. Cooperation between Devs
    and Ops

    View Slide

  9. 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

    View Slide

  10. Continuous

    View Slide

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

    View Slide

  12. 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

    View Slide

  13. 13
    Continues

    View Slide

  14. Automation

    View Slide

  15. 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

    View Slide

  16. 16
    Automation
    Production

    View Slide

  17. Cooking Recipe

    View Slide

  18. 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

    View Slide

  19. 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

    View Slide

  20. 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

    View Slide

  21. 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

    View Slide

  22. 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

    View Slide

  23. 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

    View Slide

  24. 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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  28. 28
    •Push the button!
    Cooking Recipe
    Time for Demo

    View Slide

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

    View Slide