X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/9e2b2da0b74aa41c278d4df6aa042978c705fff0..86d35f661934c33b483b07018d1b9c1a063ccbfc:/cookbooks/nominatim/recipes/base.rb diff --git a/cookbooks/nominatim/recipes/base.rb b/cookbooks/nominatim/recipes/base.rb index 88b9cf6fa..da10a9001 100644 --- a/cookbooks/nominatim/recipes/base.rb +++ b/cookbooks/nominatim/recipes/base.rb @@ -19,7 +19,6 @@ include_recipe "apache::ssl" include_recipe "postgresql" -include_recipe "git" package "php5" package "php5-cli" @@ -27,6 +26,7 @@ package "php5-pgsql" package "php5-fpm" package "php-pear" package "php-apc" +package "php-db" apache_module "rewrite" apache_module "proxy" @@ -65,10 +65,31 @@ postgresql_munin "nominatim" do database database_name end -directory "/var/log/nominatim" do +directory node[:nominatim][:logdir] do owner "nominatim" group "nominatim" mode 0755 + recursive true +end + +file "#{node[:nominatim][:logdir]}/query.log" do + action :create_if_missing + owner "www-data" + group "adm" + mode 0664 +end + +file "#{node[:nominatim][:logdir]}/update.log" do + action :create_if_missing + owner "nominatim" + group "adm" + mode 0664 +end + +directory "#{home_directory}/status" do + owner "nominatim" + group "postgres" + mode 0775 end template "/etc/logrotate.d/nominatim" do @@ -78,6 +99,13 @@ template "/etc/logrotate.d/nominatim" do mode 0644 end +template "/etc/logrotate.d/apache2" do + source "logrotate.apache.erb" + owner "root" + group "root" + mode 0644 +end + package "osmosis" package "gcc" package "proj-bin" @@ -86,6 +114,7 @@ package "postgresql-#{database_version}-postgis-#{postgis_version}" package "postgresql-server-dev-#{database_version}" package "build-essential" package "libxml2-dev" +package "libexpat-dev" package "libgeos-dev" package "libgeos++-dev" package "libpq-dev" @@ -101,23 +130,12 @@ package "libboost-system-dev" package "libboost-filesystem-dev" package "libboost-thread-dev" -execute "php-pear-db" do - command "pear install DB" - not_if { File.exist?("/usr/share/php/DB") } -end - execute "compile_nominatim" do action :nothing command "cd #{source_directory} && ./autogen.sh && ./configure && make" user "nominatim" end -directory "#{source_directory}/log" do - owner "nominatim" - group "nominatim" - mode 0755 -end - template "#{source_directory}/.git/hooks/post-merge" do source "update_source.erb" owner "nominatim" @@ -156,11 +174,11 @@ file "#{source_directory}/settings/ip_blocks.map" do mode 0664 end -if node[:nominatim][:enabled] - cron_action = :create -else - cron_action = :delete -end +cron_action = if node[:nominatim][:enabled] + :create + else + :delete + end template "/etc/cron.d/nominatim" do action cron_action @@ -222,7 +240,7 @@ external_data.each do |fname| end end -additional_scripts = %w(backup-nominatim clean-db-nominatim) +additional_scripts = %w(backup-nominatim vacuum-db-nominatim) additional_scripts.each do |fname| template "/usr/local/bin/#{fname}" do @@ -240,13 +258,6 @@ directory File.dirname(node[:nominatim][:flatnode_file]) do recursive true end -directory "/data/postgresql-archive" do - owner "postgres" - group "postgres" - mode 0700 - only_if { node[:postgresql][:settings][:defaults][:archive_mode] == "on" } -end - apache_site "nominatim.openstreetmap.org" do template "apache.erb" directory source_directory