]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/recipes/default.rb
Use string for file modes in remote_directory resources
[chef.git] / cookbooks / planet / recipes / default.rb
1 #
2 # Cookbook:: planet
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 #     https://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 include_recipe "accounts"
21 include_recipe "apache"
22 include_recipe "munin"
23
24 package %w[
25   perl
26   php-cli
27 ]
28
29 remote_directory "/store/planet#html" do
30   path "/store/planet"
31   source "html"
32   owner "root"
33   group "root"
34   mode "0755"
35   files_owner "root"
36   files_group "root"
37   files_mode "644"
38 end
39
40 remote_directory "/store/planet#cgi" do
41   path "/store/planet"
42   source "cgi"
43   owner "root"
44   group "root"
45   mode "755"
46   files_owner "root"
47   files_group "root"
48   files_mode "755"
49 end
50
51 remote_directory node[:planet][:dump][:xml_history_directory] do
52   source "history_cgi"
53   owner "www-data"
54   group "planet"
55   mode "775"
56   files_owner "root"
57   files_group "root"
58   files_mode "755"
59 end
60
61 remote_directory "/store/planet/cc-by-sa/full-experimental" do
62   source "ccbysa_history_cgi"
63   owner "www-data"
64   group "planet"
65   mode "775"
66   files_owner "root"
67   files_group "root"
68   files_mode "755"
69 end
70
71 [:xml_directory, :xml_history_directory,
72  :pbf_directory, :pbf_history_directory].each do |dir|
73   directory node[:planet][:dump][dir] do
74     owner "www-data"
75     group "planet"
76     mode "775"
77   end
78 end
79
80 directory "/store/planet/notes" do
81   owner "www-data"
82   group "planet"
83   mode "775"
84 end
85
86 template "/usr/local/bin/apache-latest-planet-filename" do
87   source "apache-latest-planet-filename.erb"
88   owner "root"
89   group "root"
90   mode "755"
91   notifies :restart, "service[apache2]"
92 end
93
94 apache_module "cgid"
95 apache_module "rewrite"
96 apache_module "proxy_http"
97 apache_module "ratelimit"
98
99 ssl_certificate "planet.openstreetmap.org" do
100   domains ["planet.openstreetmap.org", "planet.osm.org"]
101   notifies :reload, "service[apache2]"
102 end
103
104 apache_site "planet.openstreetmap.org" do
105   template "apache.erb"
106 end
107
108 template "/etc/logrotate.d/apache2" do
109   source "logrotate.apache.erb"
110   owner "root"
111   group "root"
112   mode "644"
113 end
114
115 munin_plugin "planet_age"
116
117 template "/usr/local/bin/old-planet-file-cleanup" do
118   source "old-planet-file-cleanup.erb"
119   owner "root"
120   group "root"
121   mode "755"
122 end
123
124 cron_d "old-planet-file-cleanup" do
125   comment "run this on the first monday of the month at 3:44am"
126   minute "44"
127   hour "3"
128   day "1-7"
129   user "www-data"
130   command "test $(date +\%u) -eq 1 && /usr/local/bin/old-planet-file-cleanup --debug"
131   mailto "zerebubuth@gmail.com"
132 end