Write php deploy everywhere
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Write php deploy everywhere



As a PHP developer building web applications is besides making a living a lot of fun too, especially when you can deploy your apps to any kind of environment and on any platform. In this session I ...

As a PHP developer building web applications is besides making a living a lot of fun too, especially when you can deploy your apps to any kind of environment and on any platform. In this session I take a non-standard PHP application (based on Zend Framework) and deploy it to a bare metal environment running LAMP, Windows 2008 Server with IIS7 and to cloud instances like Azure and Amazon.
The goal is to provide information on how to deploy to these various environments manual and automatic, but also to show it doesn't really matter anymore what the targeted platform is, as long the apps are written in PHP.



Total Views
Views on SlideShare
Embed Views



4 Embeds 20

http://www.berejeb.com 13
http://www.techgig.com 5
http://planete-php.fr 1
http://test.idoc.vn 1



Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • manual modifying on server\nno return to previous\nfailures visible\n\n
  • \n
  • local files “out-of-sync”\noverwriting code of others\nno previous version\n
  • \n
  • all go to a central (or decentral) repository\ncode is versioned\nwhen failure, you can revert\n
  • snapshot tag -> deployment package\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • WA SDK: http://msdn.microsoft.com/en-us/windowsazure\n
  • \n
  • first create a package with 2 instances\nthan deploy to azure\n
  • \n
  • WA Manager\n- two instances\n
  • \n
  • perfect world\n
  • \n
  • layers: db, services\nplugins: caching solutions -> OS detection\n
  • when your boss asks you to deploy quickly\n- you might forget steps\ncomputers are good at doing repeated tasks\n- use that!\n
  • if you’re interested in cloud deployment\n- phpa - Feb 2011 issue\n
  • \n

Write php deploy everywhere Presentation Transcript

  • 1. Write PHP, deploy everywhere Confoo 2011, Montreal (CA)
  • 2. Michelangelo van Dam• Independent Consultant• Zend Certified Engineer (ZCE)• President of PHPBenelux
  • 3. Topics Live hacking FTP deploy Version controlAutomated deploymentAnywhere deployment
  • 4. Related
  • 5. Rob Allen Stress Free Deployment http://www.flickr.com/photos/stuartherbert/5089882125http://akrabat.com/talks/#sfd
  • 6. Deployment types
  • 7. Live Hacking
  • 8. Good old days
  • 9. FTP deploy
  • 10. Manual FTP deploy
  • 11. Version control
  • 12. Code management
  • 13. Versioning concepts
  • 14. Symlink switch oldpath/to/webapppath/to/webapp-1.0.2 -> path/to/webapppath/to/webapp-1.0.3
  • 15. Symlink switch newpath/to/webapppath/to/webapp-1.0.2path/to/webapp-1.0.3 -> path/to/webapp
  • 16. Automated deployment
  • 17. Concept: build• required steps•- to “build” an application validate - test - document - package
  • 18. All tools needed!
  • 19. Phing• build tool written in PHP• comparable to ANT build scripts• impressive list of task templates• extensible for missing tasks
  • 20. Phing HelloWorld!<?xml version="1.0" encoding="UTF-8"?><project name="demo" default="build"> <target name="build"> <echo msg="Hello World!"/> </target></project>
  • 21. 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>
  • 22. More info: phing.info
  • 23. Anywhere deployment
  • 24. Deployment options• platform (windows, linux, i5, …)• database engine (mysql, ms sql, oracle)•- deployment protocols rsync - FTP
  • 25. Linux server
  • 26. Example deploy Linux<target name="deploy-linux"> <exec dir="./build" command="rsync -rq user@server.com:/srv/www/demo"/></target>
  • 27. Windows server
  • 28. 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>
  • 29. Windows Azure
  • 30. A few remarks•- runs only on windows but still uses phing :-)• takes a considerable time to upload• instances are defined in the config
  • 31. Setting properties<property name="cmd-cspack" value="c:Program FilesWindows Azure SDKv1.3bincspack.exe" override="false"/><property name="cmd-csrun" value="c:Program FilesWindows Azure SDKv1.3bincsrun.exe" override="false"/>
  • 32. 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>
  • 33. 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>
  • 34. Continuous Integration
  • 35. Continuous Building
  • 36. Considerations
  • 37. 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
  • 38. automate what you might forget under stress!
  • 39. Questions• http://slideshare.net/DragonBe/write-php-deply- everywhere• http://twitter.com/DragonBe• http://facebook.com/DragonBe• http://joind.in/2782