Contenu connexe Similaire à Write php deploy everywhere (20) Plus de Michelangelo van Dam (20) Write php deploy everywhere3. Topics
Live hacking
FTP deploy
Version control
Automated deployment
Anywhere deployment
5. Rob Allen
Stress Free Deployment
http://www.flickr.com/photos/stuartherbert/5089882125
http://akrabat.com/talks/#sfd
19. Phing
• build tool written in PHP
• comparable to ANT build scripts
• impressive list of task templates
• extensible for missing tasks
22. 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>
31. 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>
33. A few remarks
•- runs only on windows
but still uses phing :-)
• takes a considerable time to upload
• instances are defined in the config
34. 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"/>
35. 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>
36. Deploy to Azure
<target name="deploy-azure" depends="prepare-azure">
<exec command=""${cmd-cspack}"
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>
42. 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
Notes de l'éditeur \n \n \n \n \n \n \n manual modifying on server\nno return to previous\nfailures visible\n\n \n local files &#x201C;out-of-sync&#x201D;\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&#x2019;re interested in cloud deployment\n- phpa - Feb 2011 issue\n \n