App-Context

 view release on metacpan or  search on metacpan

lib/App/installguide/hosted.pod  view on Meta::CPAN


=head1 ASSUMPTIONS

 * You get command line access but not root.
 * You have access to a MySQL database engine (and permissions to create at least 3 databases)

=head1 SET UP THE CPAN SHELL

Installing software from CPAN into a non-system area requires a little setup.

 * Find CPAN/Config.pm and make a local copy of it to MyConfig.pm
 * Modify MyConfig.pm to use local directories

The first thing to do is to find CPAN/Config.pm.

 > which perl
 /usr/bin/perl

Since perl is installed in /usr/bin, the perl libraries are most likely stored in /usr/lib/perl5.

 > find /usr/lib/perl5 -name Config.pm -print
 /usr/lib/perl5/site_perl/5.8.7/x86_64-linux/Template/Config.pm
 /usr/lib/perl5/site_perl/5.8.7/Apache/Admin/Config.pm
 /usr/lib/perl5/5.8.5/CPAN/Config.pm
 /usr/lib/perl5/5.8.5/Net/Config.pm
 /usr/lib/perl5/5.8.7/x86_64-linux/Encode/Config.pm
 /usr/lib/perl5/5.8.7/x86_64-linux/Config.pm
 /usr/lib/perl5/5.8.7/CPAN/Config.pm
 /usr/lib/perl5/5.8.7/Net/Config.pm
 
Now make a copy of CPAN::Config.

 mkdir ~/.cpan
 mkdir ~/.cpan/CPAN
 cp /usr/lib/perl5/5.8.7/CPAN/Config.pm ~/.cpan/CPAN/MyConfig.pm

Now edit it.

 vi ~/.cpan/CPAN/MyConfig.pm

There might be lines like the following.

  'build_dir' => q[/root/.cpan/build],
  'cpan_home' => q[/root/.cpan],
  'histfile' => q[/root/.cpan/histfile],
  'keep_source_where' => q[/root/.cpan/sources],
  'makepl_arg' => q[],
  'make_install_arg' => q[UNINST=1],
  'mbuildpl_arg' => q[],

Change them to something like the following.

  'build_dir' => q[/home/username/.cpan/build],
  'cpan_home' => q[/home/username/.cpan],
  'histfile' => q[/home/username/.cpan/histfile],
  'keep_source_where' => q[/home/username/.cpan/sources],
  'makepl_arg' => q[PREFIX=/home/username],
  'make_install_arg' => q[],
  'mbuildpl_arg' => q[install_base=/home/username],

Then fire up the CPAN shell and install something. Then verify that it installed.

   # perl -MCPAN -e shell
   cpan> install App::Options
   cpan> exit
   # find ~/lib -name Options.pm -print
   /home/username/lib/perl5/site_perl/5.8.7/App/Options.pm

Yay. Success. We used the CPAN shell to install modules into our private perl
library directory.

=head1 A REASONABLE DEVELOPMENT PROCESS AND PROMOTION PATH

The advice of this section is highly subject to preference. What is described
here is a reasonable way to manage the development process of promoting code
changes and database changes from development through test into production.

We use one development environment. An "environment" is a top-level directory
which houses an instance of the application completely independent from the
next instance of the application. (An alternate style for slightly bigger
projects and teams would be to have one development "sandbox" environment
per developer, but I'll skip that here.)
The development environment points to the development database.

All environments that are not development environments are numbered
releases (or release candidates) (i.e. "1.0.0").  A numbered release
candidate of a web application is referred to as a test environment.
It is pointed to the test database until
all tests are completed and the release candidate is approved.
Then the release candidate is pointed to the production database, and
additional tests are performed that are not destructive to the data.

When it passes these final tests, it ceases to be a test environment
any longer, and it becomes the latest production environment.
A symbolic link is changed in order to point the "production" web
application to the latest numbered version.

=head1 PREPARING YOUR SOFTWARE ENVIRONMENT DIRECTORIES

First we choose a base direction where all software environment
directories will live.

   export PREFIX_BASE=$HOME/app

[Note: If you were doing this on a server where you had access to space
outside the home directory, you might make this something like
"/usr/mycompany" instead.]

Next, we prepare the environments.
We will assume that we are preparing a "devel" environment,
a single numbered release candidate "1.0.0" environment, and a symbolic
link for production that points to the "1.0.0" environment.

   mkdir $PREFIX_BASE
   mkdir $PREFIX_BASE/devel
   mkdir $PREFIX_BASE/devel/etc
   mkdir $PREFIX_BASE/devel/etc/app
   mkdir $PREFIX_BASE/devel/bin
   mkdir $PREFIX_BASE/devel/lib
   mkdir $PREFIX_BASE/devel/src
   mkdir $PREFIX_BASE/devel/data



( run in 2.302 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )