Website releases made easy with the PEAR installer - Barcelona 2008

  • 3,840 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,840
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
23
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Website releases made easy with the PEAR installer
      • Helgi Þormar Þorbjörnsson
    Barcelona PHP Conference, September 2008
  • 2. 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
  • 3. 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
  • 4. Alternative, not a replacement
      • Deploying websites with the PEAR installer is an alternative, not a replacement for other approaches.
  • 5. Other alternatives
    • FTP Upload
    • SCP / rsync
    • Capistrano
    • SVN / CVS / <insert fancy version control> deployment
    • etc etc etc
  • 6. 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
  • 7. PEAR Installer features to the rescue
    • Custom file roles
    • Custom tasks
    • Post installation tasks
  • 8. Last but not least
      • Tasks, custom file roles and so on are done with something we are familiar with ....
  • 9.  
  • 10. 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 ;-)
  • 11. Dismantling your site
    • Split your site into logical pieces
    • Do not split into as many packages as you can!
    • Micro management is bad, mmmmkay
  • 12. 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
  • 13. Dismantling your site Web Services Backend Frontend Forum Website
  • 14. The packages we get
    • Website
    • Website_Frontend
    • Website_WebServices
    • Website_Backend
    • Website_Forum
  • 15. 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)
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. 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>
  • 20. 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] :
  • 21. 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
  • 22. 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:
  • 23. 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
  • 24. 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.
  • 25. Puzzling the pieces together Web Services Backend Frontend Website
  • 26. Questions?
  • 27. Special thanks to Cal Evans for the elephpant photo!
  • 28. http://c7y.phparch.com (Look for my articles) http://pear.php.net/manual/en/ http://www.packtpub.com/PEAR-Installer/book [email_address] Resources