Commit cfd6592f

mo khan <mo@mokhan.ca>
2013-08-31 14:31:53
add logrotate recipe
1 parent de81c17
Changed files (3)
config/recipes/templates/logrotate.erb
@@ -0,0 +1,9 @@
+<%= shared_path %>/log/*.log {
+  daily
+  missingok
+  rotate 52
+  compress
+  delaycompress
+  notifempty
+  copytruncate
+}
config/recipes/logrotate.rb
@@ -0,0 +1,8 @@
+namespace :logrotate do
+  desc "setup logrotate configuration"
+  task :setup do
+    template "logrotate.erb", "/tmp/logrotate_conf"
+    run "#{sudo} mv /tmp/logrotate_conf /etc/logrotate.d/#{application}"
+  end
+  after "deploy:setup", "logrotate:setup"
+end
config/deploy.rb
@@ -10,6 +10,7 @@ load "config/recipes/delayed_job"
 #load "config/recipes/rvm"
 load "config/recipes/rbenv"
 load "config/recipes/monit"
+load "config/recipes/logrotate"
 load "config/tasks/utility"
 load "config/tasks/rails"