1. Oliver Mueller | TEQneers
Phingified CI and
Deployment Strategies
Montag, 15. Oktober 12
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, NYC
Montag, 15. Oktober 12
4. Agenda
• Introduction to Phing
• Continues Integration
• Deployment Strategy Examples
• Q&A
Montag, 15. Oktober 12
5. Hands Up!
• Who knows or uses build tools?
• Who is using Continues Integration?
Montag, 15. Oktober 12
6. Agenda
• Introduction to Phing
• Continues Integration
• Deployment Strategy Examples
• Q&A
Montag, 15. Oktober 12
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 Rook
Montag, 15. Oktober 12
8. Why use build tools?
• We all hate repetition
• We forget things
• We make mistakes
• We have other things
todo
• Be independent of key
staff
Montag, 15. Oktober 12
9. Automate it!
• Helps developers, • Improve quality
testers, administrators
• Reduce errors
• Great for new team
members • Save time
• Consolidate scripts
• Standardize tasks
• Define task
dependencies
Montag, 15. Oktober 12
24. Where matters
• Self managed server • Cluster
• Local server (intranet) • Cloud
• Customer server • Appliance
• Multi platform
• Single host
• Server farm
Montag, 15. Oktober 12
25. Who matters
• Internal administrators
• DevOps
• Customers with IT
department
• Some developers
• Trained staff
• Anti geek
Montag, 15. Oktober 12
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 / juju
Montag, 15. Oktober 12
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 folder
Montag, 15. Oktober 12
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. 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: git
Montag, 15. Oktober 12
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
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
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