]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tilecache/recipes/default.rb
squid: do not log icp queries
[chef.git] / cookbooks / tilecache / recipes / default.rb
1 #
2 # Cookbook Name:: tilecache
3 # Recipe:: default
4 #
5 # Copyright 2011, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 node.default[:ssl][:certificates] = node[:ssl][:certificates] | [ "tile.openstreetmap" ]
21
22 include_recipe "ssl"
23 include_recipe "squid"
24 include_recipe "nginx"
25
26 package "xz-utils"
27
28 tilecaches = search(:node, "roles:tilecache").sort_by { |n| n[:hostname] }
29 tilerenders = search(:node, "roles:tile").sort_by { |n| n[:hostname] }
30
31 tilecaches.each do |cache|
32   cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address|
33     firewall_rule "accept-squid" do
34       action :accept
35       family "inet"
36       source "net:#{address}"
37       dest "fw"
38       proto "tcp:syn"
39       dest_ports "3128"
40       source_ports "1024:"
41     end
42     firewall_rule "accept-squid-icp" do
43       action :accept
44       family "inet"
45       source "net:#{address}"
46       dest "fw"
47       proto "udp"
48       dest_ports "3130"
49       source_ports "1024:"
50     end
51   end
52 end
53
54 squid_fragment "tilecache" do
55   template "squid.conf.erb"
56   variables :caches => tilecaches, :renders => tilerenders
57 end
58
59 template "/etc/logrotate.d/squid" do
60   source "logrotate.squid.erb"
61   owner "root"
62   group "root"
63   mode 0644
64 end
65
66 nginx_site "default" do
67   action [ :delete ]
68 end
69
70 nginx_site "tile-ssl" do
71   template "nginx_tile_ssl.conf.erb"
72 end
73