NAME

Rex::Apache::Deploy - Deploy module for Rex

DESCRIPTION

This is a (R)?ex module to ease the deployments of Tomcat, Perl, Rails, PHP or other languages.

You can find examples and howtos on http://rexify.org/

GETTING HELP

DEPENDENCIES

If you're using windows, you can install them from here: http://sourceforge.net/projects/gnuwin32/files/ Don't forget to add the bin directory of the installation to your %PATH% environment variable.

SYNOPSIS

use Rex::Apache::Deploy Symlink;

deploy_to "/var/deploy";

document_root "/var/www/myhost/htdocs";

generate_deploy_directory sub {
   my ($file) = @_;
   $file =~ m/-(\d+\.\d+\.\d+)\.tar\.gz$/;
   return $1;
};

desc "Deploy to Apache";
task "deploy", group => "frontend", sub {
   deploy "mypkg-1.0.1.tar.gz";
};

DEPLOY METHODS

This method will upload your package (*.tar.gz, *.tar.bz2 or *.zip) all you servers and extract it in the directory you specified with deploy_to concatenated with the result of generate_deploy_directory. After that it will create a symlink from document_root to this new directory.

deploy_to "/var/deploy";
document_root "/var/www";
generate_deploy_directory sub { return "1.0"; };

This will upload the file to /var/deploy/1.0 and create a symlink from /var/www to /var/deploy/1.0.

Tomcat

This method is for Tomcat deployments. You need to have the Tomcat Manage application running on your Tomcat servers. It will upload your package to /tmp/some-random-chars.war, call the Tomcat Manager to undeploy the current context and deploy the new war archive. After that it will delete the uploaded temporary war file.

context_path "/myapp";

task "deploy", group => "middleware", sub {
    deploy "myapp.war",
        username    => "manager-user",
        password    => "manager-password",
        port        => 8080,
        manager_url =>  "/manager";
};

This will deploy myapp.war to the tomcat listening on port 8080 with the manager application found under http://the-server:8080/manager.

SWITCHING INSTANCES

If you have multiple Tomcat Instances you can manage them with the jk command.

jk disable => 'name';
jk enable  => 'name';