string(19) "ViewArticleOrg.html" Setup and Restore for Pman based Projects : roojs.org - open source
All Pman projects are component based, which means that each block of code is stored in a seperate repository (and maybe one day is installable using something like the pear installer...)

Code setup - Tarballs

If the project has been distributed as a tarball, just extract that tarball into a directory eg.
tar xvfz web.mtrack-XXX.tgz

Code setup - from git (for a development enviroment)

Pman projects consist of multiple components and libraries, at present the development enviroment is created using unix softlinks to put files and directories in the right place

To make this work I normally check everything out into the gitlive directory

mkdir ~/gitlive
cd ~/gitlive
git clone http://git.roojs.org/roojs1
git clone http://git.roojs.org/pear
git clone http://git.roojs.org/Pman.Base
git clone http://git.roojs.org/Pman.Core
git clone http://git.roojs.org/Pman.Admin

# any special libraries for the application
git clone http://git.roojs.org/Pman.MTrack

Then finally clone the application it'self.
git clone http://git.roojs.org/web.mtrack

Database creation

There is no 'install script' at present that creates the database I might change that one day, but as currently it's pretty simple to setup just do this.
mysqladmin -uroot create mtrack

If you want to create a database user for the application feel free to do that here..

Configuration

Configuration consists initially of just copying the example.index.php file to index.php (and maybe admin.php file if the project has one.)

Then modify the file to suit your enviroment.

the key lines to modify are usually

'database' =>  'mysql://USER:PASS@localhost/mtrack',
'Pman' => array(  // if the application stores images or files etc..  //this directory needs creating and giving www-data permissions.         'storedir' => '/home/edoc', ),

Database setup

at this point most of the file setup is complete, now the database needs initializing, since the base framework works both as a web application and a cli client all you do to run it is 

php index.php

(or in mtrack's example use admin.php, as admin.php is the Pman application, and index.php is the HTML webby front end.)

This will output the help instructions (trimmed down a bit here)

#php admin.php 
-------------------------------------------------
FlexyFramework Cli Application Usage:
#php -d include_path=.:/var/www/pear admin.php
or 
#php  admin.php
...... 
        
-------------------------------------------------
From: /home/alan/gitlive/web.mtrack/Pman/Core/Cli.php
    #php admin.php Core/RunGenerator
    Creates ALL database tables
    - does not change files, just shows you want would happen
        
.... 

The base package provides a few tools, like generating dataobjects code, and even javascript compression, however for our purpose we just run

#php admin.php Core/RunGenerator

This will just run mysql with the -f option at the command line and use the *.sql files in the input, it can be used to upgrade the database at any point if you pull an update and the database schema changes. (one day this should use the pear SQL Parser to generate code for other databases.. but not yet..

At this point the database and code should all be set up.


First access to the system.


At this point in the process, the system is a bit of a security mess (you probably do not want it to be publicly discoverable) as anyone accessing it would be prompted to create the administration account. - If security is a concern I suggest you create the admin.php file with a different name initially (you can rename the file later, and the application just 'works')


So now you can use a web browser and visit the url eg.
 http://www.example.com/web.mtrack/admin.php

You will be prompted for two things, first your companies details (name etc.), then your admin account details. After you have filled them in, it will reload the page and automatically log you in as this user. and off you go...



Restoring the application for a backup or moving from another location.


Restoration of the system is quite trivial, it assumes you have a database backup (eg. mtrack.sql), the code tarball and a backup of any of the files from the store directory

first extract all the code to the correct location. 
if you have a tarball of the code.
cd ~/mywebdir
tar xvfz www.mysite.com.tgz

then extract the data files to the correct location (or copy from wherever you backed them upto.
cd ~/myfiles
tar xvfz mydatafiles.tgz

then restore the database for the application as per the installation.

mysqladmin -uroot create mtrack
Then just import your backup into the database
mysql  -uroot < mtrack-backup-XXXX.sql

And that's it.. if apache is set up to point to the correct location, you should be ready to go.


Follow us on