]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/overpass/recipes/default.rb
Add postgresql_sequence for managing sequences
[chef.git] / cookbooks / overpass / recipes / default.rb
index 2b338c0be16a73cf83ee1260a88ad5f6f687d2e3..720b113216d342abe8f6ccec947cd0aa5f15eb28 100644 (file)
@@ -38,7 +38,7 @@ end
 
 ## Install overpass from source
 
 
 ## Install overpass from source
 
-srcdir = "#{basedir}/src/osm-3s_v#{node[:overpass][:full_version]}"
+srcdir = "#{basedir}/src/osm-3s_v#{node[:overpass][:version]}"
 
 package %w[
   build-essential
 
 package %w[
   build-essential
@@ -70,6 +70,8 @@ execute "install_overpass" do
   user username
   cwd srcdir
   command "./configure --enable-lz4 --prefix=#{basedir} && make install"
   user username
   cwd srcdir
   command "./configure --enable-lz4 --prefix=#{basedir} && make install"
+  notifies :restart, "service[overpass-dispatcher]"
+  notifies :restart, "service[overpass-area-dispatcher]"
 end
 
 ## Setup Apache
 end
 
 ## Setup Apache
@@ -149,6 +151,7 @@ end
 
 systemd_service "overpass-dispatcher" do
   description "Overpass Main Dispatcher"
 
 systemd_service "overpass-dispatcher" do
   description "Overpass Main Dispatcher"
+  wants ["overpass-area-dispatcher.service"]
   working_directory basedir
   exec_start "#{basedir}/bin/dispatcher --osm-base #{meta_map_short[node[:overpass][:meta_mode]]} --db-dir=#{basedir}/db --rate-limit=#{node[:overpass][:rate_limit]} --space=#{node[:overpass][:dispatcher_space]}"
   exec_stop "#{basedir}/bin/dispatcher --osm-base --terminate"
   working_directory basedir
   exec_start "#{basedir}/bin/dispatcher --osm-base #{meta_map_short[node[:overpass][:meta_mode]]} --db-dir=#{basedir}/db --rate-limit=#{node[:overpass][:rate_limit]} --space=#{node[:overpass][:dispatcher_space]}"
   exec_stop "#{basedir}/bin/dispatcher --osm-base --terminate"
@@ -162,7 +165,7 @@ end
 
 systemd_service "overpass-area-dispatcher" do
   description "Overpass Area Dispatcher"
 
 systemd_service "overpass-area-dispatcher" do
   description "Overpass Area Dispatcher"
-  after ["overpass-dispatcher"]
+  after ["overpass-dispatcher.service"]
   working_directory basedir
   exec_start "#{basedir}/bin/dispatcher --areas #{meta_map_short[node[:overpass][:meta_mode]]} --db-dir=#{basedir}/db"
   exec_stop "#{basedir}/bin/dispatcher --areas --terminate"
   working_directory basedir
   exec_start "#{basedir}/bin/dispatcher --areas #{meta_map_short[node[:overpass][:meta_mode]]} --db-dir=#{basedir}/db"
   exec_stop "#{basedir}/bin/dispatcher --areas --terminate"
@@ -176,43 +179,46 @@ end
 
 systemd_service "overpass-update" do
   description "Overpass Update Application"
 
 systemd_service "overpass-update" do
   description "Overpass Update Application"
-  after ["overpass-dispatcher"]
+  after ["overpass-dispatcher.service"]
+  wants ["overpass-area-processor.service"]
   working_directory basedir
   exec_start "#{basedir}/bin/overpass-update-db"
   standard_output "append:#{logdir}/update.log"
   user username
   working_directory basedir
   exec_start "#{basedir}/bin/overpass-update-db"
   standard_output "append:#{logdir}/update.log"
   user username
+  restart "on-success"
 end
 
 if node[:overpass][:meta_mode] == "attic"
   systemd_service "overpass-area-processor" do
     description "Overpass Area Processor"
 end
 
 if node[:overpass][:meta_mode] == "attic"
   systemd_service "overpass-area-processor" do
     description "Overpass Area Processor"
-    after ["overpass-area-dispatcher"]
+    after ["overpass-area-dispatcher.service", "overpass-update.service"]
     working_directory basedir
     exec_start "#{basedir}/bin/overpass-update-areas"
     standard_output "append:#{logdir}/area-processor.log"
     working_directory basedir
     exec_start "#{basedir}/bin/overpass-update-areas"
     standard_output "append:#{logdir}/area-processor.log"
+    restart "on-success"
     nice 19
     user username
   end
 else
   systemd_service "overpass-area-processor" do
     description "Overpass Area Processor"
     nice 19
     user username
   end
 else
   systemd_service "overpass-area-processor" do
     description "Overpass Area Processor"
-    after ["overpass-area-dispatcher"]
+    after ["overpass-area-dispatcher.service", "overpass-update.service"]
     working_directory basedir
     exec_start "#{basedir}/bin/osm3s_query --progress --rules"
     standard_input "file:#{srcdir}/rules/areas.osm3s"
     standard_output "append:#{logdir}/area-processor.log"
     working_directory basedir
     exec_start "#{basedir}/bin/osm3s_query --progress --rules"
     standard_input "file:#{srcdir}/rules/areas.osm3s"
     standard_output "append:#{logdir}/area-processor.log"
+    restart "on-success"
     nice 19
     user username
   end
 end
 
 systemd_timer "overpass-area-processor" do
     nice 19
     user username
   end
 end
 
 systemd_timer "overpass-area-processor" do
-  description "Update areas in Overpass"
-  on_calendar "*-*-* *:*:00"
+  action :delete
 end
 
 service "overpass-area-processor" do
 end
 
 service "overpass-area-processor" do
-  action [:enable]
+  action [:disable]
 end
 
 template "/etc/logrotate.d/overpass" do
 end
 
 template "/etc/logrotate.d/overpass" do
@@ -244,6 +250,7 @@ end
 prometheus_exporter "overpass" do
   port 9898
   user username
 prometheus_exporter "overpass" do
   port 9898
   user username
+  restrict_address_families "AF_UNIX"
   options [
     "--overpass.base-directory=#{basedir}"
   ]
   options [
     "--overpass.base-directory=#{basedir}"
   ]