]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/nominatim/recipes/default.rb
download external nominatim data
[chef.git] / cookbooks / nominatim / recipes / default.rb
index 3f490b2727741a1c2e8c8bef77459f31c6d6dfaa..3490d91e1c5fdc46dcc779958de457543f116ebe 100644 (file)
@@ -61,6 +61,10 @@ apache_site "nominatim.openstreetmap.org" do
   variables :pools => node[:nominatim][:fpm_pools]
 end
 
+apache_site "default" do
+  action [ :disable ]
+end
+
 node[:nominatim][:fpm_pools].each do |name,data|
   template "/etc/php5/fpm/pool.d/#{name}.conf" do
     source "fpm.conf.erb"
@@ -174,6 +178,7 @@ template "#{source_directory}/settings/local.php" do
   owner "nominatim"
   group "nominatim"
   mode 0664
+  variables :postgres_version => database_version
 end
 
 template "#{source_directory}/settings/ip_blocks.conf" do
@@ -204,41 +209,15 @@ else
   cron_action = :delete
 end
 
-cron "nominatim_logrotate" do
-  action cron_action
-  hour "5"
-  minute "30"
-  weekday "0"
-  command "#{source_directory}/utils/cron_logrotate.sh"
-  user "nominatim"
-  mailto email_errors
-end
-
-cron "nominatim_banip" do
-  action cron_action
-  command "#{source_directory}/utils/cron_banip.py"
-  user "nominatim"
-  mailto email_errors
-end
-
-cron "nominatim_vacuum" do
+template "/etc/cron.d/nominatim" do
   action cron_action
-  hour "2"
-  minute "00"
-  command "#{source_directory}/utils/cron_vacuum.sh"
-  user "nominatim"
-  mailto email_errors
+  source "cron.erb"
+  owner "root"
+  group "root"
+  mode "0644"
+  variables :bin_directory => "#{source_directory}/utils", :mailto => email_errors
 end
 
-['search', 'reverse'].each do |filename|
-  ['phpj', 'phpx'].each do |ext|
-    link "#{source_directory}/website/#{filename}.#{ext}" do
-      to "#{source_directory}/website/#{filename}.php"
-      user "nominatim"
-      group "nominatim"
-    end
-  end
-end
 
 template "#{source_directory}/utils/nominatim-update" do
   source "updater.erb"
@@ -264,17 +243,41 @@ munin_plugin "nominatim_importlag" do
 end
 
 munin_plugin "nominatim_query_speed" do
-  target "#{source_directory}/munin/nominatim_query_speed"
+  target "#{source_directory}/munin/nominatim_query_speed_querylog"
 end
 
 munin_plugin "nominatim_requests" do
-  target "#{source_directory}/munin/nominatim_requests"
+  target "#{source_directory}/munin/nominatim_requests_querylog"
 end
 
 munin_plugin "nominatim_throttled_ips" do
   target "#{source_directory}/munin/nominatim_throttled_ips"
 end
 
+remote_file "#{source_directory}/data/wikipedia_article.sql.bin" do
+  action :create_if_missing
+  source "http://www.nominatim.org/data/wikipedia_article.sql.bin"
+  owner  "nominatim"
+  group  "nominatim"
+  mode   0644
+end
+
+remote_file "#{source_directory}/data/wikipedia_redirect.sql.bin" do
+  action :create_if_missing
+  source "http://www.nominatim.org/data/wikipedia_redirect.sql.bin"
+  owner  "nominatim"
+  group  "nominatim"
+  mode   0644
+end
+
+remote_file "#{source_directory}/data/gb_postcode_data.sql.gz" do
+  action :create_if_missing
+  source "http://www.nominatim.org/data/gb_postcode_data.sql.gz"
+  owner  "nominatim"
+  group  "nominatim"
+  mode   0644
+end
+
 template "/usr/local/bin/backup-nominatim" do
   source "backup-nominatim.erb"
   owner "root"
@@ -282,12 +285,10 @@ template "/usr/local/bin/backup-nominatim" do
   mode 0755
 end
 
-cron "nominatim_backup" do
-  action cron_action
-  hour "3"
-  minute "00"
-  day "1"
-  command "/usr/local/bin/backup-nominatim"
-  user "nominatim"
-  mailto email_errors
+directory File.dirname(node[:nominatim][:flatnode_file]) do
+  owner "nominatim"
+  group "nominatim"
+  mode 0755
+  recursive true
 end
+