Apache::Deploy是一个">Apache模块和WAR文件配置到Tomcat服务器的工具。它简化了多台服务器的部署过程。
Apache::Deploy 0.7.0版本增加了对Coffeescript, Sass和Sprockets支持。
使用示范:(https://github.com/krimdomu/rex-apache-deploy)
在你的Rexfile文件中使用以下命令,建立一个软件包:
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"];
};
为不同的环境写入配置参数:
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 "568.html">Hello, i'm the post pack hook\n";
};
};
配置这个软件包:
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";
};