Rex::Apache::Deploy::Symlink - Deploy application and symlink to live
With this module you can deploy an application to a special folder and after that you can symlink it to the document root.
generate_deploy_directory { my ($file) = @_; $file =~ m/(\d+\.\d+)/; return $1; }; deploy_to "/data/myapp"; document_root "/var/www/html"; task "dodeploy", "server1", sub { deploy "myapp-1.2.tar.gz"; }; task "dodeploy", "server1", sub { deploy "myapp", version => "1.2"; };
This function will do the deployment. It uploads the file to the target server and extract it to the directory given by deploy_to concatenated with the return value of generate_deploy_directory.
task "dodeploy", "server1", sub { deploy "myapp-1.2.tar.gz"; }; task "dodeploy", "server1", sub { deploy "myapp", version => "1.2"; };
This function returns all available versions from the directory defined by deploy_to as an array.
This function switches to the given version.
task "switch", "server1", sub { my $param = shift; switch_to_version $param->{version}; };
This function returns the current live version.
This function sets the directory where the uploaded archives should be extracted. This is not the document root of your webserver.
deploy_to "/data/myapp";
This function sets the document root of your webserver. This will be a symlink to the deployed application.
If you need a special directory naming of your uploaded version you can define it with this function.
The default function is:
sub { my ($file) = @_; if($file =~ m/-([0-9\._~\-]+)\.(zip|tar\.gz|war|tar\.bz2|jar)$/) { return $1; } else { return "" . time; } };
To install Rex::Apache::Deploy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rex::Apache::Deploy
CPAN shell
perl -MCPAN -e shell install Rex::Apache::Deploy
For more information on module installation, please visit the detailed CPAN module installation guide.