• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Phingified ci and deployment strategies ipc 2012
 

Phingified ci and deployment strategies ipc 2012

on

  • 1,478 views

 

Statistics

Views

Total Views
1,478
Views on SlideShare
1,209
Embed Views
269

Actions

Likes
2
Downloads
11
Comments
0

3 Embeds 269

http://opensource.teqneers.de 141
http://opensource.teqneers.com 127
http://translate.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Phingified ci and deployment strategies ipc 2012 Phingified ci and deployment strategies ipc 2012 Presentation Transcript

    • 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 • PHP since 1996 (v2.0) • Living in Stuttgart, Germany • like Flying, Photography, NYCMontag, 15. Oktober 12
    • TEQneersMontag, 15. Oktober 12
    • Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
    • Hands Up! • Who knows or uses build tools? • Who is using Continues Integration?Montag, 15. Oktober 12
    • Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
    • 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
    • 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
    • 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
    • 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
    • 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
    • Montag, 15. Oktober 12
    • 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
    • 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
    • A Closer LookMontag, 15. Oktober 12
    • 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
    • Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
    • Continues Integration • Automated build tools • Short integration phase • High frequency • Focus on testing • Source is XPMontag, 15. Oktober 12
    • Standard CI Flow Developer SVN CI Job Ouch! Failure? ResultsMontag, 15. Oktober 12
    • Phingify CIMontag, 15. Oktober 12
    • Agenda • Introduction to Phing • Continues Integration • Deployment Strategy Examples • Q&AMontag, 15. Oktober 12
    • Deployment All of the activities that make a software system available for use. Packaging Distribution InstallationMontag, 15. Oktober 12
    • What matters • Product • Dependencies • Project • Code size • Library • Configuration complexity • Framework • Open-Source • Proprietary codeMontag, 15. Oktober 12
    • Where matters • Self managed server • Cluster • Local server (intranet) • Cloud • Customer server • Appliance • Multi platform • Single host • Server farmMontag, 15. Oktober 12
    • Who matters • Internal administrators • DevOps • Customers with IT department • Some developers • Trained staff • Anti geekMontag, 15. Oktober 12
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • Q&AMontag, 15. Oktober 12
    • 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