Created
May 22, 2012 11:46
-
-
Save shun0102/2768555 to your computer and use it in GitHub Desktop.
td-agentデプロイ用のcapistranoレシピ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :config_file, "config/upload/fluent_#{stage}.conf" | |
set :fluent_plugins, ["file-alternative", "mongo"] | |
namespace :td do | |
task :start, :roles => :fluentd do | |
run "#{try_sudo} /etc/init.d/td-agent start" | |
end | |
task :stop, :roles => :fluentd do | |
run "#{try_sudo} /etc/init.d/td-agent stop" | |
end | |
task :restart, :roles => :fluentd do | |
run "#{try_sudo} /etc/init.d/td-agent restart" | |
end | |
task :reload, :roles => :fluentd do | |
run "#{try_sudo} /etc/init.d/td-agent reload" | |
end | |
task :flush, :roles => :fluentd do | |
run "#{try_sudo} pkill -USR1 td-agent" | |
end | |
task :setup, :roles => :fluentd do | |
tmp = "#{shared_path}/config/tmp" | |
upload(config_file, tmp) | |
td_config = "/etc/td-agent/td-agent.conf" | |
run "#{try_sudo} mv #{tmp} #{td_config}" | |
run "#{try_sudo} mkdir -p /var/log/td-agent/#{application}" | |
run "#{try_sudo} chown td-agent:td-agent /var/log/td-agent/#{application}" | |
restart | |
end | |
task :gem_install, :roles => :fluentd do | |
fluent_gem = "/usr/lib64/fluent/ruby/bin/fluent-gem" | |
plugins = fluent_plugins.map{ |i| "fluent-plugin-#{i}"}.join(" ") | |
run "#{try_sudo} #{fluent_gem} install #{plugins}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment