iBuildings v2
OSCON, July 2009
Website releases made easy with the PEAR installer
Who is Helgi ?Head of R&D at echolibre, pear extraordinaire,published author, party person and an Icelander
Not just for website deployment.Also for ...
Application deployment
Other solutions
FTP Upload
SCP / rsync
Capistrano
SVN / CVS / Git /
etc etc etc
Ask people what they use and how they use it
Alternative, not a replacement.
Deploying websites with the PEAR installer is an alternative, not a replacement for other approaches.
PEAR Installer features to the rescue
File rolesTasksPost installation tasksProvides plugin architecture
PEAR Installer features to the rescue
upgrade.depend on external packages.split websites into plugin pieces.
Easy to
Last but not least...
Tasks, custom file roles and so on are done with something we are familiar with ....
What is required
The PEAR InstallerKnowledge how to package your code with PEARA bit of know how and RTM skillsAnd not being afraid to read the source ;-)
Dismantling your site
Split your site into logical pluginsDo not split into as many packages as you can!Micro management is bad, mmmmkay
Each piece of site has its own package.xml fileThe website it self has its own package.xml
Website
Web Services
Backend
Frontend
Forum
The packages we get
WebsiteWebsite_FrontendWebsite_WebServicesWebsite_BackendWebsite_Forum
Something to take note of
www role files install directly into web dir
Maintain only one website on the serverMake every website have their own pear configUtilize the baseinstalldir attribute on the top dir
Ways to get past that shortcoming
File Roles
Default file roles:php, test, data, doc, cfg, www, script, ext & src People have written their own custom file roles.
Custom file roles
In relation to templatesCustom handling of data filesJust to name few
Post installation tasks
PHP task that you run after the installation
Post installation tasks
Post installation tasks
Clean up after the installation, temp dirs or similarDB setup / upgrade toolVirtual Host adding / updatingPrime CachesAnd just about anything you can dream up
Need to know about post install
We do not run post install script auto!
Security implications
pear run-scripts pear/pearwebIncluding external post-installation script "/usr/share/PEAR/pearweb.php" - any errors are in this scriptInclusion succeededrunning post-install script "pearweb_postinstall->init()"init succeeded
Install database? [y] :
pear run-scripts pear/pearwebIncluding external post-installation script "/usr/share/PEAR/pearweb.php" - any errors are in this scriptInclusion succeededrunning post-install script "pearweb_postinstall->init()"init succeeded
Install database? [y] :
Post install task
Multiple questions that have multiple optionsAbility to skip question group based on user input
Update pearweb database? [y] : 1. Database driver : mysqli 2. Database User name : pear 3. Database password : pear 4. Database host : localhost 5. Database name : pear
1-5, 'all', 'abort', or Enter to continue:
Update pearweb database? [y] : 1. Database driver : mysqli 2. Database User name : pear 3. Database password : pear 4. Database host : localhost 5. Database name : pear
1-5, 'all', 'abort', or Enter to continue:
Real world example
http://svn.php.net/pear/pearweb/package.xmlhttp://svn.php.net/pear/pearweb/package-pepr.xmlhttp://svn.php.net/pear/pearweb/pearweb.php
In package.xml look for pearweb.php and you see how we do it for pear.php.net
Good place to study how things are built up
Puzzling the pieces together
pear install aWebsite_WebServicesWebsite_Frontend Website_Backend
Now we run these pseudo packages and we want to install only part of our website structure
This will install your only those 3 parts of your website along site all the deps which one of those is the Website.
Web Services
Backend
Frontend
Website
Questions?
http://pear.php.net/manual/en/http://www.packtpub.com/PEAR-Installer/bookPHP Architect Articles
[email protected] @h on twitter
Resources
Click to edit the title text format