Skip to content
Manage Website deployments (for PHP, Perl, Tomcat, ...)
Find file
Latest commit de1648e @krimdomu krimdomu Merge pull request #7 from dsteinbrunner/patch-1

thanks for the patch.


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

You can find (R)?ex under


In your Rexfile use the following commands.

To build a package

 use Rex::Apache::Build;
 get_version_from "lib/", 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 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.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
    # or to deploy a specific package
    deploy "myapp-1.0.tar.gz";
Something went wrong with that request. Please try again.