X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/6872fc3e4707aa5e59eac2b5266b2ee5ebd43ed6..f1e386a2785e80de0e0626ff261d95869c184861:/cookbooks/nominatim/recipes/default.rb?ds=sidebyside diff --git a/cookbooks/nominatim/recipes/default.rb b/cookbooks/nominatim/recipes/default.rb index 64e484b39..6134c1d76 100644 --- a/cookbooks/nominatim/recipes/default.rb +++ b/cookbooks/nominatim/recipes/default.rb @@ -29,7 +29,8 @@ package "php-pear" package "php-apc" apache_module "rewrite" -apache_module "fastcgi-handler" +apache_module "proxy" +apache_module "proxy_fcgi" home_directory = data_bag_item("accounts", "nominatim")["home"] source_directory = "#{home_directory}/nominatim" @@ -42,7 +43,8 @@ database_name = node[:nominatim][:database][:dbname] postgis_version = node[:nominatim][:database][:postgis] service "php5-fpm" do - action [ :enable, :start ] + provider Chef::Provider::Service::Upstart + action [:enable, :start] supports :status => true, :restart => true, :reload => true end @@ -52,13 +54,17 @@ apache_site "nominatim.openstreetmap.org" do variables :pools => node[:nominatim][:fpm_pools] end -node[:nominatim][:fpm_pools].each do |name,data| +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" owner "root" group "root" mode 0644 - variables data.merge(:name => name) + variables data.merge(:name => name, :port => data[:port]) notifies :reload, "service[php5-fpm]" end end @@ -105,7 +111,6 @@ template "/etc/logrotate.d/nominatim" do mode 0644 end - package "osmosis" package "gcc" package "proj-bin" @@ -124,10 +129,14 @@ package "libproj-dev" package "libprotobuf-c0-dev" package "protobuf-c-compiler" package "python-psycopg2" +package "libboost-dev" +package "libboost-system-dev" +package "libboost-filesystem-dev" +package "libboost-thread-dev" execute "php-pear-db" do command "pear install DB" - not_if { File.exists?("/usr/share/php/DB") } + not_if { File.exist?("/usr/share/php/DB") } end execute "compile_nominatim" do @@ -151,12 +160,11 @@ directory "#{source_directory}/log" do mode 0755 end - template "#{source_directory}/.git/hooks/post-merge" do source "update_source.erb" - owner "nominatim" - group "nominatim" - mode 0755 + owner "nominatim" + group "nominatim" + mode 0755 variables :source_directory => source_directory end @@ -165,6 +173,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 @@ -189,51 +198,33 @@ file "#{source_directory}/settings/ip_blocks.map" do mode 0664 end -cron "nominatim_logrotate" do - hour "5" - minute "30" - weekday "0" - command "#{source_directory}/utils/cron_logrotate.sh" - user "nominatim" - mailto email_errors -end - -cron "nominatim_banip" do - command "#{source_directory}/utils/cron_banip.py" - user "nominatim" - mailto email_errors +if node[:nominatim][:enabled] + cron_action = :create +else + cron_action = :delete end -cron "nominatim_vacuum" do - hour "2" - minute "00" - command "#{source_directory}/utils/cron_vacuum.sh" - user "nominatim" - 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 +template "/etc/cron.d/nominatim" do + action cron_action + source "cron.erb" + owner "root" + group "root" + mode "0644" + variables :bin_directory => "#{source_directory}/utils", :mailto => email_errors end template "#{source_directory}/utils/nominatim-update" do source "updater.erb" - user "nominatim" - group "nominatim" - mode 0755 + user "nominatim" + group "nominatim" + mode 0755 end template "/etc/init.d/nominatim-update" do source "updater.init.erb" - user "nominatim" - group "nominatim" - mode 0755 + user "nominatim" + group "nominatim" + mode 0755 variables :source_directory => source_directory end @@ -246,17 +237,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" @@ -264,11 +279,9 @@ template "/usr/local/bin/backup-nominatim" do mode 0755 end -cron "nominatim_backup" do - 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