Website releases made easy with the PEAR installer - Barcelona 2008


Published on

Ever wondered if there is a easier way to manage releases for your website ? You will learn how to harness the power of the PEAR installer to make the release process as lean, mean and slick as possible so even your interns will be able to handle it.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Website releases made easy with the PEAR installer - Barcelona 2008

  1. 1. Website releases made easy with the PEAR installer Helgi Þormar Þorbjörnsson [email_address] FrOSCon 2008 24 / 08 / 2008
  2. 2. Who am I ? <ul><li>An Icelandic guy with a weird name </li></ul><ul><li>iBuildings UK </li></ul><ul><li>PEAR Group member </li></ul><ul><li>PEAR Developer – Among other the installer </li></ul><ul><li> maintainer </li></ul><ul><li>PEAR <insert-job-title> ;-) </li></ul>
  3. 3. How to pronounce my last name <ul><li>Þormar Þorbjörnsson being my last name </li></ul><ul><li>ASCII version being Thormar Thorbjoernsson </li></ul><ul><li>Þ = Th and pronounced like That or a Thorn </li></ul><ul><li>Now you are more enlightened about this Icelandic thing called Thorn </li></ul>
  4. 4. Alternative, not a replacement <ul><ul><li>Deploying websites with the PEAR installer is an alternative, not a replacement for other approaches </li></ul></ul>
  5. 5. Other alternatives <ul><li>FTP upload </li></ul><ul><li>SCP / rsync </li></ul><ul><li>Capistrano </li></ul><ul><li>SVN / CVS / <insert fancy VC here> deployment </li></ul><ul><li>etc etc etc </li></ul>
  6. 6. PEAR installer features to the rescue <ul><li>Easy upgrading </li></ul><ul><li>Custom tasks </li></ul><ul><li>Post install tasks </li></ul>
  7. 7. PEAR installer features to the rescue <ul><li>Custom file roles </li></ul><ul><li>Able to depend on PEAR installable packages </li></ul><ul><li>Easier to split the site up into smaller parts and handle them like their own releases </li></ul>
  8. 8. Last but not least <ul><ul><li>Tasks, custom roles and so on are all done with something we are familiar with ...... </li></ul></ul>
  9. 10. What's required <ul><li>The PEAR installer </li></ul><ul><li>Knowledge how to package up your code with PEAR installer </li></ul><ul><li>A bit of know how and RTFM skills </li></ul><ul><li>And not be afraid of reading the source ;-) </li></ul>
  10. 11. Dismantling your site <ul><li>Split your site into logical pieces </li></ul><ul><li>Don't split it into as many packages as you can! </li></ul><ul><li>Micro management is bad, mmmkay </li></ul>
  11. 12. Dismantling your site <ul><li>Each piece gets its own package.xml </li></ul><ul><li>The website it self has a package.xml and all the other pieces will depend on it </li></ul>
  12. 13. Dismantling your site Web Services Backend Frontend Forum Website
  13. 14. The packages we get <ul><li>Website </li></ul><ul><li>Website_WebServices </li></ul><ul><li>Website_Frontend </li></ul><ul><li>Website_Backend </li></ul><ul><li>Website_Forum </li></ul>
  14. 15. Custom file roles <ul><li>This feature allows you to write your own file role </li></ul><ul><li>PEAR supports php, data, test, www, src by default </li></ul><ul><li>People have been using them for various whacky things </li></ul><ul><ul><li>In relation to templates </li></ul></ul><ul><ul><li>Custom handling of data files </li></ul></ul><ul><ul><li>And more things, the sky is the limit </li></ul></ul>
  15. 16. Post install tasks <ul><li>Handy feature for all the family </li></ul><ul><li>Write a simple PHP task that you can run after installation </li></ul><ul><ul><li>Clean up after the installation, tmp dirs etc </li></ul></ul><ul><ul><li>DB setup tool </li></ul></ul><ul><ul><li>Prime caches </li></ul></ul><ul><ul><li>And just whatever you can dream up </li></ul></ul>
  16. 17. 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
  17. 18. Post install tasks <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>
  18. 19. Post install tasks 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 Update pearweb database? [y] :
  19. 20. Post install tasks <ul><li>Add more tasks:param to tasks:paramgroups to so the user gets more questions per task id </li></ul><ul><li>Has the ability to skip a param group based on user input </li></ul><ul><li>tasks:type has 3 different types </li></ul><ul><ul><li>string </li></ul></ul><ul><ul><li>password </li></ul></ul><ul><ul><li>yesno </li></ul></ul>
  20. 21. 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:
  21. 22. Real world example <ul><li> </li></ul><ul><li> </li></ul><ul><li> </li></ul>In package.xml look for pearweb.php and you see how we do it for Good place to study how things are built up
  22. 23. Puzzling the pieces together <ul><li>Now we run these pseudo packages and we want to install only part of our website structure </li></ul><ul><li>pear install –alldeps Website_WebServices Website_Frontend Website_Backend </li></ul><ul><li>This will install your only those 3 parts of your website along site all the deps which one of those is the Website. </li></ul>
  23. 24. Puzzling the pieces together Web Services Backend Frontend Website
  24. 25. Questions ? [email_address]
  25. 26. Resources <ul><li> (Look for my articles) </li></ul><ul><li> </li></ul><ul><li> </li></ul>