]> git.openstreetmap.org Git - chef.git/commitdiff
nginx: allow custom cache folder path, apply on longma
authorGrant Slater <git@firefishy.com>
Wed, 6 Nov 2019 00:18:38 +0000 (00:18 +0000)
committerGrant Slater <git@firefishy.com>
Wed, 6 Nov 2019 00:18:38 +0000 (00:18 +0000)
cookbooks/nginx/attributes/default.rb
cookbooks/nginx/recipes/default.rb
cookbooks/nginx/templates/default/nginx.conf.erb
roles/longma.rb

index 30eb12bcc1f30326b138f3e65bd99dcf5b29ed9a..c6e77de0ad4d89a102e2b94eb9807112fdb12948 100644 (file)
@@ -3,12 +3,14 @@ default[:nginx][:access_log] = "/var/log/nginx/access.log"
 
 # Tuning for nginx fastcgi cache zone
 default[:nginx][:cache][:fastcgi][:enable] = false
+default[:nginx][:cache][:fastcgi][:directory] = "/var/cache/nginx/fastcgi-cache"
 default[:nginx][:cache][:fastcgi][:keys_zone] = "fastcgi_cache_zone:48M"
 default[:nginx][:cache][:fastcgi][:inactive] = "45d"
 default[:nginx][:cache][:fastcgi][:max_size] = "8192M"
 
 # Tuning for nginx proxy cache zone
 default[:nginx][:cache][:proxy][:enable] = false
+default[:nginx][:cache][:proxy][:directory] = "/var/cache/nginx/proxy-cache"
 default[:nginx][:cache][:proxy][:keys_zone] = "proxy_cache_zone:48M"
 default[:nginx][:cache][:proxy][:inactive] = "45d"
 default[:nginx][:cache][:proxy][:max_size] = "8192M"
index ae6fb2362c71fd7ead8d3a85de1b9debec67fbbc..93aab56906afd96dabce0acc328ffbc0a3ff5a62 100644 (file)
@@ -31,17 +31,19 @@ template "/etc/nginx/nginx.conf" do
   variables :resolvers => resolvers
 end
 
-directory "/var/cache/nginx/fastcgi-cache" do
+directory node[:nginx][:cache][:fastcgi][:directory] do
   owner "www-data"
   group "root"
   mode 0o755
+  recursive true
   only_if { node[:nginx][:cache][:fastcgi][:enable] }
 end
 
-directory "/var/cache/nginx/proxy-cache" do
+directory node[:nginx][:cache][:proxy][:directory] do
   owner "www-data"
   group "root"
   mode 0o755
+  recursive true
   only_if { node[:nginx][:cache][:proxy][:enable] }
 end
 
index 7422f2f2041d60301f17fb0e177dba248984c074..a3f6b241181d74bff40632564f228d204665ed65 100644 (file)
@@ -51,10 +51,10 @@ http {
     resolver_timeout 5s;
 
     <% if node['nginx']['cache']['fastcgi']['enable'] -%>
-    fastcgi_cache_path /var/cache/nginx/fastcgi-cache levels=2:2:2 use_temp_path=off keys_zone=<%= node['nginx']['cache']['fastcgi']['keys_zone'] %> inactive=<%= node['nginx']['cache']['fastcgi']['inactive'] %> max_size=<%= node['nginx']['cache']['fastcgi']['max_size'] %>;
+    fastcgi_cache_path <%= node['nginx']['cache']['fastcgi']['directory'] %> levels=2:2:2 use_temp_path=off keys_zone=<%= node['nginx']['cache']['fastcgi']['keys_zone'] %> inactive=<%= node['nginx']['cache']['fastcgi']['inactive'] %> max_size=<%= node['nginx']['cache']['fastcgi']['max_size'] %>;
     <% end -%>
     <% if node['nginx']['cache']['proxy']['enable'] -%>
-    proxy_cache_path /var/cache/nginx/proxy-cache levels=2:2:2 use_temp_path=off keys_zone=<%= node['nginx']['cache']['proxy']['keys_zone'] %> inactive=<%= node['nginx']['cache']['proxy']['inactive'] %> max_size=<%= node['nginx']['cache']['proxy']['max_size'] %>;
+    proxy_cache_path <%= node['nginx']['cache']['proxy']['directory'] %> levels=2:2:2 use_temp_path=off keys_zone=<%= node['nginx']['cache']['proxy']['keys_zone'] %> inactive=<%= node['nginx']['cache']['proxy']['inactive'] %> max_size=<%= node['nginx']['cache']['proxy']['max_size'] %>;
     <% end -%>
 
     # Internal site for munin monitoring
index 6639332e32f1d15736ec153527bd85c35f0c5594..0cf93f0cb8441f764e6f8ad07d5d664974618c2c 100644 (file)
@@ -31,6 +31,13 @@ default_attributes(
     :cache_mem => "12500 MB",
     :cache_dir => "coss /store/squid/coss-01 128000 block-size=8192 max-size=262144 membufs=80"
   },
+  :nginx => {
+    :cache => {
+      :proxy => {
+        :directory => "/store/nginx-cache/proxy-cache"
+      }
+    }
+  },
   :tilecache => {
     :tile_parent => "hsinchu.render.openstreetmap.org",
     :tile_siblings => [