SlideShare a Scribd company logo
Write PHP, deploy
   anywhere
   Tek 11 - Chicago, IL (USA)
m a
I’



                       p e r
              v e lo
           D e
I write code
Not a sysadmin




http://www.flickr.com/photos/scobleizer/4870003098/
Just want to run code
Write php deploy everywhere   tek11
Deployment types
Live Hacking
Good old days
FTP deploy
Manual FTP deploy
Version control
Code management
Versioning concepts
Symlink switch old
path/to/webapp
path/to/webapp-1.0.2 -> path/to/webapp
path/to/webapp-1.0.3
Symlink switch new
path/to/webapp
path/to/webapp-1.0.2
path/to/webapp-1.0.3 -> path/to/webapp
Automated deployment
Concept: build
• required steps
•- to “build” an application
     validate
 -   test
 -   document
 -   package
PHP provides the tools!
Phing
•- build tool written in PHP
    comparable to ANT
 - but written in PHP :-)
• impressive list of task templates
• extensible for missing tasks
Phing HelloWorld!
<?xml version="1.0" encoding="UTF-8"?>
<project name="demo" default="build">
  <target name="build">
    <echo msg="Hello World!"/>
  </target>
</project>
Write php deploy everywhere   tek11
Export from SVN
<property name="buildpath" value="./build"/>
<property name="repopath"
          value="https://svn.myserver.com/demo/trunk"/>
  <target name="prepare">
      <delete dir="${buildpath}"
              includeemptydirs="true"
              quiet="true"
              verbose="false"
              failonerror="false" />
      <mkdir dir="${buildpath}"/>
  </target>
  <target name="getsources" depends="prepare">
      <svnexport svnpath="/usr/bin/svn"
                 force="true"
                 nocache="true"
                 repositoryurl="${repopath}"
                 todir="${buildpath}"/>
  </target>
Write php deploy everywhere   tek11
Deployment targets
• scp
• rsync
• ftp
•- VCM deployments
     cvs
 -   svn
 -   git
 -   …
More info: phing.info
Anywhere deployment
Where to deploy to?
• bare metal servers
•- virtual servers
     even cloud instances
• any OS (Windows, OSX, Linux, i5, …)
Linux server
Example deploy Linux
<target name="deploy-linux">
    <exec dir="./build"
      command="rsync -ruq user@server.com:/srv/www/demo"/>
</target>
Write php deploy everywhere   tek11
Windows server
Deploy to windows
<target name="deploy-windows" depends="version-bugfix">
    <ftpdeploy host="${env.win-prod}"
               port="21"
               username="${auth.win-prod.username}"
               password="${auth.win-prod.password}"
               dir="/"
               mode="binary"
               clearfirst="false">
               <fileset dir=".">
                   <exclude=”./library/Zend”/>
                   <exclude=”./library/ZendX”/>
               </fileset>
    </ftpdeploy>
</target>
Deploy to S3
<target name="deploy-windows" depends="version-bugfix">
    <ftpdeploy host="${env.win-prod}"
               port="21"
               username="${auth.win-prod.username}"
               password="${auth.win-prod.password}"
               dir="/"
               mode="binary"
               clearfirst="false">
               <fileset dir=".">
                   <exclude=”./library/Zend”/>
                   <exclude=”./library/ZendX”/>
               </fileset>
    </ftpdeploy>
</target>
Windows Azure
A few remarks
•- runs only on windows
    but still uses phing :-)
• takes a considerable time to upload
• instances are defined in the config
Setting properties
<property
  name="cmd-cspack"
  value="c:Program FilesWindows Azure SDKv1.3bin
cspack.exe"
  override="false"/>
<property
  name="cmd-csrun"
  value="c:Program FilesWindows Azure SDKv1.3bin
csrun.exe"
  override="false"/>
Prepare for Azure
<target name="prepare-azure" depends="version-bugfix">
    <!-- start building in ./bldtmp -->
    <mkdir dir="./bldtmp" />

    <copy todir="./bldtmp" overwrite="true">
      <fileset dir="./deploy/azure">
        <include name="**/*.*" />
      </fileset>
    </copy>
    <copy todir="./bldtmp/PhpOnAzure.Web" overwrite="true">
      <fileset dir=".">
        <include name="**/*"/>
        <include name="*"/>
      </fileset>
    </copy>
</target>
Deploy to Azure
<target name="deploy-azure" depends="prepare-azure">
    <exec command="&quot;${cmd-cspack}&quot;
ServiceDefinition.csdef /
role:PhpOnAzure.Web;PhpOnAzure.Web /out:PhpAzure.cspkg"
          dir="./bldtmp" />
    <mkdir dir="./release/${phing.project.name}-$
{version.number}/azure-prod" />
    <copy todir="./release/${phing.project.name}-$
{version.number}/azure-prod" overwrite="true">
      <fileset dir="./bldtmp">
        <include name="PhpOnAzure.cspkg"/>
        <include name="ServiceConfiguration.cscfg"/>
      </fileset>
    </copy>
</target>
Write php deploy everywhere   tek11
Write php deploy everywhere   tek11
Continuous Integration
Continuous Building
Write php deploy everywhere   tek11
With CI
• always “ready to deploy” codebase
• feedback on quality
• documentation
• more …
Considerations
Some reminders
•- design your apps to work everywhere
    use OOP abstraction layers
 - use plugins
 - take care of sessions!
• investigate “the other platform”
 - gives you a head start over competetion
 - teaches you the caveats
• “cloud” solutions are in high-demand
 - see what works best for your customer
automate what you might
   forget under stress!
Write php deploy everywhere   tek11
Write php deploy everywhere   tek11
Conclusion
1. deployment is simple
2. automate the steps
3. deploy to any platform
Thank you
• source code:
     http://github.com/DragonBe/zftest

• your rating:
     http://joind.in/3438

•- follow me:
      twitter: @DragonBe
 -    facebook: DragonBe

              Please use joind.in for feedback

More Related Content

What's hot (19)

PDF
Jenkins and ansible reference
laonap166
 
PPTX
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
Brian Hogg
 
PPTX
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Julian Dunn
 
ODP
SockJS Intro
Ngoc Dao
 
PDF
Automatic testing and quality assurance for WordPress plugins
Otto Kekäläinen
 
KEY
Nodejs web,db,hosting
Kenu, GwangNam Heo
 
PDF
CI workflow in a web studio
deWeb
 
PDF
WordPress mit Composer und Git verwalten
Walter Ebert
 
PDF
Provisioning iOS CI Server with Ansible
Shashikant Jagtap
 
PPTX
Module design pattern i.e. express js
Ahmed Assaf
 
PDF
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Ryan Weaver
 
PDF
Npm scripts
정윤 김
 
PDF
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
PDF
Bower & Grunt - A practical workflow
Riccardo Coppola
 
PDF
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
PPTX
Packing for the Web with Webpack
Thiago Temple
 
PPTX
Get started with docker &amp; dev ops
Asya Dudnik
 
PPTX
Get started with docker &amp; dev ops
Asya Dudnik
 
PDF
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Jenkins and ansible reference
laonap166
 
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
Brian Hogg
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Julian Dunn
 
SockJS Intro
Ngoc Dao
 
Automatic testing and quality assurance for WordPress plugins
Otto Kekäläinen
 
Nodejs web,db,hosting
Kenu, GwangNam Heo
 
CI workflow in a web studio
deWeb
 
WordPress mit Composer und Git verwalten
Walter Ebert
 
Provisioning iOS CI Server with Ansible
Shashikant Jagtap
 
Module design pattern i.e. express js
Ahmed Assaf
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Ryan Weaver
 
Npm scripts
정윤 김
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
Bower & Grunt - A practical workflow
Riccardo Coppola
 
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
Packing for the Web with Webpack
Thiago Temple
 
Get started with docker &amp; dev ops
Asya Dudnik
 
Get started with docker &amp; dev ops
Asya Dudnik
 
Profiling PHP with Xdebug / Webgrind
Sam Keen
 

Viewers also liked (10)

KEY
Php com con-2011
LB Denker
 
PDF
Building a Cloud-based Social Network with Zend Framework and Doctrine 2
Mayflower GmbH
 
PDF
Misguided manager
Zoe Slattery
 
PDF
How to create social apps for millions of users
Bastian Hofmann
 
PDF
PHP Days 2011 - Keynote: Microsoft WebMatrix
pietrobr
 
PDF
Hybrid Cloud PHPUK2012
Combell NV
 
PPTX
2012 Confoo: Changing the Face of Identity in Ecommerce
Jonathan LeBlanc
 
PDF
Mashing up JavaScript
Bastian Hofmann
 
TXT
23k guestbooks mix
Waleed Ahmad
 
PDF
Modern PHP
Changwan Jun
 
Php com con-2011
LB Denker
 
Building a Cloud-based Social Network with Zend Framework and Doctrine 2
Mayflower GmbH
 
Misguided manager
Zoe Slattery
 
How to create social apps for millions of users
Bastian Hofmann
 
PHP Days 2011 - Keynote: Microsoft WebMatrix
pietrobr
 
Hybrid Cloud PHPUK2012
Combell NV
 
2012 Confoo: Changing the Face of Identity in Ecommerce
Jonathan LeBlanc
 
Mashing up JavaScript
Bastian Hofmann
 
23k guestbooks mix
Waleed Ahmad
 
Modern PHP
Changwan Jun
 
Ad

Similar to Write php deploy everywhere tek11 (20)

PDF
Phing
mdekrijger
 
PDF
Burn down the silos! Helping dev and ops gel on high availability websites
Lindsay Holmwood
 
PDF
Continous delivery with Jenkins and Chef
defrag2
 
KEY
Improving QA on PHP projects - confoo 2011
Michelangelo van Dam
 
PDF
Building com Phing - 7Masters PHP
iMasters
 
PDF
Deployment Tactics
Ian Barber
 
PDF
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
Leo Lorieri
 
PDF
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Bastian Feder
 
PPTX
drupal ci cd concept cornel univercity.pptx
rukuntravel
 
PDF
Automating complex infrastructures with Puppet
Kris Buytaert
 
PDF
Scaling up development of a modular code base
Robert Munteanu
 
KEY
Mojolicious - A new hope
Marcus Ramberg
 
PDF
Automating Complex Setups with Puppet
Kris Buytaert
 
PPT
Build Automation of PHP Applications
Pavan Kumar N
 
PDF
Capistrano deploy Magento project in an efficient way
Sylvain Rayé
 
PDF
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
PDF
Deploying configurable frontend web application containers
José Moreira
 
PDF
Lean Php Presentation
Alan Pinstein
 
PDF
Deploying Symfony | symfony.cat
Pablo Godel
 
PDF
The Modern Developer Toolbox
Pablo Godel
 
Phing
mdekrijger
 
Burn down the silos! Helping dev and ops gel on high availability websites
Lindsay Holmwood
 
Continous delivery with Jenkins and Chef
defrag2
 
Improving QA on PHP projects - confoo 2011
Michelangelo van Dam
 
Building com Phing - 7Masters PHP
iMasters
 
Deployment Tactics
Ian Barber
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
Leo Lorieri
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Bastian Feder
 
drupal ci cd concept cornel univercity.pptx
rukuntravel
 
Automating complex infrastructures with Puppet
Kris Buytaert
 
Scaling up development of a modular code base
Robert Munteanu
 
Mojolicious - A new hope
Marcus Ramberg
 
Automating Complex Setups with Puppet
Kris Buytaert
 
Build Automation of PHP Applications
Pavan Kumar N
 
Capistrano deploy Magento project in an efficient way
Sylvain Rayé
 
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Deploying configurable frontend web application containers
José Moreira
 
Lean Php Presentation
Alan Pinstein
 
Deploying Symfony | symfony.cat
Pablo Godel
 
The Modern Developer Toolbox
Pablo Godel
 
Ad

More from Michelangelo van Dam (20)

PDF
GDPR Art. 25 - Privacy by design and default
Michelangelo van Dam
 
PDF
Moving from app services to azure functions
Michelangelo van Dam
 
PDF
Privacy by design
Michelangelo van Dam
 
PDF
DevOps or DevSecOps
Michelangelo van Dam
 
PDF
Privacy by design
Michelangelo van Dam
 
PDF
Continuous deployment 2.0
Michelangelo van Dam
 
PDF
Let your tests drive your code
Michelangelo van Dam
 
PDF
General Data Protection Regulation, a developer's story
Michelangelo van Dam
 
PDF
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
PDF
The road to php 7.1
Michelangelo van Dam
 
PDF
Open source for a successful business
Michelangelo van Dam
 
PDF
Decouple your framework now, thank me later
Michelangelo van Dam
 
PDF
Deploy to azure in less then 15 minutes
Michelangelo van Dam
 
PDF
Azure and OSS, a match made in heaven
Michelangelo van Dam
 
PDF
Getting hands dirty with php7
Michelangelo van Dam
 
PDF
Zf2 how arrays will save your project
Michelangelo van Dam
 
PDF
Create, test, secure, repeat
Michelangelo van Dam
 
PDF
The Continuous PHP Pipeline
Michelangelo van Dam
 
PDF
PHPUnit Episode iv.iii: Return of the tests
Michelangelo van Dam
 
PDF
Easily extend your existing php app with an api
Michelangelo van Dam
 
GDPR Art. 25 - Privacy by design and default
Michelangelo van Dam
 
Moving from app services to azure functions
Michelangelo van Dam
 
Privacy by design
Michelangelo van Dam
 
DevOps or DevSecOps
Michelangelo van Dam
 
Privacy by design
Michelangelo van Dam
 
Continuous deployment 2.0
Michelangelo van Dam
 
Let your tests drive your code
Michelangelo van Dam
 
General Data Protection Regulation, a developer's story
Michelangelo van Dam
 
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
The road to php 7.1
Michelangelo van Dam
 
Open source for a successful business
Michelangelo van Dam
 
Decouple your framework now, thank me later
Michelangelo van Dam
 
Deploy to azure in less then 15 minutes
Michelangelo van Dam
 
Azure and OSS, a match made in heaven
Michelangelo van Dam
 
Getting hands dirty with php7
Michelangelo van Dam
 
Zf2 how arrays will save your project
Michelangelo van Dam
 
Create, test, secure, repeat
Michelangelo van Dam
 
The Continuous PHP Pipeline
Michelangelo van Dam
 
PHPUnit Episode iv.iii: Return of the tests
Michelangelo van Dam
 
Easily extend your existing php app with an api
Michelangelo van Dam
 

Write php deploy everywhere tek11