website releases made easy with the pear installer - barcelona 2008

Download Website releases made easy with the PEAR installer - Barcelona 2008

If you can't read please download the document

Upload: helgi-bormar-borbjoernsson

Post on 16-Apr-2017

880 views

Category:

Technology


1 download

TRANSCRIPT

Website releases made easy with the PEAR installer

Helgi ormar orbjrnsson

[email protected]

FrOSCon 2008

24 / 08 / 2008

Who am I ?

An Icelandic guy with a weird name

iBuildings UK

PEAR Group member

PEAR Developer Among other the installer

pear.php.net maintainer

PEAR ;-)

How to pronounce my last name

ormar orbjrnsson 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 / deployment

etc etc etc

PEAR installer features to the rescue

Easy upgrading

Custom tasks

Post install tasks

PEAR installer features to the rescue

Custom file roles

Able to depend on PEAR installable packages

Easier to split the site up into smaller parts and handle them like their own releases

Last but not least

Tasks, custom roles and so on are all done with something we are familiar with ......

What's required

The PEAR installer

Knowledge how to package up your code with PEAR installer

A bit of know how and RTFM skills

And not be afraid of reading the source ;-)

Dismantling your site

Split your site into logical pieces

Don't split it into as many packages as you can!

Micro management is bad, mmmkay

Dismantling your site

Each piece gets its own package.xml

The website it self has a package.xml and all the other pieces will depend on it

Dismantling your site

Website

Web Services

Backend

Frontend

Forum

The packages we get

Website

Website_WebServices

Website_Frontend

Website_Backend

Website_Forum

Custom file roles

This feature allows you to write your own file role

PEAR supports php, data, test, www, src by default

People have been using them for various whacky things

In relation to templates

Custom handling of data files

And more things, the sky is the limit

Post install tasks

Handy feature for all the family

Write a simple PHP task that you can run after installation

Clean up after the installation, tmp dirs etc

DB setup tool

Prime caches

And just whatever 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.phppearweb: Use "pear run-scripts pear/pearweb" to finish setup.DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES

Post install tasks

askdb yesno Install database? yesno y

Post install tasks

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 succeededUpdate pearweb database? [y] :

Post install tasks

Add more tasks:param to tasks:paramgroups to so the user gets more questions per task id

Has the ability to skip a param group based on user input

tasks:type 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

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

?

[email protected]

Resources

http://c7y.phparch.com (Look for my articles)

http://pear.php.net/manual/en/

http://www.packtpub.com/PEAR-Installer/book