X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/7aa1c692da44b5441554522d486e01aa02b27c3a..b6bfcebb6947656b9be5a4c888df9245bcef8cbe:/cookbooks/nominatim/recipes/default.rb diff --git a/cookbooks/nominatim/recipes/default.rb b/cookbooks/nominatim/recipes/default.rb index a33fe85c2..29726650d 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" @@ -35,6 +35,10 @@ 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] + service "php5-fpm" do action [ :enable, :start ] supports :status => true, :restart => true, :reload => true @@ -42,49 +46,48 @@ end apache_site "nominatim.openstreetmap.org" do template "apache.erb" - directory "/home/lonvia/nominatim" + directory source_directory variables :pools => node[:nominatim][:fpm_pools] 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) - notifies :reload, resources(:service => "php5-fpm") + 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 +96,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" +package "postgresql-server-dev-#{database_version}" package "build-essential" package "libxml2-dev" package "libgeos-dev" @@ -110,6 +121,7 @@ package "automake" package "libproj-dev" package "libprotobuf-c0-dev" package "protobuf-c-compiler" +package "python-psycopg2" execute "php-pear-db" do command "pear install DB" @@ -185,7 +197,7 @@ cron "nominatim_logrotate" do end cron "nominatim_banip" do - command "#{source_directory}/utils/cron_banip.sh" + command "#{source_directory}/utils/cron_banip.py" user "nominatim" mailto email_errors end @@ -223,3 +235,38 @@ template "/etc/init.d/nominatim-update" do variables :source_directory => source_directory end +munin_plugin_conf "nominatim" do + template "munin.erb" +end + +munin_plugin "nominatim_importlag" do + target "#{source_directory}/munin/nominatim_importlag" +end + +munin_plugin "nominatim_query_speed" do + target "#{source_directory}/munin/nominatim_query_speed" +end + +munin_plugin "nominatim_requests" do + target "#{source_directory}/munin/nominatim_requests" +end + +munin_plugin "nominatim_throttled_ips" do + target "#{source_directory}/munin/nominatim_throttled_ips" +end + +template "/usr/local/bin/backup-nominatim" do + source "backup-nominatim.erb" + owner "root" + group "root" + mode 0755 +end + +cron "nominatim_backup" do + hour "3" + minute "00" + day "1" + command "/usr/local/bin/backup-nominatim" + user "nominatim" + mailto email_errors +end