Oliver Mueller | TEQneers                Phingified CI and                Deployment StrategiesMontag, 15. Oktober 12
About Me                     •   Founder of and CEO at TEQneers [tɛknɪrz]                     •   Veteran PHP developer   ...
TEQneersMontag, 15. Oktober 12
Agenda                     •   Introduction to Phing                     •   Continues Integration                     •  ...
Hands Up!                     •   Who knows or uses build tools?                     •   Who is using Continues Integratio...
Agenda                     •   Introduction to Phing                     •   Continues Integration                     •  ...
Phing is not GNU make                     •   PHP build tool                     •   based on Apache Ant                  ...
Why use build tools?                     •   We all hate repetition                     •   We forget things              ...
Automate it!                     •   Helps developers,         •   Improve quality                         testers, admini...
Installation                • Use PEAR                         # pear channel-discover pear.phing.info                    ...
Phing Features                • Syntax Checks (PhpLint/JsLint)                • Testing (PHPUnit/SimpleTest)              ...
Montag, 15. Oktober 12
XML Build File            <?xml version="1.0" encoding="UTF-8" ?>            <project name="php-git-wrapper" default="test...
Target List               # phing -l               Buildfile: /build.xml                [property] Loading /build.properti...
A Closer LookMontag, 15. Oktober 12
Extending Phing                     •   Tasks (copy, mkdir, camouflage, ...)                     •   Types (strings, intege...
Agenda                     •   Introduction to Phing                     •   Continues Integration                     •  ...
Continues Integration                     •   Automated build tools                     •   Short integration phase       ...
Standard CI Flow                         Developer   SVN          CI    Job                             Ouch!     Failure?...
Phingify CIMontag, 15. Oktober 12
Agenda                     •   Introduction to Phing                     •   Continues Integration                     •  ...
Deployment                            All of the activities that make a                            software system availab...
What matters                     •   Product            •   Dependencies                     •   Project            •   Co...
Where matters                     •   Self managed server       •   Cluster                     •   Local server (intranet...
Who matters                     •   Internal administrators                     •   DevOps                     •   Custome...
Deployment Strategies     Packaging                     Distribution               Installation   • zip                 • ...
PEAR                         <pearpkg2 name="phing" dir="${path.src}">                            <option name="outputdire...
PHAR                         <pharpackage                           destfile="${path.build}/package.phar"                 ...
MS Web Platform Installer                         MyApp.zip                         MyApp root folder           MyApp-incl...
Composer                         {                             "name": "teqneers/PHP-Stream-Wrapper-for-Git",             ...
Shell Script                         #!/bin/sh                         cd /path/php-git-wrapper                         un...
Juju Charm                         name: php-git-wrapper                         summary: "PHP-Stream-Wrapper-for-Git"    ...
RPM Build                         Summary: A PHP stream wrapper made for GIT                         Name: php-git-wrapper...
FTP / SCP                         <ftpdeploy                           host="your-server-001"                           us...
SSH                         # ask which environment to use                         <input                           proper...
Q&AMontag, 15. Oktober 12
Thanks for listening                            contact me if you have any questions                                 email...
Upcoming SlideShare
Loading in...5
×

Phingified ci and deployment strategies ipc 2012

1,662

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,662
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
14
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Phingified ci and deployment strategies ipc 2012

  1. 1. Oliver Mueller | TEQneers Phingified CI and Deployment StrategiesMontag, 15. Oktober 12
  2. 2. About Me • Founder of and CEO at TEQneers [tɛknɪrz] • Veteran PHP developer • PHP since 1996 (v2.0) • Living in Stuttgart, Germany • like Flying, Photography, NYCMontag, 15. Oktober 12
  3. 3. TEQneersMontag, 15. Oktober 12
  4. 4. Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
  5. 5. Hands Up! • Who knows or uses build tools? • Who is using Continues Integration?Montag, 15. Oktober 12
  6. 6. Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
  7. 7. Phing is not GNU make • PHP build tool • based on Apache Ant • Originally developed by Binarycloud • Ported to PHP5 by Hans Lellelid • Lead is Michiel RookMontag, 15. Oktober 12
  8. 8. Why use build tools? • We all hate repetition • We forget things • We make mistakes • We have other things todo • Be independent of key staffMontag, 15. Oktober 12
  9. 9. Automate it! • Helps developers, • Improve quality testers, administrators • Reduce errors • Great for new team members • Save time • Consolidate scripts • Standardize tasks • Define task dependenciesMontag, 15. Oktober 12
  10. 10. Installation • Use PEAR # pear channel-discover pear.phing.info # pear install [--alldeps] phing/phing • Download package # http://www.phing.info/trac/wiki/Users/Download • GIT # git clone git://github.com/phingofficial/phing.gitMontag, 15. Oktober 12
  11. 11. Phing Features • Syntax Checks (PhpLint/JsLint) • Testing (PHPUnit/SimpleTest) • Static code analysis (pdepend) • Version Control (SVN/GIT) • Documentation (ApiGen/phpDox) • File manipulation (mv/rm/chmod) • Compression (Zip/Gzip)Montag, 15. Oktober 12
  12. 12. Montag, 15. Oktober 12
  13. 13. XML Build File <?xml version="1.0" encoding="UTF-8" ?> <project name="php-git-wrapper" default="test"> <!-- PROPERTIES --> <property name="src" value="${project.basedir}/php-git-wrapper" /> <property file="build.properties" /> <!-- FILESETS --> <fileset dir="${src}/tests" id="tests"> <include name="**/*Test.php" /> <exclude name="**/Abstracts*.php" /> </fileset> <!-- TARGETS --> <target name="prepare" description="Prepare environment" /> <target name="test" depends="prepare" description="Start PHPUnit" /> <target name="document" description="Generate HTML documentation" /> </project>Montag, 15. Oktober 12
  14. 14. Target List # phing -l Buildfile: /build.xml [property] Loading /build.properties Default target: ------------------------------------------------------ test Start PHPUnit Tests Main targets: ------------------------------------------------------ document Generate HTML documentation prepare Prepare environment test Start PHPUnit TestsMontag, 15. Oktober 12
  15. 15. A Closer LookMontag, 15. Oktober 12
  16. 16. Extending Phing • Tasks (copy, mkdir, camouflage, ...) • Types (strings, integer, boolean, DSN, ...) • Selectors (contain, date, ...) • Filters (replace, stripwhitespace, ...) • Mappers (glob, regexp, ...) • Loggers (xml, html, ...)Montag, 15. Oktober 12
  17. 17. Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
  18. 18. Continues Integration • Automated build tools • Short integration phase • High frequency • Focus on testing • Source is XPMontag, 15. Oktober 12
  19. 19. Standard CI Flow Developer SVN CI Job Ouch! Failure? ResultsMontag, 15. Oktober 12
  20. 20. Phingify CIMontag, 15. Oktober 12
  21. 21. Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
  22. 22. Deployment All of the activities that make a software system available for use. Packaging Distribution InstallationMontag, 15. Oktober 12
  23. 23. What matters • Product • Dependencies • Project • Code size • Library • Configuration complexity • Framework • Open-Source • Proprietary codeMontag, 15. Oktober 12
  24. 24. Where matters • Self managed server • Cluster • Local server (intranet) • Cloud • Customer server • Appliance • Multi platform • Single host • Server farmMontag, 15. Oktober 12
  25. 25. Who matters • Internal administrators • DevOps • Customers with IT department • Some developers • Trained staff • Anti geekMontag, 15. Oktober 12
  26. 26. Deployment Strategies Packaging Distribution Installation • zip • version • ftp • zookeeper • shell scripts control • phar • scp • doozer • composer • composer • rsync • noah • dep / apt-get • pear • ssh • accord • rpm / yum • web page • MS WPI • chef / puppet / jujuMontag, 15. Oktober 12
  27. 27. PEAR <pearpkg2 name="phing" dir="${path.src}"> <option name="outputdirectory" value="./build"/> <option name="packagefile" value="package2.xml"/> <option name="packagedirectory" value="./${path.dist}"/> <option name="channel" value="my.pear.channel.com"/> <option name="description" value="${pkg.description}"/> <option name="apiversion" value="${version}"/> <option name="releaseversion" value="${version}"/> <option name="phpdep" value="5.4.0"/> <option name="pearinstallerdep" value="1.4.6"/> <option name="packagetype" value="php"/> <option name="notes" value="${pkg.relnotes}"/> <mapping name="maintainers"> <element> <element key="handle" value="foobar"/> <element key="email" value="foobar@teqneers.de"/> </element> </mapping> </pearpkg2>Montag, 15. Oktober 12
  28. 28. PHAR <pharpackage destfile="${path.build}/package.phar" basedir="./" compression="bzip2"> <fileset dir="./classes"> <include name="**" /> </fileset> <metadata> <element name="version" value="${version}" /> <element name="authors"> <element name="Foo Bar"> <element name="e-mail" value="foobar@teqneers.de" /> </element> </element> </metadata> </pharpackage>Montag, 15. Oktober 12
  29. 29. MS Web Platform Installer MyApp.zip MyApp root folder MyApp-includes sub folder Manifest.xml (required) readme.txt Parameters.xml (required) license.text Install.sql web.config MyApp-admin sub folder various other files MyApp-content sub folderMontag, 15. Oktober 12
  30. 30. Composer {     "name": "teqneers/PHP-Stream-Wrapper-for-Git",     "description": "Git Streamwrapper for PHP",     "autoload": { "psr-0": { "TQGit": "src/TQ" } }, "type": "library",     "license": "MIT",     "require": {         "php": ">=5.3.0",         "doctrine/orm": ">=2.2.3,<2.4-dev"     },     "scripts": {         "post-install-cmd": [             "TQGitSetup::phingInstall"         ],         "post-update-cmd": [             "TQGitSetup::phingUpdate"         ]     } }Montag, 15. Oktober 12
  31. 31. Shell Script #!/bin/sh cd /path/php-git-wrapper unzip php-git-wrapper_1.2.3.zip # copy configuration file to new version copy php-git-wrapper/config.php php-git-wrapper_1.2.3/ # remove symlink and set new one rm app ln -s app_1.2.3 app # clean up rm -rf app_1.2.2 ...Montag, 15. Oktober 12
  32. 32. Juju Charm name: php-git-wrapper summary: "PHP-Stream-Wrapper-for-Git" maintainer: "Foo Bar <foobar@teqneers.de>" description: | Install the PHP Stream Wrapper for git, relates to the mysql charm. Can be scaled to multiple server requires: db: interface: mysql provides: proxy: gitMontag, 15. Oktober 12
  33. 33. RPM Build Summary: A PHP stream wrapper made for GIT Name: php-git-wrapper Version: 1.2 Release: 3 Copyright: GPL Group: Development/Libraries Source: https://github.com/PHP-Stream-Wrapper-for-Git.git URL: https://github.com/teqneers/PHP-Stream-Wrapper-for-Git Distribution: Some Linux Vendor: TEQneers GmbH & Co. KG Packager: Oliver Mueller <oliver@teqneers.de> %description Use it with your projects... %build phing rpm %install phing install %files ...Montag, 15. Oktober 12
  34. 34. FTP / SCP <ftpdeploy host="your-server-001" username="very" password="secret" dir="/var/www/your-app"> <fileset refid="all-files"> </ftpdeploy> <scp username="very" password="secret" host="your-server-001" todir="/var/www/your-app"> <fileset refid="all-files"> </scp>Montag, 15. Oktober 12
  35. 35. SSH # ask which environment to use <input propertyname="env" validargs="dev,test,prod" /> # include file depending on environmnet <property file="properties.${env}" # start update on remote server <ssh username="${login}" password="${password}" host="${server}" command="phing -f /var/www/app/build.xml update" />Montag, 15. Oktober 12
  36. 36. Q&AMontag, 15. Oktober 12
  37. 37. Thanks for listening contact me if you have any questions email: oliver@teqneers.de twitter: @ogm66 web: www.teqneers.de Have Fun!Montag, 15. Oktober 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×