]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/nginx/recipes/default.rb
Replace cron.d templates with cron_d resources
[chef.git] / cookbooks / nginx / recipes / default.rb
index 480937407b3c5421e93e6ca4e4ec5eb7a5044649..a7775c162644d1857b9940c2641f567d35d5a633 100644 (file)
 # limitations under the License.
 #
 
-package "nginx"
+include_recipe "apt"
+include_recipe "munin"
+include_recipe "ssl"
 
-resolvers = node[:networking][:nameservers].map do |resolver|
-  IPAddr.new(resolver).ipv6? ? "[#{resolver}]" : resolver
-end
+package "nginx"
 
 template "/etc/nginx/nginx.conf" do
   source "nginx.conf.erb"
   owner "root"
   group "root"
   mode 0o644
-  variables :resolvers => resolvers
 end
 
 directory node[:nginx][:cache][:fastcgi][:directory] do
@@ -50,7 +49,7 @@ end
 service "nginx" do
   action [:enable] # Do not start the service as config may be broken from failed chef run
   supports :status => true, :restart => true, :reload => true
-  subscribes :restart, "template[/etc/nginx/nginx.conf]", :immediately
+  subscribes :restart, "template[/etc/nginx/nginx.conf]"
 end
 
 munin_plugin_conf "nginx" do
@@ -61,3 +60,17 @@ package "libwww-perl"
 
 munin_plugin "nginx_request"
 munin_plugin "nginx_status"
+
+template "/usr/local/bin/nginx-old-cache-cleanup" do
+  source "nginx-old-cache-cleanup.erb"
+  owner "root"
+  group "root"
+  mode 0o755
+end
+
+cron_d "nginx-old-cache-cleanup" do
+  minute "15"
+  hour "23"
+  user "www-data"
+  command "/usr/bin/timeout 6h /usr/local/bin/nginx-old-cache-cleanup"
+end