package "php-apc"
apache_module "rewrite"
+apache_module "proxy"
+apache_module "proxy_fcgi"
-if node[:lsb][:release].to_f >= 14.04
- apache_module "proxy"
- apache_module "proxy_fcgi"
-else
- apache_module "fastcgi-handler"
-end
-
+passwords = data_bag_item("nominatim", "passwords")
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_version = database_cluster.sub(%r{/.*}, "")
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 ]
+ provider Chef::Provider::Service::Upstart
+ action [:enable, :start]
supports :status => true, :restart => true, :reload => true
end
end
apache_site "default" do
- action [ :disable ]
+ action [:disable]
end
-node[:nominatim][:fpm_pools].each do |name,data|
+node[:nominatim][:fpm_pools].each do |name, data|
template "/etc/php5/fpm/pool.d/#{name}.conf" do
source "fpm.conf.erb"
owner "root"
end
end
-postgresql_user "tomh" do
- cluster database_cluster
- superuser true
-end
-
-postgresql_user "lonvia" do
- cluster database_cluster
- superuser true
-end
+superusers = %w(tomh lonvia twain nominatim)
-postgresql_user "twain" do
- cluster database_cluster
- superuser true
+superusers.each do |user|
+ postgresql_user user do
+ cluster database_cluster
+ superuser true
+ end
end
-postgresql_user "nominatim" do
+postgresql_user "www-data" do
cluster database_cluster
- superuser true
end
-postgresql_user "www-data" do
+postgresql_user "replication" do
cluster database_cluster
+ password passwords["replication"]
+ replication true
end
postgresql_munin "nominatim" do
mode 0644
end
-
package "osmosis"
package "gcc"
package "proj-bin"
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
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
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
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
+external_data = [
+ "wikipedia_article.sql.bin",
+ "wikipedia_redirect.sql.bin",
+ "gb_postcode_data.sql.gz"
+]
+
+external_data.each do |fname|
+ remote_file "#{source_directory}/data/#{fname}" do
+ action :create_if_missing
+ source "http://www.nominatim.org/data/#{fname}"
+ owner "nominatim"
+ group "nominatim"
+ mode 0644
+ end
+end
+
+additional_scripts = %w(backup-nominatim clean-db-nominatim)
+
+additional_scripts.each do |fname|
+ template "/usr/local/bin/#{fname}" do
+ source "#{fname}.erb"
+ owner "root"
+ group "root"
+ mode 0755
+ end
end
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