App-BundleDeps
view release on metacpan or search on metacpan
lib/App/BundleDeps.pm view on Meta::CPAN
my @cmd = ('cpanm', '--skip-installed');
if ($self->notest) {
push @cmd, '--notest';
}
push @cmd, @{ $self->deps };
system(@cmd);
}
1;
__END__
=head1 NAME
App::BundleDeps - Bundle All Your Module Deps In A local::lib Dir
=head1 SYNOPSIS
use App::BundleDeps;
App::BundleDeps->new()->bundle_from_meta( 'META.yml' );
# or
my @modules = ( $module1, $module2, $module3, ... );
App::BundleDeps->new()->bundle_modules( @modules );
=head1 DESCRIPTION
App::BundleDeps is a tool that allows you to "bundle" all your prerequisites in one local::lib installation. This is very useful when you want to deploy your application.
=head1 SCENARIO
Here, I'm going to show how to deploy a Catalyst application using App::BundleDeps and daemontools.
So, suppose you checked out / downloaded your production ready application here:
/home/apps/MyApp-0.89
Move to that directory, and create your bundle:
cd /home/apps/MyApp-0.89
perl Makefile.PL NO_META=0
perl -MApp::BundleDeps -e 'App::BundleDeps->new->bundle_from_meta("META.yml");'
You obviously have to have Makefile.PL setup so that it includes all the necessary prerequisites.
At this point you should have a directory named C<extlib>. Now prep your daemontools environemnt like so: First create the necessary directory structure (do it where svscan isn't watching)
mkdir /var/lib/svscan/MyApp-0.89
Now move to that directory, and create a C<run> script file. We'll assume we're deploying a fastcgi server:
#!/bin/sh
MYAPP_DIR=/home/apps/MyApp-0.89
PERL=/usr/local/bin/perl # I like to explicitly declare this, YMMV
# XXX - You may have to specify MYAPP_HOME/MYAPP_CONFIG
exec setuidgid app \
$PERL \
-Mlocal::lib=$MYAPP_DIR/extlib \
$MAYPP_DIR/script/myapp_fastcgi.pl \
-e \
-l /path/to/socket \
2>&1
You should probably set up run script for logging, but see the daemontools manual for that.
Now, create a symlink to where svscan is watching, typically /service or /etc/service:
ln -s /var/lib/svscan/MyApp-0.89 /service/MyApp-0.89
And your service should start.
This is especially useful, because when you come up with MyApp-0.90, you can simply follow the same steps and deploy MyApp-0.90 with its own set of prerequisites (you don't have to care what MyApp-0.89 was using, or what the system installed module v...
rm /service/MyApp-0.89
svc -dx /var/lib/svscan/MyApp-0.89
svc -dx /var/lib/svscan/MyApp-0.89/log
Woohoo, done!
=head1 CAVEATS
=over 4
=item Prerequisites marked as "recommends" are not installed
=item Tests will not be run
=back
=head1 AUTHOR
Daisuke Maki - C<< <daisuke@endeworks.jp> >>
Miyagawa Tatsuhiko did the actual useful bits.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
=cut
( run in 1.546 second using v1.01-cache-2.11-cpan-ceb78f64989 )