Manage Website deployments (for PHP, Perl, Tomcat, ...)
Perl
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
debian
doc
lib/Rex/Apache
t
.gitignore
ChangeLog
LICENSE
MANIFEST
MANIFEST.SKIP
Makefile.PL
README.pod

README.pod

rex-apache-deploy is a (R)?ex module to deploy webservers.

You can find (R)?ex under http://rexify.org/

Usage

In your Rexfile use the following commands.

To build a package

use Rex::Apache::Build;
    
get_version_from "lib/MyApp.pm", qr{\$VERSION=([^;]+);};
   
task "build", sub {
   yui compress => glob("public/js/*.js"), glob("public/css/*.css");
       
   # build a package named like the directory
   # and append the version from get_version_from
   build;
         
   # build a package named myapp
   # and append the version from get_version_from
   build "myapp";
        
   # build a package named myapp and append the version 1.5
   build "myapp",
      version => "1.5";
       
   # build a package myapp, with version 1.5 and exclude some files
   # but use the path "./myapp" as package root
   build "myapp",
      version => "1.5",
      path    => "myapp",
      exclude => ["yuicompressor.jar", "README"];
};

To inject special configuration parameters for different environments

use Rex::Apache::Inject YAML;

template_file "inject.conf";
template_search_for "application.yml";

desc "Inject Configuration";
task "inject", sub {

  inject "myapp-1.0.tar.gz",
              pre_pack_hook => sub {
                 run "BUNDLE_PATH=vendor/bundle bundle install";
              },
              post_pack_hool => sub {
                 say "Hello, i'm the post pack hook\n";
              };

};

Deploy the package

deploy_to "/path/to/deploy/to";
document_root "/var/www/html";

# set this if your package format isn't
# packagename-version.file-suffix
# example: myapp-1.2.tar.gz
#          myapp-1.3.1.zip
#          myapp-1.3~1.tar.bz2
#          myapp-1.5.2_1.tar.bz2
generate_deploy_directory sub {
   return $VERSION;
};

desc "Deploy Package";
task "deploy", group => "fe", sub {
   # just deploy
   deploy;
        
   # or to deploy a specific package
   deploy "myapp-1.0.tar.gz";
};