X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/261e7e9cd1a9882faa4ed7087b5902ebafe25988..ee80e6af6c3df40a7b417fb6fb555dd450115c72:/cookbooks/nominatim/recipes/default.rb diff --git a/cookbooks/nominatim/recipes/default.rb b/cookbooks/nominatim/recipes/default.rb index dfa2df7c1..3f490b272 100644 --- a/cookbooks/nominatim/recipes/default.rb +++ b/cookbooks/nominatim/recipes/default.rb @@ -17,7 +17,7 @@ # limitations under the License. # -include_recipe "apache" +include_recipe "apache::ssl" include_recipe "postgresql" include_recipe "git" @@ -29,13 +29,28 @@ package "php-pear" package "php-apc" apache_module "rewrite" -apache_module "fastcgi-handler" + +if node[:lsb][:release].to_f >= 14.04 + apache_module "proxy" + apache_module "proxy_fcgi" +else + apache_module "fastcgi-handler" +end home_directory = data_bag_item("accounts", "nominatim")["home"] source_directory = "#{home_directory}/nominatim" email_errors = data_bag_item("accounts", "lonvia")["email"] +database_cluster = node[:nominatim][:database][:cluster] +database_version = database_cluster.sub(/\/.*/, "") +database_name = node[:nominatim][:database][:dbname] + +postgis_version = node[:nominatim][:database][:postgis] + service "php5-fpm" do + if node[:lsb][:release].to_f >= 14.04 + provider Chef::Provider::Service::Upstart + end action [ :enable, :start ] supports :status => true, :restart => true, :reload => true end @@ -47,44 +62,43 @@ apache_site "nominatim.openstreetmap.org" do 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 postgresql_user "tomh" do - cluster "9.1/main" + cluster database_cluster superuser true end postgresql_user "lonvia" do - cluster "9.1/main" + cluster database_cluster superuser true end postgresql_user "twain" do - cluster "9.1/main" + cluster database_cluster superuser true end postgresql_user "nominatim" do - cluster "9.1/main" + cluster database_cluster superuser true end postgresql_user "www-data" do - cluster "9.1/main" + cluster database_cluster end postgresql_munin "nominatim" do - cluster "9.1/main" - database "nominatim" + cluster database_cluster + database database_name end directory "/var/log/nominatim" do @@ -93,12 +107,20 @@ directory "/var/log/nominatim" do mode 0755 end +template "/etc/logrotate.d/nominatim" do + source "logrotate.nominatim.erb" + owner "root" + group "root" + mode 0644 +end + + package "osmosis" package "gcc" package "proj-bin" package "libgeos-c1" -package "postgresql-9.1-postgis" -package "postgresql-server-dev-9.1" +package "postgresql-#{database_version}-postgis-#{postgis_version}" +package "postgresql-server-dev-#{database_version}" package "build-essential" package "libxml2-dev" package "libgeos-dev" @@ -176,7 +198,14 @@ file "#{source_directory}/settings/ip_blocks.map" do mode 0664 end +if node[:nominatim][:enabled] + cron_action = :create +else + cron_action = :delete +end + cron "nominatim_logrotate" do + action cron_action hour "5" minute "30" weekday "0" @@ -186,12 +215,14 @@ cron "nominatim_logrotate" do 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 + action cron_action hour "2" minute "00" command "#{source_directory}/utils/cron_vacuum.sh" @@ -252,6 +283,7 @@ template "/usr/local/bin/backup-nominatim" do end cron "nominatim_backup" do + action cron_action hour "3" minute "00" day "1"