Permalink
Browse files

add basic crons for chef-server: compact daily couchdb and trim down …

…older solr logs
  • Loading branch information...
mdxp committed Aug 24, 2012
1 parent 06286ee commit 676434a3cfa52d87c884b1a20da99326ec0e5521
Showing with 22 additions and 1 deletion.
  1. +2 −1 chef.json
  2. +20 −0 cookbooks/chef-server/recipes/cron.rb
View
@@ -13,6 +13,7 @@
},
"run_list": [
"recipe[chef-server::rubygems-install]",
- "recipe[chef-server::nginx-proxy]"
+ "recipe[chef-server::nginx-proxy]",
+ "recipe[chef-server::cron]"
]
}
@@ -0,0 +1,20 @@
+cron 'Compact Chef DB' do
+ user 'root'
+ hour '1'
+ minute '0'
+ command 'curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact > /dev/null 2>&1'
+end
+
+cron 'Compact Chef Views' do
+ user 'root'
+ hour '1'
+ minute '30'
+ command 'bash -c \'for x in checksums clients cookbooks data_bags environments id_map nodes roles sandboxes users; do curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact/$x ; done\' > /dev/null 2>&1'
+end
+
+cron 'Clean-up solr logs older than 7 days' do
+ user 'root'
+ hour '3'
+ minute '0'
+ command 'find /var/lib/chef/solr/jetty/logs/* -mtime +7 -exec rm {} \;'
+end

0 comments on commit 676434a

Please sign in to comment.