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
Ad

Recommended

Write php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
LumoSpark
 
Build RESTful API Using Express JS
Build RESTful API Using Express JS
Cakra Danu Sedayu
 
Vagrant WordCamp Hamilton
Vagrant WordCamp Hamilton
Paul Bearne
 
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DEVCON
 
Angular2 ecosystem
Angular2 ecosystem
Kamil Lelonek
 
Node.js in a heterogeneous system
Node.js in a heterogeneous system
GeeksLab Odessa
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)
Otto Kekäläinen
 
Jenkins and ansible reference
Jenkins and ansible reference
laonap166
 
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
WordCamp Ann Arbor 2015 Introduction to Backbone + WP REST API
Brian Hogg
 
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Julian Dunn
 
SockJS Intro
SockJS Intro
Ngoc Dao
 
Automatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress plugins
Otto Kekäläinen
 
Nodejs web,db,hosting
Nodejs web,db,hosting
Kenu, GwangNam Heo
 
CI workflow in a web studio
CI workflow in a web studio
deWeb
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwalten
Walter Ebert
 
Provisioning iOS CI Server with Ansible
Provisioning iOS CI Server with Ansible
Shashikant Jagtap
 
Module design pattern i.e. express js
Module design pattern i.e. express js
Ahmed Assaf
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Ryan Weaver
 
Npm scripts
Npm scripts
정윤 김
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
Bower & Grunt - A practical workflow
Bower & Grunt - A practical workflow
Riccardo Coppola
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
Packing for the Web with Webpack
Packing for the Web with Webpack
Thiago Temple
 
Get started with docker &amp; dev ops
Get started with docker &amp; dev ops
Asya Dudnik
 
Get started with docker &amp; dev ops
Get started with docker &amp; dev ops
Asya Dudnik
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Php com con-2011
Php com con-2011
LB Denker
 
Building a Cloud-based Social Network with Zend Framework and Doctrine 2
Building a Cloud-based Social Network with Zend Framework and Doctrine 2
Mayflower GmbH
 
Misguided manager
Misguided manager
Zoe Slattery
 

More Related Content

What's hot (19)

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

Viewers also liked (10)

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

Similar to Write php deploy everywhere tek11 (20)

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

More from Michelangelo van Dam (20)

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

Write php deploy everywhere tek11