Website releases made easy with the PEAR installer - Barcelona 2008
Upcoming SlideShare
Loading in...5
×
 

Website releases made easy with the PEAR installer - Barcelona 2008

on

  • 6,556 views

 

Statistics

Views

Total Views
6,556
Views on SlideShare
6,268
Embed Views
288

Actions

Likes
2
Downloads
23
Comments
0

3 Embeds 288

http://phpconference.es 186
http://phpbarcelona.org 100
http://adnam.motd.org 2

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Website releases made easy with the PEAR installer - Barcelona 2008 Website releases made easy with the PEAR installer - Barcelona 2008 Presentation Transcript

  • Website releases made easy with the PEAR installer
      • Helgi Þormar Þorbjörnsson
    Barcelona PHP Conference, September 2008
  • Who Am I ?
    • An Icelandic guy with a weird name
    • iBuildings UK
    • PEAR Group member
    • PEAR Developer – among other things, the installer
    • pear.php.net maintainer
    • PEAR <insert-job-title> ;-)
    Saturday, September 27, 2008
  • How to pronounce my name
    • Þormar Þorbjörnsson being my last name
    • ASCII version being Thormar Thorbjoernsson
    • Þ = Th and pronounced like That or a Thorn
    • Now you are more enlightened about this Icelandic thing called Thorn
  • Alternative, not a replacement
      • Deploying websites with the PEAR installer is an alternative, not a replacement for other approaches.
  • Other alternatives
    • FTP Upload
    • SCP / rsync
    • Capistrano
    • SVN / CVS / <insert fancy version control> deployment
    • etc etc etc
  • PEAR Installer features to the rescue
    • Easy upgrading
    • Ability to depend on a PEAR installable packages
    • Easy to split websites into smaller parts and give each part their own release cycle
  • PEAR Installer features to the rescue
    • Custom file roles
    • Custom tasks
    • Post installation tasks
  • Last but not least
      • Tasks, custom file roles and so on are done with something we are familiar with ....
  •  
  • What is required
    • The PEAR Installer
    • Knowledge how to package your code with the installer
    • A bit of know how and RTFM skills
    • And not being afraid to read the source ;-)
  • Dismantling your site
    • Split your site into logical pieces
    • Do not split into as many packages as you can!
    • Micro management is bad, mmmmkay
  • Dismantling your site
    • Each piece of site has its own package.xml file
    • The website it self (the core package) has its own package.xml which all the split off pieces will depend on
  • Dismantling your site Web Services Backend Frontend Forum Website
  • The packages we get
    • Website
    • Website_Frontend
    • Website_WebServices
    • Website_Backend
    • Website_Forum
  • Something to take note of
    • www roled files install straight into www_dir
    • Ways to get past that “shortcoming”:
      • Maintain only one website on the server ;-)
      • Make every website have their own pear config and even their own user
      • Utilize the baseinstalldir attribute on the top dir in package.xml (Best way)
  • Custom file roles
    • This feature allows you to write your own file roles
    • PEAR supports php, test, data, www and src by default
    • People have written their own file roles for various whacky reasons:
      • In relation to templates
      • Custom handling of data files
      • Just to name few
  • Post installation tasks
    • Handy feature for all the family
    • Write a simple PHP task that you can run after the installation
      • Clean up after the installation, temp dirs or similar
      • DB setup / upgrade tool
      • vhost adding / updating
      • Prime Caches
      • And just about anything you can dream up
  • Need to know about post install We do not run post install script auto! Quick output what it looks like to have a post install script around pear/pearweb has post-install scripts: /usr/share/PEAR/pearweb.php pearweb: Use &quot;pear run-scripts pear/pearweb&quot; to finish setup. DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES
  • Post install task <file name=&quot;postinstall.php&quot; role=&quot;php&quot;> <tasks:postinstallscript> <tasks:paramgroup> <tasks:id> askdb </tasks:id> <tasks:param> <tasks:name> yesno </tasks:name> <tasks:prompt> Install database? </tasks:prompt> <tasks:type> yesno </tasks:type> <tasks:default> y </tasks:default> </tasks:param> </tasks:paramgroup> </tasks:postinstallscript> </file>
  • Post install task pear run-scripts pear/pearweb Including external post-installation script &quot;/usr/share/PEAR/pearweb.php&quot; - any errors are in this script Inclusion succeeded running post-install script &quot;pearweb_postinstall->init()&quot; init succeeded Install database? [y] :
  • Post install task
    • Add more task:param to tasks:paramsgroup so the user gets more questions / prompts per task
    • Has the ability to skip a param group based on user input
    • task:type currently has 3 different types
      • string
      • password
      • yesno
  • 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://cvs.php.net/pearweb/package.xml
    • http://cvs.php.net/pearweb/package-pepr.xml
    • http://cvs.php.net/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
      • Now we run these pseudo packages and we want to install only part of our website structure
      • pear install –alldeps Website_WebServices Website_Frontend Website_Backend
      • This will install your only those 3 parts of your website along site all the deps which one of those is the Website.
  • Puzzling the pieces together Web Services Backend Frontend Website
  • Questions?
  • Special thanks to Cal Evans for the elephpant photo!
  • http://c7y.phparch.com (Look for my articles) http://pear.php.net/manual/en/ http://www.packtpub.com/PEAR-Installer/book [email_address] Resources